decklight 0.9.0 → 0.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/NOTICE +2 -0
- package/PLATFORM.md +61 -3
- package/README.md +58 -28
- package/SPEC.md +1326 -85
- package/cli/agent-review.mjs +5 -4
- package/cli/agents.mjs +148 -18
- package/cli/bundle-audio.mjs +10 -3
- package/cli/bundle-module.mjs +95 -0
- package/cli/bundle.mjs +125 -7
- package/cli/cast.mjs +86 -19
- package/cli/check-fixes.mjs +194 -0
- package/cli/check-watch.mjs +151 -0
- package/cli/check.mjs +491 -75
- package/cli/code-editor.mjs +287 -0
- package/cli/commands.mjs +13 -2
- package/cli/commit-flow.mjs +7 -3
- package/cli/commit-message.mjs +35 -8
- package/cli/commit-split.mjs +125 -25
- package/cli/deck-refs.mjs +8 -3
- package/cli/decklight.mjs +11 -1
- package/cli/design-system-edit.mjs +37 -1
- package/cli/design-system-refs.mjs +263 -6
- package/cli/design-system.mjs +82 -14
- package/cli/edit-address.mjs +184 -0
- package/cli/edit-git.mjs +23 -6
- package/cli/edit-handover.mjs +257 -40
- package/cli/edit-look.mjs +293 -6
- package/cli/edit-open.mjs +143 -0
- package/cli/edit-slides.mjs +1043 -67
- package/cli/edit-translate.mjs +243 -0
- package/cli/edit.mjs +3680 -319
- package/cli/editor-support.mjs +286 -0
- package/cli/enhance.mjs +157 -27
- package/cli/find-replace.mjs +142 -0
- package/cli/fix-review.mjs +368 -0
- package/cli/git.mjs +13 -0
- package/cli/init.mjs +101 -22
- package/cli/keep-awake.mjs +68 -0
- package/cli/marketplace-autocheck.mjs +200 -0
- package/cli/marketplace.mjs +250 -13
- package/cli/migrate-writing.mjs +214 -0
- package/cli/narrate.mjs +121 -5
- package/cli/open.mjs +53 -15
- package/cli/outside-edit.mjs +257 -0
- package/cli/paste.mjs +92 -0
- package/cli/pdf.mjs +88 -10
- package/cli/pptx-export.mjs +10 -5
- package/cli/publish.mjs +24 -3
- package/cli/record.mjs +86 -15
- package/cli/remote.mjs +32 -6
- package/cli/rewrite.mjs +265 -0
- package/cli/runtime-link.mjs +218 -17
- package/cli/serve.mjs +9 -6
- package/cli/setup.mjs +2 -2
- package/cli/skill-content.mjs +251 -10
- package/cli/skills/slide-writing.md +333 -0
- package/cli/skills/voiceover.md +423 -0
- package/cli/skills.mjs +282 -15
- package/cli/starter-full.mjs +353 -0
- package/cli/supervise.mjs +14 -0
- package/cli/theme-refs.mjs +14 -2
- package/cli/theme.mjs +3 -2
- package/cli/translate-core.mjs +466 -0
- package/cli/translate-files.mjs +149 -0
- package/cli/translate.mjs +458 -0
- package/cli/units.mjs +75 -7
- package/cli/util.mjs +25 -0
- package/cli/vocabulary-docs.mjs +138 -0
- package/dist/decklight.css +2506 -113
- package/dist/decklight.js +385 -175
- package/dist/decklight.js.map +4 -4
- package/docs/GLOSSARY.md +9 -2
- package/docs/WRITING_RESEARCH.md +327 -0
- package/package.json +5 -3
- package/themes/coastal.css +3 -0
- package/themes/metropolis.css +2 -0
- package/themes/reveal-blood.css +3 -0
- package/themes/reveal-league.css +2 -0
- package/themes/reveal-moon.css +2 -0
- package/themes/reveal-serif.css +1 -0
- package/themes/reveal-sky.css +1 -0
- package/themes/reveal-solarized.css +4 -0
- package/tools/brand-palette.mjs +6 -1
- package/tools/build-groups.mjs +28 -8
- package/tools/cdp.mjs +176 -0
- package/tools/chart-spec.mjs +242 -0
- package/tools/click-match.mjs +70 -0
- package/tools/code-options.mjs +174 -0
- package/tools/conversation.mjs +49 -0
- package/tools/deck-family.mjs +101 -0
- package/tools/deck-html.mjs +212 -15
- package/tools/design-system-format.mjs +40 -1
- package/tools/design-system-migrations.mjs +207 -0
- package/tools/diagram-shapes.mjs +221 -0
- package/tools/elevenlabs-tts.mjs +62 -53
- package/tools/exec.mjs +10 -2
- package/tools/face-clip.mjs +96 -0
- package/tools/face-layout.mjs +94 -0
- package/tools/gemini-tts.mjs +1 -1
- package/tools/invisible-in-print.mjs +27 -0
- package/tools/lipsync-auto.mjs +197 -0
- package/tools/lipsync-config.mjs +16 -0
- package/tools/lipsync-engines.mjs +22 -4
- package/tools/lipsync-server.mjs +8 -5
- package/tools/lipsync.mjs +122 -30
- package/tools/local-voice.mjs +1 -1
- package/tools/mouth-file.mjs +26 -0
- package/tools/mouth.mjs +320 -0
- package/tools/narration-manifest.mjs +100 -6
- package/tools/narration-synth.mjs +96 -76
- package/tools/recording-impact.mjs +16 -1
- package/tools/sentences.mjs +7 -1
- package/tools/site-clip.mjs +114 -0
- package/tools/starters.mjs +402 -0
- package/tools/steps.mjs +118 -0
- package/tools/take-check.mjs +146 -0
- package/tools/template-theme.mjs +3 -1
- package/tools/test-impact.mjs +36 -12
- package/tools/theme-check.mjs +196 -1
- package/tools/tone-cue.mjs +108 -0
- package/tools/tts-cache.mjs +9 -3
- package/tools/tts-engines.mjs +100 -11
- package/tools/video-cache.mjs +93 -0
- package/tools/video-live.mjs +349 -0
- package/tools/video-options.mjs +11 -0
- package/tools/video.mjs +825 -117
- package/tools/viseme-fit.mjs +27 -0
- package/tools/viseme-match.mjs +77 -0
- package/tools/vocabulary.mjs +397 -0
- package/tools/voice-renumber.mjs +605 -0
- package/tools/voiceover-server.mjs +42 -11
- package/tools/voiceover.mjs +48 -20
- package/dist/build-info.json +0 -1
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// credentials (nor run piper), so this process holds them and exposes:
|
|
8
8
|
//
|
|
9
9
|
// GET /ping → { ok, engine, model, voices, stylable, audioTags } (player probes)
|
|
10
|
+
// GET /voice → resolved voice identity, or the roster with ?roster=1
|
|
10
11
|
// GET /voices → [[name, flavor], …]
|
|
11
12
|
// POST /tts → audio/wav { text, voice, style }
|
|
12
13
|
//
|
|
@@ -42,6 +43,7 @@ import { createInterface } from 'node:readline/promises';
|
|
|
42
43
|
import { canBind, resolvePortConflict, describePortOutcome } from '../cli/port-conflict.mjs';
|
|
43
44
|
import { execFile } from 'node:child_process';
|
|
44
45
|
import { cacheHome, clipKey, createTtsCache, extFor } from './tts-cache.mjs';
|
|
46
|
+
import { checkedSynth, takeLine } from './take-check.mjs';
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* The one exec a deck may trigger: open macOS's voice-download pane.
|
|
@@ -63,7 +65,7 @@ export function openVoiceSettings(exec = execFile, platform = process.platform)
|
|
|
63
65
|
}
|
|
64
66
|
exec('open', [VOICE_SETTINGS_URI], () => { /* fire and forget — Settings owns the rest */ });
|
|
65
67
|
}
|
|
66
|
-
import { resolveEngine, engineBlocker, engineMenu, engineStatus, ENGINES } from './tts-engines.mjs';
|
|
68
|
+
import { resolveEngine, engineBlocker, engineMenu, engineStatus, ENGINES, listVoiceIdentities, resolveTtsVoice } from './tts-engines.mjs';
|
|
67
69
|
import { loadTtsConfig, runSetupWizard, ttsConfigPath } from './tts-setup.mjs';
|
|
68
70
|
import { argReader, isMain, parsePort, badPort } from './args.mjs';
|
|
69
71
|
import { corsHeaders, readBody } from './bridge.mjs';
|
|
@@ -116,15 +118,17 @@ export async function ttsMain(args) {
|
|
|
116
118
|
piper local neural TTS — offline, unlimited, no credentials, no cost.
|
|
117
119
|
elevenlabs your ElevenLabs account's own voices — the ones you cloned included, listed
|
|
118
120
|
first in the picker. Needs $ELEVENLABS_API_KEY (never written to disk).
|
|
119
|
-
--tts-model
|
|
121
|
+
--tts-model eleven_v4_turbo (default) reads a script's audio tags ([whispers],
|
|
120
122
|
[laughs], [long pause]) as direction, and the picker's tone step appears
|
|
121
|
-
for it /
|
|
123
|
+
for it / eleven_v4 for quality over latency / eleven_v3, the first tag model —
|
|
122
124
|
higher latency, more variable / eleven_multilingual_v2, no tags (a tag
|
|
123
125
|
in the notes is taken out rather than read aloud).
|
|
124
|
-
--tts-stability creative|natural|robust — how hard v3
|
|
125
|
-
refused on any other model rather than silently doing
|
|
126
|
+
--tts-stability creative|natural|robust — how hard v3/v4 follow a tag, for
|
|
127
|
+
every sentence (refused on any other model rather than silently doing
|
|
128
|
+
nothing). Unset, a sentence under 60 characters goes at robust: short
|
|
129
|
+
input is where these models stutter.
|
|
126
130
|
--tts-format mp3 if your plan has no PCM output (costs you the panel's
|
|
127
|
-
|
|
131
|
+
Save with the deck and lip-sync, both of which read WAV).
|
|
128
132
|
|
|
129
133
|
<installed> any engine from a marketplace (decklight library add engine <name>) — --engine
|
|
130
134
|
takes its name like any of the six above, and the picker treats it the same.
|
|
@@ -285,6 +289,9 @@ export async function ttsMain(args) {
|
|
|
285
289
|
// ElevenLabs v3/v4 act on [whispers]-style tags; for any other engine
|
|
286
290
|
// the player (and /tts) take them out rather than have them read aloud
|
|
287
291
|
audioTags: h.engine.audioTags === true,
|
|
292
|
+
// the language the engine is told with every sentence, when it is told
|
|
293
|
+
// one: the panel says so beside the voice, and says when it is not
|
|
294
|
+
...(h.engine.lang ? { lang: h.engine.lang } : {}),
|
|
288
295
|
// the engine's standing note — for `say` with no Siri voice this is
|
|
289
296
|
// the download hint, and the picker keys its install row off it
|
|
290
297
|
...(h.engine.caveat ? { caveat: h.engine.caveat } : {}),
|
|
@@ -327,7 +334,7 @@ export async function ttsMain(args) {
|
|
|
327
334
|
});
|
|
328
335
|
|
|
329
336
|
// the player reads the cost estimate for its debug window
|
|
330
|
-
const CORS = corsHeaders('x-tts-cost, x-tts-tokens, x-tts-cached');
|
|
337
|
+
const CORS = corsHeaders('x-tts-cost, x-tts-tokens, x-tts-cached, x-tts-take');
|
|
331
338
|
let totalCost = 0;
|
|
332
339
|
let totalChars = 0;
|
|
333
340
|
|
|
@@ -428,13 +435,29 @@ export async function ttsMain(args) {
|
|
|
428
435
|
return sendJson(res, 200, { ok: true, ...added, voices: await voiceRoster(h) });
|
|
429
436
|
} catch (e) { return e?.status ? sendJson(res, e.status, e.body) : sendJson(res, 502, { ok: false, error: String(e.message ?? e) }); }
|
|
430
437
|
}
|
|
438
|
+
if (req.method === 'GET' && url.pathname === '/tts/voice') {
|
|
439
|
+
try {
|
|
440
|
+
const { engine, refIds } = await engineFor(asked);
|
|
441
|
+
if (url.searchParams.has('roster')) {
|
|
442
|
+
return sendJson(res, 200, { voices: await listVoiceIdentities(engine, { refresh: true }) });
|
|
443
|
+
}
|
|
444
|
+
const voice = url.searchParams.get('voice');
|
|
445
|
+
const voiceId = url.searchParams.get('voiceId') || refIds.get(voice);
|
|
446
|
+
const picked = await resolveTtsVoice(engine, { voice, voiceId, refresh: true });
|
|
447
|
+
return sendJson(res, 200, {
|
|
448
|
+
voice: picked.name, voiceId: picked.id, engine: engine.name, model: engine.model, audioTags: engine.audioTags === true,
|
|
449
|
+
});
|
|
450
|
+
} catch (e) {
|
|
451
|
+
return e?.status ? sendJson(res, e.status, e.body) : sendJson(res, 502, { error: e.message });
|
|
452
|
+
}
|
|
453
|
+
}
|
|
431
454
|
if (req.method === 'GET' && url.pathname === '/tts/voices') {
|
|
432
455
|
try { return sendJson(res, 200, await voiceRoster(await engineFor(asked))); }
|
|
433
456
|
catch (e) { return e?.status ? sendJson(res, e.status, e.body) : sendJson(res, 500, { ok: false, error: String(e) }); }
|
|
434
457
|
}
|
|
435
458
|
if (req.method === 'POST' && url.pathname === '/tts') {
|
|
436
459
|
try {
|
|
437
|
-
const { text: said, voice: picked, style, engine: wanted } = JSON.parse((await readBody(req)).toString());
|
|
460
|
+
const { text: said, voice: picked, voiceId: requestedId, style, engine: wanted } = JSON.parse((await readBody(req)).toString());
|
|
438
461
|
// the engine THIS tab speaks with — never whichever another tab last chose
|
|
439
462
|
let h;
|
|
440
463
|
try { h = await engineFor(wanted || asked); }
|
|
@@ -444,12 +467,14 @@ export async function ttsMain(args) {
|
|
|
444
467
|
// never read aloud by one that cannot (SPEC `PRESENTING`)
|
|
445
468
|
const text = forEngine(engine, said);
|
|
446
469
|
if (!text?.trim()) { res.writeHead(400, CORS); return res.end('no text'); }
|
|
447
|
-
const voice =
|
|
470
|
+
const { request: voice, id } = await resolveTtsVoice(engine, {
|
|
471
|
+
voice: picked, voiceId: requestedId ?? refIds.get(picked),
|
|
472
|
+
});
|
|
448
473
|
// The key is the SAME function `decklight narrate` hashes with, and
|
|
449
474
|
// that is the point: a sentence previewed here and then batch-recorded
|
|
450
475
|
// is one synthesis, not two identical bills (SPEC `NARRATION`).
|
|
451
476
|
const ext = extFor(engine.synth.mimeType ?? 'audio/wav');
|
|
452
|
-
const key = clipKey(engine, { voice, style, text });
|
|
477
|
+
const key = clipKey(engine, { voice: id ?? voice, style, text });
|
|
453
478
|
let fresh = !cache.has(key);
|
|
454
479
|
if (fresh) {
|
|
455
480
|
const bytes = disk.read(key, ext);
|
|
@@ -462,7 +487,9 @@ export async function ttsMain(args) {
|
|
|
462
487
|
if (fresh) {
|
|
463
488
|
process.stdout.write(` ${engine.name} ${picked}: ${text.length} chars … `);
|
|
464
489
|
const t0 = Date.now();
|
|
465
|
-
|
|
490
|
+
// a take whose length does not fit its text is sampled once more
|
|
491
|
+
// before it is cached, and played on every pass after (#1005)
|
|
492
|
+
cache.set(key, await checkedSynth(engine, text, { voice, style }));
|
|
466
493
|
disk.write(key, cache.get(key).wav, ext);
|
|
467
494
|
const u = cache.get(key).usage;
|
|
468
495
|
// `cost` is OPTIONAL, and an installed engine is why (SPEC
|
|
@@ -488,6 +515,8 @@ export async function ttsMain(args) {
|
|
|
488
515
|
? `~$${u.cost.toFixed(4)} (session ~$${totalCost.toFixed(4)})`
|
|
489
516
|
: `${totalChars} chars this session`;
|
|
490
517
|
console.log(`${((Date.now() - t0) / 1000).toFixed(1)}s · ${u.note ?? `${text.length} chars`} · ${spend}`);
|
|
518
|
+
const { take } = cache.get(key);
|
|
519
|
+
if (take) console.log(` retried: ${takeLine(text, take)}`);
|
|
491
520
|
}
|
|
492
521
|
const { wav, usage } = cache.get(key);
|
|
493
522
|
res.writeHead(200, {
|
|
@@ -502,6 +531,8 @@ export async function ttsMain(args) {
|
|
|
502
531
|
: '0',
|
|
503
532
|
'x-tts-tokens': usage.note ?? '',
|
|
504
533
|
'x-tts-cached': fresh ? '0' : '1',
|
|
534
|
+
// a retried take, said once, for the deck's debug log to name its slide
|
|
535
|
+
...(fresh && cache.get(key).take ? { 'x-tts-take': encodeURIComponent(takeLine(text, cache.get(key).take)) } : {}),
|
|
505
536
|
});
|
|
506
537
|
return res.end(wav);
|
|
507
538
|
} catch (e) {
|
package/tools/voiceover.mjs
CHANGED
|
@@ -23,13 +23,15 @@
|
|
|
23
23
|
// chirp — Chirp 3: HD on the Cloud Text-to-Speech API. Same 30 star-named
|
|
24
24
|
// voices as gemini, ~1s a sentence, and 1M characters a month free.
|
|
25
25
|
// No --style: Chirp has no delivery-instruction channel.
|
|
26
|
-
// gemini — gemini-2.5-{pro,flash}-tts on Vertex AI.
|
|
27
|
-
//
|
|
28
|
-
// engineer). No free tier, and pro is slow.
|
|
26
|
+
// gemini — gemini-2.5-{pro,flash}-tts on Vertex AI. Honors --style as a
|
|
27
|
+
// delivery instruction (default: warm, welcoming battle-hardened
|
|
28
|
+
// senior engineer). No free tier, and pro is slow.
|
|
29
29
|
// elevenlabs — your ElevenLabs account's own voices, cloned ones included.
|
|
30
30
|
// --voice takes the voice's NAME (or its id); omit it and the first
|
|
31
31
|
// of YOUR voices is used, which is the point of the engine. Needs
|
|
32
|
-
// $ELEVENLABS_API_KEY.
|
|
32
|
+
// $ELEVENLABS_API_KEY. On v3/v4, --style is a short audio-tag cue
|
|
33
|
+
// ("warmly"), cut at a word past 40 characters, and said so at the
|
|
34
|
+
// start; the default tone goes as its cue. --tts-format mp3 if your plan has
|
|
33
35
|
// no PCM output — but this tool wants WAV (--keep-wav feeds
|
|
34
36
|
// tools/lipsync.mjs), so pcm is the sane choice here.
|
|
35
37
|
// Cloud engines: --project or $GOOGLE_CLOUD_PROJECT, auth via
|
|
@@ -52,11 +54,14 @@
|
|
|
52
54
|
import { readFileSync, existsSync } from 'node:fs';
|
|
53
55
|
import { resolve, join, basename } from 'node:path';
|
|
54
56
|
import { homedir } from 'node:os';
|
|
55
|
-
import { createEngine } from './tts-engines.mjs';
|
|
57
|
+
import { createEngine, voiceLang } from './tts-engines.mjs';
|
|
56
58
|
import { createTtsCache } from './tts-cache.mjs';
|
|
59
|
+
import { cueFor, cutNote } from './tone-cue.mjs';
|
|
57
60
|
import { argReader } from './args.mjs';
|
|
58
|
-
import { sectionBodies } from './deck-html.mjs';
|
|
61
|
+
import { deckLang, sectionBodies } from './deck-html.mjs';
|
|
62
|
+
import { defaultTrackDir } from './deck-family.mjs';
|
|
59
63
|
import { parseSlideRange } from './video.mjs';
|
|
64
|
+
import { lipsyncAfterVoicing } from './lipsync-auto.mjs';
|
|
60
65
|
import { synthesizeSlides, readTrack, trackFormat, planLine, TRACK_FORMATS, DEFAULT_FORMAT } from './narration-synth.mjs';
|
|
61
66
|
|
|
62
67
|
const args = process.argv.slice(2);
|
|
@@ -68,7 +73,7 @@ Usage:
|
|
|
68
73
|
[--voice <name>] [--format m4a|wav|mp3] [--reuse-text] [--keep-wav]
|
|
69
74
|
[--slides a-b] [--no-cache]
|
|
70
75
|
|
|
71
|
-
The headless counterpart of the deck's V →
|
|
76
|
+
The headless counterpart of the deck's V → Save with the deck: it reads each slide's speaker
|
|
72
77
|
notes and writes one slide-NN file per slide (plus a file per [click] beat)
|
|
73
78
|
and a manifest.json into <dir>, so a deck can point at it with
|
|
74
79
|
narration: { files: '<dir>', segments: true } (m4a, the default)
|
|
@@ -81,12 +86,12 @@ A folder that already holds a track is REFRESHED as that track: its engine,
|
|
|
81
86
|
voice, style and format are the defaults, so voicing one stale slide of a track
|
|
82
87
|
the deck's recorder made writes wav in the same voice, beside the rest. A flag
|
|
83
88
|
overrides any of them; a --slides run in another voice is refused, since a
|
|
84
|
-
track has one voice.
|
|
89
|
+
track has one voice. A track with no saved voice requires --voice.
|
|
85
90
|
|
|
86
91
|
-o <dir> output folder (default: <deck>/voiceover)
|
|
87
92
|
--engine piper (local, free, default) · chirp · gemini · elevenlabs
|
|
88
93
|
--voice the engine's voice name (piper: a model name; elevenlabs: omit
|
|
89
|
-
for the first of YOUR voices)
|
|
94
|
+
for the first of YOUR voices on a fresh track)
|
|
90
95
|
--format m4a (default for a new track) · wav · mp3 (an existing track
|
|
91
96
|
keeps its own)
|
|
92
97
|
--reuse-text re-voice the existing slide-NN.txt (edit one to change what is
|
|
@@ -96,6 +101,9 @@ track has one voice.
|
|
|
96
101
|
--slides a-b voice only this range (1-based, inclusive; "7" for one slide)
|
|
97
102
|
— every other slide's files and manifest entry are left alone
|
|
98
103
|
--no-cache re-synthesize every slide, ignoring the shared clip cache
|
|
104
|
+
--no-face a deck with a 2D character (narration.character.mode: 'viseme')
|
|
105
|
+
has the lip-sync of what was voiced cut afterwards, with
|
|
106
|
+
Rhubarb, in parallel; this skips it
|
|
99
107
|
|
|
100
108
|
Synthesis is cached on disk (~/.cache/decklight/tts) under a key made of
|
|
101
109
|
(engine, model, format, voice, style, text) — the SAME key the live bridge
|
|
@@ -114,7 +122,7 @@ if (args.includes('--help') || args.includes('-h')) { console.log(HELP); process
|
|
|
114
122
|
// take `out` for the deck.
|
|
115
123
|
const VALUE_OPTIONS = new Set(['-o', '--engine', '--voice', '--style', '--data-dir', '--project',
|
|
116
124
|
'--location', '--lang', '--tts-model', '--tts-format', '--slides', '--format']);
|
|
117
|
-
const SWITCHES = new Set(['--reuse-text', '--keep-wav', '--no-cache']);
|
|
125
|
+
const SWITCHES = new Set(['--reuse-text', '--keep-wav', '--no-cache', '--no-face']);
|
|
118
126
|
let deckPath;
|
|
119
127
|
for (let i = 0; i < args.length; i++) {
|
|
120
128
|
const a = args[i];
|
|
@@ -137,7 +145,8 @@ try { range = parseSlideRange(opt('--slides'), sectionBodies(html).length); } ca
|
|
|
137
145
|
console.error(`decklight narrate: ${e.message}`);
|
|
138
146
|
process.exit(1);
|
|
139
147
|
}
|
|
140
|
-
|
|
148
|
+
// `voiceover`, or `voices-fr/voiceover` for the French of a deck: two languages never share a folder
|
|
149
|
+
const outDir = resolve(opt('-o', join(resolve(deckPath, '..'), defaultTrackDir(resolve(deckPath)))));
|
|
141
150
|
|
|
142
151
|
// The track already in the folder, if any, and what it was voiced with: the
|
|
143
152
|
// defaults for everything a flag does not say. Refreshing a track is voicing it
|
|
@@ -148,9 +157,10 @@ const engine = opt('--engine', prev?.engine ?? 'piper');
|
|
|
148
157
|
const track = prev?.engine === engine ? prev : null; // its header speaks for THIS engine only
|
|
149
158
|
// elevenlabs has no default name worth guessing: the roster is the account's,
|
|
150
159
|
// and undefined means "the first of yours", which is what you came for
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
const
|
|
160
|
+
const askedVoice = opt('--voice');
|
|
161
|
+
const voice = askedVoice ?? track?.voice ?? undefined;
|
|
162
|
+
const voiceId = askedVoice == null ? track?.voiceId : undefined;
|
|
163
|
+
let style = opt('--style', track?.style ??
|
|
154
164
|
'Read in a warm, welcoming tone, like a friendly battle-hardened senior ' +
|
|
155
165
|
'engineer who is still curious about new technology.');
|
|
156
166
|
// the model is identity only where the engine has more than one per voice
|
|
@@ -168,31 +178,49 @@ let tts;
|
|
|
168
178
|
try {
|
|
169
179
|
tts = createEngine({
|
|
170
180
|
engine, project, voice, dataDir, model,
|
|
171
|
-
location: opt('--location'),
|
|
181
|
+
location: opt('--location'), format: opt('--tts-format'),
|
|
182
|
+
// the deck's own language, unless --lang says otherwise (PRESENTING_VOICE)
|
|
183
|
+
lang: voiceLang({ flag: opt('--lang'), deck: deckLang(html) }),
|
|
172
184
|
});
|
|
173
185
|
} catch (e) {
|
|
174
186
|
console.error(e.message);
|
|
175
187
|
process.exit(1);
|
|
176
188
|
}
|
|
177
189
|
|
|
178
|
-
//
|
|
179
|
-
//
|
|
190
|
+
// A model that reads audio tags takes a tone as a short cue. A built-in
|
|
191
|
+
// tone's directive is named by its cue, so the clips are the ones the deck's
|
|
192
|
+
// live voice caches under it; a track keeps the style it was voiced with.
|
|
193
|
+
if (tts.audioTags) {
|
|
194
|
+
if (opt('--style') != null || track?.style == null) style = cueFor(style);
|
|
195
|
+
const cut = cutNote(style);
|
|
196
|
+
if (cut) console.log(`tone ${cut}`);
|
|
197
|
+
}
|
|
198
|
+
|
|
180
199
|
console.log(planLine(basename(deckPath), html, range, !!opt('--slides')));
|
|
181
200
|
const reuseTextFrom = args.includes('--reuse-text')
|
|
182
201
|
// falls back to the deck's default voiceover/ scripts so a second take
|
|
183
202
|
// (other engine/voice) narrates the SAME text, not a re-roll
|
|
184
|
-
? [outDir, join(resolve(deckPath, '..'),
|
|
203
|
+
? [outDir, join(resolve(deckPath, '..'), defaultTrackDir(resolve(deckPath)))]
|
|
185
204
|
: [];
|
|
186
205
|
try {
|
|
187
206
|
const cache = createTtsCache({ enabled: !args.includes('--no-cache') });
|
|
188
207
|
cache.prune();
|
|
189
|
-
const { skipped, cost } = await synthesizeSlides({
|
|
190
|
-
html, dir: outDir, tts, voice, style, format,
|
|
208
|
+
const { skipped, cost, retried } = await synthesizeSlides({
|
|
209
|
+
html, dir: outDir, tts, voice, voiceId, style, format,
|
|
191
210
|
range: opt('--slides') ? range : null, prev, cache, reuseTextFrom,
|
|
192
211
|
keepWav: args.includes('--keep-wav'),
|
|
193
212
|
});
|
|
194
213
|
console.log(`done → ${outDir}${skipped ? ` (${skipped} unchanged, skipped)` : ''}`
|
|
195
214
|
+ (cost ? ` · estimated cost ~$${cost.toFixed(4)}` : ''));
|
|
215
|
+
// the takes sampled twice because the first did not fit its text: the
|
|
216
|
+
// sentences worth a listen before this track is played to anyone
|
|
217
|
+
if (retried.length) {
|
|
218
|
+
console.log(`${retried.length} take${retried.length === 1 ? '' : 's'} retried, worth a listen:`);
|
|
219
|
+
for (const line of retried) console.log(` ${line}`);
|
|
220
|
+
}
|
|
221
|
+
// a deck with a 2D character mouths this audio: its lip-sync is cut now,
|
|
222
|
+
// from what was just written, rather than left for --face (#1244)
|
|
223
|
+
if (!args.includes('--no-face')) await lipsyncAfterVoicing({ html, dir: outDir });
|
|
196
224
|
} catch (e) {
|
|
197
225
|
console.error(`decklight narrate: ${e.message}`);
|
|
198
226
|
process.exitCode = 1;
|
package/dist/build-info.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"tag":"0.9.0","commits":0,"commit":"a3046d2","dirty":false}
|