vocnu 0.3.0 → 0.4.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/README.md +1 -0
- package/package.json +1 -1
- package/src/cli.js +9 -0
- package/src/mcp.js +4 -0
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ progress and time left, and saves the results next to the file. Options:
|
|
|
30
30
|
| `--format mp4\|mkv\|mov\|webm\|avi` | video file format, or several separated by commas (`--format mp4,mkv`: one file each, for the price of the dearest); default: the upload's own, else MP4 |
|
|
31
31
|
| `--audio-format m4a\|mp3\|wav\|flac\|ogg` | voice-over audio format |
|
|
32
32
|
| `--burn-subtitles` | subtitles burned into the picture |
|
|
33
|
+
| `--original-level <0-100>` | how loud the original sound stays under the voice, in percent (default: 40; 0 silences it, 100 leaves it as it is); between the lines it plays at full volume |
|
|
33
34
|
| `--sdh` | SDH subtitles as well (sounds, speaker names and songs for deaf and hard-of-hearing viewers), one more credit per minute; with `--output subtitles` they may be in the spoken language (`--from de --to de`) |
|
|
34
35
|
| `--out <dir>` | where the results go |
|
|
35
36
|
| `--yes` | start without confirming the price |
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -30,6 +30,7 @@ Usage:
|
|
|
30
30
|
--format mp4|mkv|mov|webm|avi Video file format, or several: mp4,mkv (default: the upload's, else mp4)
|
|
31
31
|
--audio-format m4a|mp3|wav|flac|ogg
|
|
32
32
|
--burn-subtitles Subtitles burned into the picture
|
|
33
|
+
--original-level <0-100> How loud the original stays under the voice, in % (default: 40)
|
|
33
34
|
--sdh SDH subtitles too: sounds, speaker names and songs, for deaf and
|
|
34
35
|
hard-of-hearing viewers (subtitles may be in the spoken language)
|
|
35
36
|
--out <directory> Where the results go (default: next to the file)
|
|
@@ -156,6 +157,7 @@ async function translate(args, { api, err, out, print }) {
|
|
|
156
157
|
format: { type: 'string' },
|
|
157
158
|
from: { type: 'string' },
|
|
158
159
|
'no-wait': { type: 'boolean' },
|
|
160
|
+
'original-level': { type: 'string' },
|
|
159
161
|
out: { type: 'string' },
|
|
160
162
|
output: { type: 'string' },
|
|
161
163
|
sdh: { type: 'boolean' },
|
|
@@ -171,10 +173,16 @@ async function translate(args, { api, err, out, print }) {
|
|
|
171
173
|
// A voice type, or a catalog voice of the target language, whose type the API takes.
|
|
172
174
|
const voice = values.voice ?? 'male'
|
|
173
175
|
const voiceType = ['male', 'female'].includes(voice) ? voice : 'male'
|
|
176
|
+
// How loud the original stays under the voice, in whole percent; the API's default (40) when not given.
|
|
177
|
+
const originalLevel = values['original-level']
|
|
174
178
|
if (!OUTPUTS.includes(output)) throw new UsageError(`--output is one of ${OUTPUTS.join(', ')}.`)
|
|
175
179
|
if (!videoFormats) throw new UsageError(`--format is one or more of ${VIDEO_FORMATS.join(', ')}, separated by commas.`)
|
|
176
180
|
if (!AUDIO_FORMATS.includes(audioFormat)) throw new UsageError(`--audio-format is one of ${AUDIO_FORMATS.join(', ')}.`)
|
|
177
181
|
if (!/^[a-z0-9-]+$/.test(voice)) throw new UsageError('--voice is male, female or a voice id from `vocnu voices <lang>`.')
|
|
182
|
+
if (originalLevel !== undefined && !(/^\d{1,3}$/.test(originalLevel) && Number(originalLevel) <= 100)) {
|
|
183
|
+
throw new UsageError('--original-level is a whole percent from 0 to 100.')
|
|
184
|
+
}
|
|
185
|
+
if (originalLevel !== undefined && output === 'subtitles') throw new UsageError('--original-level is for a voice-over; subtitles lower nothing.')
|
|
178
186
|
if (output === 'video' && !isVideo(path)) throw new UsageError('This is an audio file: use --output audio or subtitles.')
|
|
179
187
|
if (!contentType(path)) throw new UsageError('Vocnu takes video and audio files (MP4, MOV, MKV, WebM, MP3, M4A, WAV...).')
|
|
180
188
|
if (voice !== voiceType && !(await api.voices(target)).some((candidate) => candidate.id === voice)) {
|
|
@@ -210,6 +218,7 @@ async function translate(args, { api, err, out, print }) {
|
|
|
210
218
|
video_formats: videoFormats,
|
|
211
219
|
voice: voiceType,
|
|
212
220
|
...(voice === voiceType ? {} : { voice_id: voice }),
|
|
221
|
+
...(originalLevel === undefined ? {} : { original_level: Number(originalLevel) }),
|
|
213
222
|
})
|
|
214
223
|
print(`Started job ${created.job.id} (${created.credit_balance} credits left).`)
|
|
215
224
|
if (values['no-wait']) return 0
|
package/src/mcp.js
CHANGED
|
@@ -103,6 +103,9 @@ export function createServer(api, { cwd = process.cwd() } = {}) {
|
|
|
103
103
|
inputSchema: {
|
|
104
104
|
audio_format: z.enum(AUDIO_FORMATS).optional().describe('Voice-over audio format (default m4a)'),
|
|
105
105
|
burn_subtitles: z.boolean().optional().describe('Burn the subtitles into the picture (video only)'),
|
|
106
|
+
original_level: z.number().int().min(0).max(100).optional()
|
|
107
|
+
.describe('How loud the original sound stays under the voice, in percent: 0 silent, 100 unchanged '
|
|
108
|
+
+ '(default 40). Voice-over only; between the lines the original plays at full volume'),
|
|
106
109
|
output: z.enum(OUTPUTS),
|
|
107
110
|
sdh: z.boolean().optional()
|
|
108
111
|
.describe('Also SDH subtitles for deaf and hard-of-hearing viewers: sounds, speaker names and songs'),
|
|
@@ -131,6 +134,7 @@ export function createServer(api, { cwd = process.cwd() } = {}) {
|
|
|
131
134
|
video_formats: videoFormats,
|
|
132
135
|
voice: input.voice ?? 'male',
|
|
133
136
|
...(input.voice_id ? { voice_id: input.voice_id } : {}),
|
|
137
|
+
...(input.original_level === undefined ? {} : { original_level: input.original_level }),
|
|
134
138
|
})
|
|
135
139
|
return { balance_after: created.credit_balance, job_id: created.job.id, status: created.job.status }
|
|
136
140
|
})
|