@makefully/dutifully 1.10.1 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
- # Changelog
2
-
3
- ## 1.10.1
4
-
5
- - Publish as `@makefully/dutifully` on npm with trusted publishing support.
1
+ # Changelog
2
+
3
+ ## 1.11.0
4
+
5
+ - Preserve optional script-line `class` through transcription for VTT cue classes, SAMI spans, and JSON caption output.
6
+
7
+ ## 1.10.1
8
+
9
+ - Publish as `@makefully/dutifully` on npm with trusted publishing support.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) Makefully Studios
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) Makefully Studios
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,214 +1,216 @@
1
- # Dutifully (`@makefully/dutifully`)
2
-
3
- Client API for Cheerfully services. Cheerfully makes voice-over easy.
4
-
5
- ```bash
6
- npm install @makefully/dutifully
7
- ```
8
-
9
- To use the API, you will need to specify a root `./env-cheerfully.json` file with the following format:
10
-
11
- ```javascript
12
- {
13
- "server": "http://server:port",
14
- "accessToken": "accessTokenToUseCheerfullyService"
15
- }
16
- ```
17
-
18
- ## Services
19
-
20
- All services can be specified in `cheerfully.json` as described in the following sections. Services can be run as scripts specified in `package.json` as:
21
-
22
- ```javascript
23
- {
24
- "scripts": {
25
- "speech": "cheer -service elevenlabs",
26
- "lipsync": "cheer -service rhubarb",
27
- "captions": "cheer -service transcription"
28
- }
29
- }
30
- ```
31
-
32
- Alternatively, services can be run from Node by including Dutifully as shown:
33
-
34
- ```javascript
35
- const
36
- cheerfully = require('@makefully/dutifully');
37
-
38
- cheerfully({
39
- service: 'polly'
40
- });
41
- ```
42
-
43
- ## Say (spoken notifications)
44
-
45
- `say` generates short spoken phrases through Cheerfully's ElevenLabs service, caches the audio under `.cache/tts/`, and plays it locally via `node-web-audio-api`. Use it from npm scripts instead of wiring ElevenLabs into the consuming project:
46
-
47
- ```javascript
48
- {
49
- "scripts": {
50
- "say": "say",
51
- "web:release": "… && npm run say the web release is complete"
52
- }
53
- }
54
- ```
55
-
56
- Or programmatically:
57
-
58
- ```javascript
59
- const
60
- cheerfully = require('@makefully/dutifully');
61
-
62
- await cheerfully.say('The build is complete');
63
- ```
64
-
65
-
66
- Voice settings come from the first `elevenlabs` entry in `cheerfully.json` (same as other ElevenLabs chores). Server credentials and `elevenLabsApiKey` come from `env-cheerfully.json`. Cached files are keyed by voice + text, so repeats play immediately without regenerating.
67
-
68
- ### ElevenLabs
69
-
70
- This text-to-voice service requires a script as input and will download audio VO generated by ElevenLabs. You can set ElevenLabs settings in `cheerfully.json` like so:
71
-
72
- ```javascript
73
- {
74
- "elevenlabs": [{
75
- "script": "./example/script.json",
76
- "output": "./example/vo/en/",
77
- "model": "eleven_multilingual_v1",
78
- "updateAllMetaData": true,
79
- "voice": "Laura"
80
- }]
81
- }
82
- ```
83
-
84
- You may set a single `voice` value matching an available ElevenLabs voice id or this may be an object of key/value pairs with speaker name keys matched to voice ids. The speaker names must match speakers listed in the script. If "default" is provided as a key, this voice id will be used for any scripts not specifying a speaker.
85
-
86
- Specifying the `model` is optional: if unspecified, Cheerfully will pick a good option for the selected `voice`.
87
-
88
- Specifying `updateAllMetaData` is `false` by default. If it's set to `true`, album, title, and unsynchronized lyrics are appended to any MP3's in the source directory that were not generated.
89
-
90
- You may include your ElevenLabs API Key directly in the ElevenLabs spec above as `apiKey`, or set your API Key separately in `env-cheerfully.json`:
91
-
92
- ```javascript
93
- {
94
- "elevenLabsApiKey": "elevenlabsapikeyforyouraccount"
95
- }
96
- ```
97
-
98
- ### FFMPEG
99
-
100
- This audio file process accepts ffmpeg commandline arguments to perform operations on an audio file.
101
-
102
- ```javascript
103
- {
104
- "ffmpeg": [{
105
- "options": {"ac": 1},
106
- "src": "./example/vo/en/",
107
- "output": "./example/vo/en/"
108
- }]
109
- }
110
- ```
111
-
112
- ### Polly
113
-
114
- This text-to-voice service requires a script as input and will download audio VO generated by Amazon Polly. You can set Polly settings in `cheerfully.json` like so:
115
-
116
- ```javascript
117
- {
118
- "polly": [{
119
- "script": "./example/script.json",
120
- "output": "./example/vo/en/",
121
- "language": "en-US",
122
- "updateAllMetaData": true,
123
- "voice": "Ivy"
124
- }]
125
- }
126
- ```
127
-
128
- You may set a single `voice` value matching an available AMazon Polly voice or this may be an object of key/value pairs with speaker name keys matched to voices. The speaker names must match speakers listed in the script. If "default" is provided as a key, this voice will be used for any scripts not specifying a speaker.
129
-
130
- Specifying `updateAllMetaData` is `false` by default. If it's set to `true`, album, title, and unsynchronized lyrics are appended to any MP3's in the source directory that were not generated.
131
-
132
- ### Allosaurus
133
-
134
- This audio-to-lip-flap service requires audio as input and will download a mouth cues JSON file delineating mouth shapes for particular timestamps using Allosaurus. You can set Allosaurus settings in `cheerfully.json` like so:
135
-
136
- ```javascript
137
- {
138
- "allosaurus": [{
139
- "options" {
140
- "compress": true,
141
- "exportFormat": "json"
142
- },
143
- "src": "./example/vo/en/",
144
- "output": "./example/lipsync/en/"
145
- }]
146
- }
147
- ```
148
-
149
- Export formats include those supported by Rhubarb as well as "mp3" which will embed lipsync timings into the MP3's id3 meta data.
150
-
151
- For exporting to JSON, you can set `compress` to `true` for the format to use JSON arrays similar to Rhubarb's shorter `tsv` format.
152
-
153
- ### Rhubarb
154
-
155
- This audio-to-lip-flap service requires audio as input and will download a mouth cues JSON file delineating mouth shapes for particular timestamps using Rhubarb Lip-Sync. You can set Rhubarb settings in `cheerfully.json` like so:
156
-
157
- ```javascript
158
- {
159
- "rhubarb": [{
160
- "options" {
161
- "compress": true,
162
- "exportFormat": "json"
163
- },
164
- "src": "./example/vo/en/",
165
- "output": "./example/lipsync/en/"
166
- }]
167
- }
168
- ```
169
-
170
- Export formats include those supported by Rhubarb as well as "mp3" which will embed lipsync timings into the MP3's id3 meta data.
171
-
172
- For exporting to JSON, you can set `compress` to `true` for the format to use JSON arrays similar to Rhubarb's shorter `tsv` format.
173
-
174
- ### Transcription
175
-
176
- This audio-to-captions service requires audio as input and will download a captions JSON file delineating captions with timestamps using Amazon Transcription. You can set Transcription settings in `cheerfully.json` like so:
177
-
178
- ```javascript
179
- {
180
- "transcription": [{
181
- "format": "sami",
182
- "language": "en-US",
183
- "limit": 40,
184
- "prependSpeaker": "[]",
185
- "script": "./example/script.json",
186
- "src": "./example/vo/en/",
187
- "nowrap": [],
188
- "output": "./example/captions/en/"
189
- }]
190
- }
191
- ```
192
-
193
- Transcription supports the following formats:
194
-
195
- * JSON
196
- * LRC
197
- * MP3 (Embedded in source MP3 as a SYLT ID3 tag labeled "captions".)
198
- * SAMI / SMI
199
- * SRT
200
- * VTT
201
-
202
- Specify `limit` to set the maximum number of characters for a single caption line. The default is `40`.
203
-
204
- If your scripts include any phrases that should remain unbroken by the captioning process, add them to the `nowrap` list. For example: `"nowrap": ["Makefully Studios"]`.
205
-
206
- ## Example
207
-
208
- Find an example script in the `./examples/` folder. You can run either `npm run test-elevenlabs` or `npm run test-polly` to create VO tracks in the examples folder that you can then use to try out `npm run test-rhubarb` and `npm run test-transcription`.
209
-
210
- These examples are specified using a JSON definition in `./cheerfully.json` which you can copy or modify to set different generation parameters as supported by Cheerfully.
211
-
212
- ---
213
-
214
- Maintainers: see [PUBLISHING.md](PUBLISHING.md) for npm trusted publishing setup.
1
+ # Dutifully (`@makefully/dutifully`)
2
+
3
+ Client API for Cheerfully services. Cheerfully makes voice-over easy.
4
+
5
+ ```bash
6
+ npm install @makefully/dutifully
7
+ ```
8
+
9
+ To use the API, you will need to specify a root `./env-cheerfully.json` file with the following format:
10
+
11
+ ```javascript
12
+ {
13
+ "server": "http://server:port",
14
+ "accessToken": "accessTokenToUseCheerfullyService"
15
+ }
16
+ ```
17
+
18
+ ## Services
19
+
20
+ All services can be specified in `cheerfully.json` as described in the following sections. Services can be run as scripts specified in `package.json` as:
21
+
22
+ ```javascript
23
+ {
24
+ "scripts": {
25
+ "speech": "cheer -service elevenlabs",
26
+ "lipsync": "cheer -service rhubarb",
27
+ "captions": "cheer -service transcription"
28
+ }
29
+ }
30
+ ```
31
+
32
+ Alternatively, services can be run from Node by including Dutifully as shown:
33
+
34
+ ```javascript
35
+ const
36
+ cheerfully = require('@makefully/dutifully');
37
+
38
+ cheerfully({
39
+ service: 'polly'
40
+ });
41
+ ```
42
+
43
+ ## Say (spoken notifications)
44
+
45
+ `say` generates short spoken phrases through Cheerfully's ElevenLabs service, caches the audio under `.cache/tts/`, and plays it locally via `node-web-audio-api`. Use it from npm scripts instead of wiring ElevenLabs into the consuming project:
46
+
47
+ ```javascript
48
+ {
49
+ "scripts": {
50
+ "say": "say",
51
+ "web:release": "… && npm run say the web release is complete"
52
+ }
53
+ }
54
+ ```
55
+
56
+ Or programmatically:
57
+
58
+ ```javascript
59
+ const
60
+ cheerfully = require('@makefully/dutifully');
61
+
62
+ await cheerfully.say('The build is complete');
63
+ ```
64
+
65
+
66
+ Voice settings come from the first `elevenlabs` entry in `cheerfully.json` (same as other ElevenLabs chores). Server credentials and `elevenLabsApiKey` come from `env-cheerfully.json`. Cached files are keyed by voice + text, so repeats play immediately without regenerating.
67
+
68
+ ### ElevenLabs
69
+
70
+ This text-to-voice service requires a script as input and will download audio VO generated by ElevenLabs. You can set ElevenLabs settings in `cheerfully.json` like so:
71
+
72
+ ```javascript
73
+ {
74
+ "elevenlabs": [{
75
+ "script": "./example/script.json",
76
+ "output": "./example/vo/en/",
77
+ "model": "eleven_multilingual_v1",
78
+ "updateAllMetaData": true,
79
+ "voice": "Laura"
80
+ }]
81
+ }
82
+ ```
83
+
84
+ You may set a single `voice` value matching an available ElevenLabs voice id or this may be an object of key/value pairs with speaker name keys matched to voice ids. The speaker names must match speakers listed in the script. If "default" is provided as a key, this voice id will be used for any scripts not specifying a speaker.
85
+
86
+ Specifying the `model` is optional: if unspecified, Cheerfully will pick a good option for the selected `voice`.
87
+
88
+ Specifying `updateAllMetaData` is `false` by default. If it's set to `true`, album, title, and unsynchronized lyrics are appended to any MP3's in the source directory that were not generated.
89
+
90
+ You may include your ElevenLabs API Key directly in the ElevenLabs spec above as `apiKey`, or set your API Key separately in `env-cheerfully.json`:
91
+
92
+ ```javascript
93
+ {
94
+ "elevenLabsApiKey": "elevenlabsapikeyforyouraccount"
95
+ }
96
+ ```
97
+
98
+ ### FFMPEG
99
+
100
+ This audio file process accepts ffmpeg commandline arguments to perform operations on an audio file.
101
+
102
+ ```javascript
103
+ {
104
+ "ffmpeg": [{
105
+ "options": {"ac": 1},
106
+ "src": "./example/vo/en/",
107
+ "output": "./example/vo/en/"
108
+ }]
109
+ }
110
+ ```
111
+
112
+ ### Polly
113
+
114
+ This text-to-voice service requires a script as input and will download audio VO generated by Amazon Polly. You can set Polly settings in `cheerfully.json` like so:
115
+
116
+ ```javascript
117
+ {
118
+ "polly": [{
119
+ "script": "./example/script.json",
120
+ "output": "./example/vo/en/",
121
+ "language": "en-US",
122
+ "updateAllMetaData": true,
123
+ "voice": "Ivy"
124
+ }]
125
+ }
126
+ ```
127
+
128
+ You may set a single `voice` value matching an available AMazon Polly voice or this may be an object of key/value pairs with speaker name keys matched to voices. The speaker names must match speakers listed in the script. If "default" is provided as a key, this voice will be used for any scripts not specifying a speaker.
129
+
130
+ Specifying `updateAllMetaData` is `false` by default. If it's set to `true`, album, title, and unsynchronized lyrics are appended to any MP3's in the source directory that were not generated.
131
+
132
+ ### Allosaurus
133
+
134
+ This audio-to-lip-flap service requires audio as input and will download a mouth cues JSON file delineating mouth shapes for particular timestamps using Allosaurus. You can set Allosaurus settings in `cheerfully.json` like so:
135
+
136
+ ```javascript
137
+ {
138
+ "allosaurus": [{
139
+ "options" {
140
+ "compress": true,
141
+ "exportFormat": "json"
142
+ },
143
+ "src": "./example/vo/en/",
144
+ "output": "./example/lipsync/en/"
145
+ }]
146
+ }
147
+ ```
148
+
149
+ Export formats include those supported by Rhubarb as well as "mp3" which will embed lipsync timings into the MP3's id3 meta data.
150
+
151
+ For exporting to JSON, you can set `compress` to `true` for the format to use JSON arrays similar to Rhubarb's shorter `tsv` format.
152
+
153
+ ### Rhubarb
154
+
155
+ This audio-to-lip-flap service requires audio as input and will download a mouth cues JSON file delineating mouth shapes for particular timestamps using Rhubarb Lip-Sync. You can set Rhubarb settings in `cheerfully.json` like so:
156
+
157
+ ```javascript
158
+ {
159
+ "rhubarb": [{
160
+ "options" {
161
+ "compress": true,
162
+ "exportFormat": "json"
163
+ },
164
+ "src": "./example/vo/en/",
165
+ "output": "./example/lipsync/en/"
166
+ }]
167
+ }
168
+ ```
169
+
170
+ Export formats include those supported by Rhubarb as well as "mp3" which will embed lipsync timings into the MP3's id3 meta data.
171
+
172
+ For exporting to JSON, you can set `compress` to `true` for the format to use JSON arrays similar to Rhubarb's shorter `tsv` format.
173
+
174
+ ### Transcription
175
+
176
+ This audio-to-captions service requires audio as input and will download a captions JSON file delineating captions with timestamps using Amazon Transcription. You can set Transcription settings in `cheerfully.json` like so:
177
+
178
+ ```javascript
179
+ {
180
+ "transcription": [{
181
+ "format": "sami",
182
+ "language": "en-US",
183
+ "limit": 40,
184
+ "prependSpeaker": "[]",
185
+ "script": "./example/script.json",
186
+ "src": "./example/vo/en/",
187
+ "nowrap": [],
188
+ "output": "./example/captions/en/"
189
+ }]
190
+ }
191
+ ```
192
+
193
+ Transcription supports the following formats:
194
+
195
+ * JSON
196
+ * LRC
197
+ * MP3 (Embedded in source MP3 as a SYLT ID3 tag labeled "captions".)
198
+ * SAMI / SMI
199
+ * SRT
200
+ * VTT
201
+
202
+ Specify `limit` to set the maximum number of characters for a single caption line. The default is `40`.
203
+
204
+ If your scripts include any phrases that should remain unbroken by the captioning process, add them to the `nowrap` list. For example: `"nowrap": ["Makefully Studios"]`.
205
+
206
+ Script lines may include an optional `class` (for example `"title"` or `"stage"`). In VTT exports this becomes a cue class span (`<c.title>…</c>`). In SAMI/SMI the paragraph `Class` is the job language plus `CC` (for example `ENUSCC` for `en-US`); when a speaker and/or script `class` is present, the dialog is wrapped in `<SPAN Class="…">` (for example `Class="todd stage"`). In JSON exports it is included on each caption entry. SRT, LRC, and MP3 SYLT ignore it.
207
+
208
+ ## Example
209
+
210
+ Find an example script in the `./examples/` folder. You can run either `npm run test-elevenlabs` or `npm run test-polly` to create VO tracks in the examples folder that you can then use to try out `npm run test-rhubarb` and `npm run test-transcription`.
211
+
212
+ These examples are specified using a JSON definition in `./cheerfully.json` which you can copy or modify to set different generation parameters as supported by Cheerfully.
213
+
214
+ ---
215
+
216
+ Maintainers: see [PUBLISHING.md](PUBLISHING.md) for npm trusted publishing setup.
package/cheer.js CHANGED
@@ -1,37 +1,37 @@
1
- #!/usr/bin/env node
2
-
3
- const
4
- cheer = require('./src/index'),
5
- getArgsAsObj = () => {
6
- const
7
- {argv: args} = process,
8
- cmds = {},
9
- cleanKey = (key) => key.replace(/\-/g, ' ').trim().replace(/ /g, '-');
10
- let key = '';
11
-
12
- // copy arguments into environment data.
13
- for (let i = 2; i < args.length; i++) {
14
- const
15
- arg = args[i];
16
-
17
- if (arg[0] === '-') {
18
- if (key) {
19
- cmds[key] = true;
20
- }
21
- key = cleanKey(arg);
22
- } else if (key) {
23
- cmds[key] = arg;
24
- key = '';
25
- } else {
26
- cmds[cleanKey(arg)] = true;
27
- }
28
- }
29
-
30
- if (key) { // in case last option has no value
31
- cmds[key] = true;
32
- }
33
-
34
- return cmds;
35
- };
36
-
1
+ #!/usr/bin/env node
2
+
3
+ const
4
+ cheer = require('./src/index'),
5
+ getArgsAsObj = () => {
6
+ const
7
+ {argv: args} = process,
8
+ cmds = {},
9
+ cleanKey = (key) => key.replace(/\-/g, ' ').trim().replace(/ /g, '-');
10
+ let key = '';
11
+
12
+ // copy arguments into environment data.
13
+ for (let i = 2; i < args.length; i++) {
14
+ const
15
+ arg = args[i];
16
+
17
+ if (arg[0] === '-') {
18
+ if (key) {
19
+ cmds[key] = true;
20
+ }
21
+ key = cleanKey(arg);
22
+ } else if (key) {
23
+ cmds[key] = arg;
24
+ key = '';
25
+ } else {
26
+ cmds[cleanKey(arg)] = true;
27
+ }
28
+ }
29
+
30
+ if (key) { // in case last option has no value
31
+ cmds[key] = true;
32
+ }
33
+
34
+ return cmds;
35
+ };
36
+
37
37
  cheer(getArgsAsObj());