@beff/aula-cli 0.1.1 → 0.3.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 -1
- package/dist/src/{chunk-QWNBVWUQ.js → chunk-5MXHQCWH.js} +26 -9
- package/dist/src/{chunk-IAQZ6DTC.js → chunk-7IQUN2SB.js} +45 -6
- package/dist/src/{chunk-XUBCUJW5.js → chunk-H54BN5R7.js} +6 -9
- package/dist/src/{chunk-YX73KJQ6.js → chunk-HDAMZF5B.js} +20 -23
- package/dist/src/cli.js +8 -8
- package/dist/src/{commands-M246OWYJ.js → commands-DUMGD7TE.js} +4 -4
- package/dist/src/{problems-Y67BY7WB.js → problems-DYLEPGE6.js} +3 -3
- package/dist/src/{run-CTVGU7EK.js → run-72KOJGZE.js} +14 -9
- package/dist/src/{server-5OGXX6BF.js → server-BWWN7KZA.js} +4 -3
- package/dist/web/app/assets/__vite-browser-external-BTSih4Wj.js +1 -0
- package/dist/web/app/assets/{aula-voice-worker-DymX5vwM.js → aula-voice-worker-DfzMG86o.js} +10 -10
- package/dist/web/app/assets/{aula.core5-YhDIb7Me.wasm → aula.core5-CdA2Cc_n.wasm} +0 -0
- package/dist/web/app/assets/d1a3d405/aula-method.js +1 -0
- package/dist/web/app/assets/d1a3d405/aula.js +1 -0
- package/dist/web/app/assets/{build-worker.js → d1a3d405/build-worker.js} +2 -2
- package/dist/web/app/assets/{index-B8_aMtuI.js → d1a3d405/index.js} +3 -3
- package/dist/web/app/assets/{protocol-CnlzsyRt.js → protocol-B85V84gE.js} +10 -10
- package/dist/web/app/assets/{src-CmWmmzpF.js → src-BV6xlpP7.js} +6 -6
- package/dist/web/app/index.html +3 -3
- package/package.json +2 -2
- package/dist/web/app/assets/__vite-browser-external-BN30sEqc.js +0 -1
- package/dist/web/app/assets/aula-method.js +0 -1
- package/dist/web/app/assets/aula.js +0 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ The `aula` command of [aula](https://github.com/lucasavila00/aula): it runs chap
|
|
|
4
4
|
|
|
5
5
|
It needs Node 24. Narration (aula-voice) needs only Node. `aula export` needs ffmpeg. Refer to [CLI](https://github.com/lucasavila00/aula/blob/main/docs/agents/cli.md) for the commands and [Getting started](https://github.com/lucasavila00/aula/blob/main/docs/agents/getting-started.md) for the setup.
|
|
6
6
|
|
|
7
|
-
The package has no model file. The first command that narrates or times a video (`preview`, `timeline`, `export`, `aula web`) downloads the narrator's model into `~/.cache/aula/models/aula-voice/`: the raw model of aula-voice's release [v0.1.
|
|
7
|
+
The package has no model file. The first command that narrates or times a video (`preview`, `timeline`, `export`, `aula web`) downloads the narrator's model into `~/.cache/aula/models/aula-voice/`: the raw model of aula-voice's release [v0.1.2](https://github.com/lucasavila00/aula-voice/releases/tag/v0.1.2) (`model.safetensors` and `config.json`, approximately 34 MB). The CLI checks the SHA-256 of each file, makes the engine's weight file (`aula-voice.avw`) from them, and checks its SHA-256 too. `aula web` narrates in the browser: it serves that file to its page from the same folder. The [model card](https://github.com/lucasavila00/aula-voice/releases/download/v0.1.2/MODEL_CARD.md) has the license of the model, its sources and its training data, and their attribution.
|
|
8
8
|
|
|
9
9
|
## Licenses
|
|
10
10
|
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
exportCheck,
|
|
12
12
|
movesMarkdown,
|
|
13
13
|
narrationAt,
|
|
14
|
+
noteLine,
|
|
15
|
+
notesLine,
|
|
14
16
|
pictureGroups,
|
|
15
17
|
pictureStills,
|
|
16
18
|
previewJobs,
|
|
@@ -18,13 +20,14 @@ import {
|
|
|
18
20
|
printDiagnostics,
|
|
19
21
|
scriptView,
|
|
20
22
|
targetChapters,
|
|
21
|
-
timelineView
|
|
22
|
-
|
|
23
|
+
timelineView,
|
|
24
|
+
wordNotes
|
|
25
|
+
} from "./chunk-7IQUN2SB.js";
|
|
23
26
|
import {
|
|
24
27
|
narrateScript,
|
|
25
28
|
scriptAudio,
|
|
26
29
|
wav
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-H54BN5R7.js";
|
|
28
31
|
import {
|
|
29
32
|
host
|
|
30
33
|
} from "./chunk-46KT47TH.js";
|
|
@@ -813,7 +816,7 @@ function zipBytes(entries) {
|
|
|
813
816
|
// src/narrate.ts
|
|
814
817
|
function narrate(capabilities, chapters) {
|
|
815
818
|
return narrateScript(
|
|
816
|
-
(
|
|
819
|
+
(words, speed) => capabilities.narrator.speak(words, speed),
|
|
817
820
|
chapters,
|
|
818
821
|
(spoken, count, cue) => {
|
|
819
822
|
capabilities.log.out(`[${String(spoken)}/${String(count)}] Narrating: ${cue.text.slice(0, 70)}`);
|
|
@@ -927,14 +930,28 @@ async function drawChapter(capabilities, root, project, index, narration, lottie
|
|
|
927
930
|
var rowLine = (project, r) => `${nameOf(project)}: ${String(r.errors)} errors, ${String(r.warnings)} warnings, ${String(r.open)} open moves`;
|
|
928
931
|
async function printChecked(capabilities, root, project, checked) {
|
|
929
932
|
await printDiagnostics(capabilities, root, checked.findings);
|
|
933
|
+
printCounts(capabilities, project, checked);
|
|
934
|
+
}
|
|
935
|
+
function printCounts(capabilities, project, checked) {
|
|
930
936
|
const { errors, warnings } = checked.others;
|
|
931
937
|
if (errors + warnings > 0)
|
|
932
938
|
capabilities.log.out(`other chapters: ${String(errors)} errors, ${String(warnings)} warnings`);
|
|
933
939
|
capabilities.log.out(rowLine(project, checked));
|
|
934
940
|
}
|
|
935
|
-
async function check(capabilities, root, project, only) {
|
|
936
|
-
const
|
|
937
|
-
|
|
941
|
+
async function check(capabilities, root, project, only, json = false) {
|
|
942
|
+
const chapters = chapterIndexes(project, only);
|
|
943
|
+
const checked = checkProject(project, host(capabilities, root), chapters);
|
|
944
|
+
const notes = wordNotes(narrationScript(project, checked.texts), chapters);
|
|
945
|
+
if (json) {
|
|
946
|
+
const { findings, others, errors, warnings, open } = checked;
|
|
947
|
+
const result = { name: nameOf(project), errors, warnings, openMoves: open, others, findings, notes };
|
|
948
|
+
capabilities.log.out(JSON.stringify(result, null, 2));
|
|
949
|
+
return errors === 0;
|
|
950
|
+
}
|
|
951
|
+
await printDiagnostics(capabilities, root, checked.findings);
|
|
952
|
+
for (const note of notes) capabilities.log.out(noteLine(note));
|
|
953
|
+
if (notes.length > 0) capabilities.log.out(notesLine(notes));
|
|
954
|
+
printCounts(capabilities, project, checked);
|
|
938
955
|
return checked.errors === 0;
|
|
939
956
|
}
|
|
940
957
|
async function script(capabilities, root, project) {
|
|
@@ -951,7 +968,7 @@ async function preview(capabilities, root, project, folder, given) {
|
|
|
951
968
|
await printChecked(capabilities, root, project, checked);
|
|
952
969
|
if (checked.errors > 0) return false;
|
|
953
970
|
const all = checked.texts;
|
|
954
|
-
const n = await clock(capabilities.narrator, narrationScript(project
|
|
971
|
+
const n = await clock(capabilities.narrator, narrationScript(project, all));
|
|
955
972
|
const jobs = previewJobs(targets, all).map((job) => ({
|
|
956
973
|
...job,
|
|
957
974
|
out: path2.join(folder, job.base),
|
|
@@ -1000,7 +1017,7 @@ async function exportVideo(capabilities, root, project, file) {
|
|
|
1000
1017
|
await ffmpeg(capabilities, ["-version"]);
|
|
1001
1018
|
return withWork(capabilities, async (work) => {
|
|
1002
1019
|
const audio = path2.join(work, "narration.wav");
|
|
1003
|
-
const cues = narrationScript(project
|
|
1020
|
+
const cues = narrationScript(project, checked.texts);
|
|
1004
1021
|
const narrated = await withHeavy(capabilities, () => narrate(capabilities, cues));
|
|
1005
1022
|
const lotties = names.map((name) => path2.join(work, `${name}.json`));
|
|
1006
1023
|
const drawn = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
timeChapter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-H54BN5R7.js";
|
|
4
4
|
import {
|
|
5
5
|
Problems,
|
|
6
6
|
error,
|
|
@@ -61,14 +61,14 @@ function openCount(chapters, indexes) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// ../aula-project/src/check.ts
|
|
64
|
-
import { checkChapter, readChapter as readChapter2 } from "@beff/aula";
|
|
64
|
+
import { checkChapter, checkLexicon, checkTitle, readChapter as readChapter2 } from "@beff/aula";
|
|
65
65
|
import { chapterNames } from "@beff/aula/run";
|
|
66
66
|
import { check as rules } from "@beff/aula/text";
|
|
67
67
|
async function clock(narrator, chapters) {
|
|
68
68
|
const narrations = [];
|
|
69
69
|
for (const cues of chapters) {
|
|
70
70
|
const timings = [];
|
|
71
|
-
for (const cue of cues) timings.push(await narrator.time(cue.
|
|
71
|
+
for (const cue of cues) timings.push(await narrator.time(cue.words, cue.speed));
|
|
72
72
|
narrations.push(timeChapter(cues, timings));
|
|
73
73
|
}
|
|
74
74
|
return narrations;
|
|
@@ -78,7 +78,7 @@ function narrationAt(narrations, index) {
|
|
|
78
78
|
if (narration === void 0) throw new Error(`no narration of chapter ${String(index)}`);
|
|
79
79
|
return narration;
|
|
80
80
|
}
|
|
81
|
-
var EMPTY = { heading: "", metaphor: "", paragraphs: [] };
|
|
81
|
+
var EMPTY = { heading: "", headingSpoken: "", metaphor: "", paragraphs: [] };
|
|
82
82
|
function checkProject(project, host, only) {
|
|
83
83
|
const reads = project.chapters.map((_, i) => readChapter2(project, i + 1, { host }));
|
|
84
84
|
const unloaded = /* @__PURE__ */ new Map();
|
|
@@ -100,7 +100,11 @@ function checkProject(project, host, only) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
const byChapter = [...unloaded, ...[...own].toSorted(([a], [b]) => a - b)];
|
|
103
|
-
const reported =
|
|
103
|
+
const reported = [
|
|
104
|
+
...checkLexicon(project, { host }),
|
|
105
|
+
...checkTitle(project, { host }),
|
|
106
|
+
...byChapter.flatMap(([index, d]) => inScope(index) ? d : [])
|
|
107
|
+
];
|
|
104
108
|
const elsewhere = byChapter.flatMap(([index, d]) => inScope(index) ? [] : d);
|
|
105
109
|
const errors = reported.filter(isError).length;
|
|
106
110
|
const otherErrors = elsewhere.filter(isError).length;
|
|
@@ -142,6 +146,38 @@ function clipPlan(narrations, fps) {
|
|
|
142
146
|
return { clips, seconds: starts.at(-1) ?? 0 };
|
|
143
147
|
}
|
|
144
148
|
|
|
149
|
+
// ../aula-project/src/notes.ts
|
|
150
|
+
import { unclearWords } from "@beff/aula/text";
|
|
151
|
+
function wordNotes(script, only) {
|
|
152
|
+
const notes = /* @__PURE__ */ new Map();
|
|
153
|
+
script.forEach((cues, index) => {
|
|
154
|
+
if (only !== null && !only.includes(index)) return;
|
|
155
|
+
for (const cue of cues) {
|
|
156
|
+
for (const { word, kind, reading } of unclearWords(cue.words)) {
|
|
157
|
+
const lower = word.slice(0, 1).toLowerCase() + word.slice(1);
|
|
158
|
+
const key = `${kind} ${lower}`;
|
|
159
|
+
const note = notes.get(key);
|
|
160
|
+
if (note === void 0) notes.set(key, { word, kind, reading, uses: 1, place: cue.place ?? null });
|
|
161
|
+
else {
|
|
162
|
+
note.uses += 1;
|
|
163
|
+
if (word === lower) note.word = word;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return [...notes.values()];
|
|
169
|
+
}
|
|
170
|
+
function noteLine(note) {
|
|
171
|
+
const why = note.kind === "ambiguous" ? `the context decides its reading, and the lexicon says "${note.reading}"` : `no dictionary has it, and eSpeak NG says /${note.reading}/`;
|
|
172
|
+
const place = note.place ?? "the title";
|
|
173
|
+
const uses = note.uses === 1 ? `1 use, at ${place}` : `${String(note.uses)} uses, the first at ${place}`;
|
|
174
|
+
return `note: ${JSON.stringify(note.word)}: ${why} (${uses})`;
|
|
175
|
+
}
|
|
176
|
+
function notesLine(notes) {
|
|
177
|
+
const count = notes.length === 1 ? "1 note" : `${String(notes.length)} notes`;
|
|
178
|
+
return `${count}: a note is not an error. Give each word its reading with pronounce or in the project lexicon`;
|
|
179
|
+
}
|
|
180
|
+
|
|
145
181
|
// ../aula-project/src/preview.ts
|
|
146
182
|
import { chapterNames as chapterNames2, FPS } from "@beff/aula/run";
|
|
147
183
|
|
|
@@ -223,7 +259,7 @@ async function timelineView(project, host, narrator, only) {
|
|
|
223
259
|
const names = chapterNames3(project);
|
|
224
260
|
const indexes = only.length === 0 ? project.chapters.map((_, i) => i + 1) : only.map((name) => chapterIndex(names, name));
|
|
225
261
|
if (indexes.includes(0)) throw wrongArgument("the title card has no timeline: give a chapter name");
|
|
226
|
-
const n = await clock(narrator, narrationScript(project
|
|
262
|
+
const n = await clock(narrator, narrationScript(project, texts(project, host)));
|
|
227
263
|
let out = header(project);
|
|
228
264
|
for (const index of indexes) {
|
|
229
265
|
const text = chapterText(project, host, index);
|
|
@@ -260,6 +296,9 @@ export {
|
|
|
260
296
|
chapterIndexes,
|
|
261
297
|
exportCheck,
|
|
262
298
|
clipPlan,
|
|
299
|
+
wordNotes,
|
|
300
|
+
noteLine,
|
|
301
|
+
notesLine,
|
|
263
302
|
previewTargets,
|
|
264
303
|
targetChapters,
|
|
265
304
|
previewJobs,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// ../aula-narration/src/script.ts
|
|
2
2
|
import { chapterNarration } from "@beff/aula/text";
|
|
3
|
+
var starts = (words) => Float64Array.from(words, (w) => w.start);
|
|
3
4
|
function joinChapter(cues, speeches) {
|
|
4
5
|
let rate = 0;
|
|
5
6
|
for (const [i, speech] of speeches.entries()) {
|
|
@@ -10,10 +11,7 @@ function joinChapter(cues, speeches) {
|
|
|
10
11
|
if (rate !== 0 && speech.sampleRate !== rate) throw new Error("the narrator changed its sample rate");
|
|
11
12
|
rate = speech.sampleRate;
|
|
12
13
|
}
|
|
13
|
-
const spoken = speeches.map((s) => ({
|
|
14
|
-
samples: s.samples.length,
|
|
15
|
-
words: s.words.map((w) => ({ text: w.text, char: w.char, start: w.start }))
|
|
16
|
-
}));
|
|
14
|
+
const spoken = speeches.map((s) => ({ samples: s.samples.length, starts: starts(s.words) }));
|
|
17
15
|
const narration = chapterNarration(cues, spoken, rate);
|
|
18
16
|
const samples = new Float32Array(narration.endFrame);
|
|
19
17
|
for (const [i, speech] of speeches.entries()) samples.set(speech.samples, narration.cues[i]?.speechStartFrame ?? 0);
|
|
@@ -36,10 +34,9 @@ function withWaits(samples, waits) {
|
|
|
36
34
|
function timeChapter(cues, timings) {
|
|
37
35
|
const rate = timings[0]?.sampleRate ?? 0;
|
|
38
36
|
if (timings.some((t) => t.sampleRate !== rate)) throw new Error("the narrator changed its sample rate");
|
|
39
|
-
const spoken = timings.map(
|
|
40
|
-
samples: t.samples,
|
|
41
|
-
|
|
42
|
-
}));
|
|
37
|
+
const spoken = timings.map(
|
|
38
|
+
(t) => t.words ? { samples: t.samples, starts: starts(t.words) } : { samples: t.samples }
|
|
39
|
+
);
|
|
43
40
|
return chapterNarration(cues, spoken, rate);
|
|
44
41
|
}
|
|
45
42
|
async function narrateScript(speak, chapters, speaking) {
|
|
@@ -51,7 +48,7 @@ async function narrateScript(speak, chapters, speaking) {
|
|
|
51
48
|
for (const cue of cues) {
|
|
52
49
|
spoken += 1;
|
|
53
50
|
speaking(spoken, count, cue);
|
|
54
|
-
speeches.push(await speak(cue.
|
|
51
|
+
speeches.push(await speak(cue.words, cue.speed));
|
|
55
52
|
}
|
|
56
53
|
narrated.push(joinChapter(cues, speeches));
|
|
57
54
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
// ../aula-narration/src/align.ts
|
|
2
|
-
function tokens(text) {
|
|
3
|
-
return [...text.matchAll(/\S+/g)].map((match) => ({ text: match[0], char: match.index }));
|
|
4
|
-
}
|
|
5
2
|
function roundHalfEven(value) {
|
|
6
3
|
const floor = Math.floor(value);
|
|
7
4
|
const rest = value - floor;
|
|
@@ -10,8 +7,7 @@ function roundHalfEven(value) {
|
|
|
10
7
|
return floor % 2 === 0 ? floor : floor + 1;
|
|
11
8
|
}
|
|
12
9
|
var ms = (seconds) => roundHalfEven(seconds * 1e3) / 1e3;
|
|
13
|
-
function alignWords(
|
|
14
|
-
const source = tokens(text);
|
|
10
|
+
function alignWords(source, spoken, read) {
|
|
15
11
|
if (read.length !== source.length) {
|
|
16
12
|
throw new Error(`${String(source.length)} words but ${String(read.length)} readings`);
|
|
17
13
|
}
|
|
@@ -60,11 +56,11 @@ function alignWords(text, spoken, read) {
|
|
|
60
56
|
ends[w] = phone.end;
|
|
61
57
|
});
|
|
62
58
|
let last = 0;
|
|
63
|
-
return source.map((
|
|
59
|
+
return source.map((text, w) => {
|
|
64
60
|
const start = starts[w] ?? Number.NaN;
|
|
65
61
|
const end = ends[w] ?? Number.NaN;
|
|
66
62
|
const found = !Number.isNaN(start) && start >= last;
|
|
67
|
-
const time = { text
|
|
63
|
+
const time = { text, start: ms(found ? start : last), end: ms(found ? end : last) };
|
|
68
64
|
if (found) last = end;
|
|
69
65
|
return time;
|
|
70
66
|
});
|
|
@@ -154,12 +150,12 @@ async function tokenBatches(vocab, phonemize2, text) {
|
|
|
154
150
|
}
|
|
155
151
|
var STRESS = "\u02C8\u02CC";
|
|
156
152
|
var isSound = (phoneme) => new RegExp("\\p{L}", "u").test(phoneme) && !STRESS.includes(phoneme);
|
|
157
|
-
async function timesOfWords(phonemize2,
|
|
153
|
+
async function timesOfWords(phonemize2, words, timings) {
|
|
158
154
|
const spoken = timings.filter((timing) => isSound(timing.phoneme));
|
|
159
155
|
if (!spoken.length) throw new Error("the model gave no phoneme timings");
|
|
160
156
|
const read = [];
|
|
161
|
-
for (const word of
|
|
162
|
-
return alignWords(
|
|
157
|
+
for (const word of words) read.push(Array.from(await phonemize2(word)).filter(isSound));
|
|
158
|
+
return alignWords(words, spoken, read);
|
|
163
159
|
}
|
|
164
160
|
|
|
165
161
|
// ../aula-narration/src/vocab.ts
|
|
@@ -282,24 +278,24 @@ var KOKORO_VOCAB = /* @__PURE__ */ new Map([
|
|
|
282
278
|
]);
|
|
283
279
|
|
|
284
280
|
// ../aula-narration/src/aula-voice.ts
|
|
285
|
-
var AULA_VOICE_RELEASE = "v0.1.
|
|
281
|
+
var AULA_VOICE_RELEASE = "v0.1.2";
|
|
286
282
|
var RELEASE_URL = `https://github.com/lucasavila00/aula-voice/releases/download/${AULA_VOICE_RELEASE}`;
|
|
287
283
|
var AULA_VOICE_FILES = {
|
|
288
284
|
model: {
|
|
289
285
|
path: "model.safetensors",
|
|
290
286
|
bytes: 33489768,
|
|
291
|
-
sha256: "
|
|
287
|
+
sha256: "862806a3dfb10196f1bdfedf08ae43ed9b640b969398ac9d37f8670586c57c6a"
|
|
292
288
|
},
|
|
293
289
|
config: {
|
|
294
290
|
path: "config.json",
|
|
295
291
|
bytes: 2346,
|
|
296
|
-
sha256: "
|
|
292
|
+
sha256: "f297213a0673974916d9c309260f01a8259d36b0d595d66ed57668cc6eea4da3"
|
|
297
293
|
}
|
|
298
294
|
};
|
|
299
295
|
var AULA_VOICE_WEIGHTS = {
|
|
300
296
|
path: "aula-voice.avw",
|
|
301
297
|
bytes: 33478208,
|
|
302
|
-
sha256: "
|
|
298
|
+
sha256: "519b3e3cff634d6dd8edec9fe322da64cdf184f866bb0c101dc364d9874c8440"
|
|
303
299
|
};
|
|
304
300
|
var SERVER_WEIGHTS_PATH = `/models/${AULA_VOICE_WEIGHTS.path}`;
|
|
305
301
|
var aulaVoiceUrl = (file) => `${RELEASE_URL}/${file.path}`;
|
|
@@ -316,7 +312,8 @@ function limited(audio) {
|
|
|
316
312
|
const scale = PEAK / loudest;
|
|
317
313
|
return audio.map((sample) => sample * scale);
|
|
318
314
|
}
|
|
319
|
-
async function layout(parts,
|
|
315
|
+
async function layout(parts, words, speed, audio) {
|
|
316
|
+
const text = words.join(" ");
|
|
320
317
|
const batches = await batchesOf(parts.phonemize, text, MAX_TOKENS);
|
|
321
318
|
if (!batches.length) throw new Error(`Nothing to say: ${JSON.stringify(text)} has no phonemes`);
|
|
322
319
|
const pieces = [];
|
|
@@ -340,10 +337,10 @@ async function layout(parts, text, speed, audio) {
|
|
|
340
337
|
pieces.push({ audio: spoken.audio?.subarray(head, tail) ?? null, length: tail - head, pause });
|
|
341
338
|
offset += tail - head + pause;
|
|
342
339
|
}
|
|
343
|
-
return { pieces, total: offset, words: await timesOfWords(parts.phonemize,
|
|
340
|
+
return { pieces, total: offset, words: await timesOfWords(parts.phonemize, words, timings) };
|
|
344
341
|
}
|
|
345
|
-
async function speakAulaVoice(parts,
|
|
346
|
-
const { pieces, total, words } = await layout(parts,
|
|
342
|
+
async function speakAulaVoice(parts, given, speed) {
|
|
343
|
+
const { pieces, total, words } = await layout(parts, given, speed, true);
|
|
347
344
|
const samples = new Float32Array(total);
|
|
348
345
|
let offset = 0;
|
|
349
346
|
for (const piece of pieces) {
|
|
@@ -352,8 +349,8 @@ async function speakAulaVoice(parts, text, speed) {
|
|
|
352
349
|
}
|
|
353
350
|
return { samples: limited(samples), sampleRate: SAMPLE_RATE, words };
|
|
354
351
|
}
|
|
355
|
-
async function timeAulaVoice(parts,
|
|
356
|
-
const { total, words } = await layout(parts,
|
|
352
|
+
async function timeAulaVoice(parts, given, speed) {
|
|
353
|
+
const { total, words } = await layout(parts, given, speed, false);
|
|
357
354
|
return { samples: total, sampleRate: SAMPLE_RATE, words };
|
|
358
355
|
}
|
|
359
356
|
|
|
@@ -509,10 +506,10 @@ function studentWeightFile(model, config) {
|
|
|
509
506
|
}
|
|
510
507
|
}
|
|
511
508
|
const tensors = readSafetensors(model);
|
|
512
|
-
const
|
|
509
|
+
const tokens = tensors.get("tokens.weight");
|
|
513
510
|
const voices = tensors.get("voices.weight");
|
|
514
|
-
if (!
|
|
515
|
-
const [vocab = 0, channels = 0] =
|
|
511
|
+
if (!tokens || !voices) throw new Error("model.safetensors has no tokens.weight or voices.weight");
|
|
512
|
+
const [vocab = 0, channels = 0] = tokens.shape;
|
|
516
513
|
const headBlocks = new Set(
|
|
517
514
|
[...tensors.keys()].filter((n) => n.startsWith("head.blocks.")).map((n) => n.split(".")[2])
|
|
518
515
|
).size;
|
package/dist/src/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
studentWeightFile,
|
|
15
15
|
timeAulaVoice,
|
|
16
16
|
tokenBatches
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HDAMZF5B.js";
|
|
18
18
|
|
|
19
19
|
// src/cli.ts
|
|
20
20
|
import { spawn } from "node:child_process";
|
|
@@ -227,8 +227,8 @@ function aulaVoice(capabilities2, options2) {
|
|
|
227
227
|
return { model: await aulaVoiceModel(await aulaVoiceWeightFile(capabilities2, options2)), phonemize };
|
|
228
228
|
})();
|
|
229
229
|
return {
|
|
230
|
-
speak: async (
|
|
231
|
-
time: async (
|
|
230
|
+
speak: async (words, speed) => speakAulaVoice(await parts(), words, speed),
|
|
231
|
+
time: async (words, speed) => timeAulaVoice(await parts(), words, speed)
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
234
|
|
|
@@ -271,9 +271,9 @@ var base = Capabilities.create({
|
|
|
271
271
|
},
|
|
272
272
|
spawn
|
|
273
273
|
});
|
|
274
|
-
var { diagnosticsOf, printDiagnostics } = await import("./problems-
|
|
274
|
+
var { diagnosticsOf, printDiagnostics } = await import("./problems-DYLEPGE6.js");
|
|
275
275
|
var { host, loadProject } = await import("./project-NWT5MDQI.js");
|
|
276
|
-
var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, webOptions } = await import("./run-
|
|
276
|
+
var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, webOptions } = await import("./run-72KOJGZE.js");
|
|
277
277
|
var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
|
|
278
278
|
var render = createRender(base, process.execPath);
|
|
279
279
|
var models = path3.join(os.homedir(), ".cache/aula/models");
|
|
@@ -296,7 +296,7 @@ async function main(argv) {
|
|
|
296
296
|
}
|
|
297
297
|
const args = parse(rest, optionsOf(command));
|
|
298
298
|
if (command === "web") {
|
|
299
|
-
const { serve } = await import("./server-
|
|
299
|
+
const { serve } = await import("./server-BWWN7KZA.js");
|
|
300
300
|
const stop = new AbortController();
|
|
301
301
|
for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
|
|
302
302
|
const web = Capabilities.create({
|
|
@@ -312,14 +312,14 @@ async function main(argv) {
|
|
|
312
312
|
return 0;
|
|
313
313
|
}
|
|
314
314
|
if (command === "tokens") {
|
|
315
|
-
const { tokens, tokensArgs } = await import("./commands-
|
|
315
|
+
const { tokens, tokensArgs } = await import("./commands-DUMGD7TE.js");
|
|
316
316
|
tokensArgs(args.positional);
|
|
317
317
|
const tokensOf = createTokens();
|
|
318
318
|
return await tokens(capabilities, tokensOf, createInterface({ input: process.stdin, crlfDelay: Infinity })) ? 0 : 1;
|
|
319
319
|
}
|
|
320
320
|
const { folder, rest: after } = folderArgs(cwd, command, args);
|
|
321
321
|
const project = await loadProject(capabilities, cwd, folder);
|
|
322
|
-
return await run2(capabilities, cwd, command, project, after) ? 0 : 1;
|
|
322
|
+
return await run2(capabilities, cwd, command, project, after, args.flags) ? 0 : 1;
|
|
323
323
|
}
|
|
324
324
|
try {
|
|
325
325
|
process.exitCode = await main(process.argv.slice(2));
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
timeline,
|
|
8
8
|
tokens,
|
|
9
9
|
tokensArgs
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5MXHQCWH.js";
|
|
11
11
|
import "./chunk-GFCJYE75.js";
|
|
12
12
|
import "./chunk-2XGNOG2U.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-7IQUN2SB.js";
|
|
14
|
+
import "./chunk-H54BN5R7.js";
|
|
15
|
+
import "./chunk-HDAMZF5B.js";
|
|
16
16
|
import "./chunk-46KT47TH.js";
|
|
17
17
|
import "./chunk-7KT36JRP.js";
|
|
18
18
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
printDiagnostics
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-7IQUN2SB.js";
|
|
4
|
+
import "./chunk-H54BN5R7.js";
|
|
5
|
+
import "./chunk-HDAMZF5B.js";
|
|
6
6
|
import {
|
|
7
7
|
diagnosticsOf
|
|
8
8
|
} from "./chunk-7KT36JRP.js";
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
preview,
|
|
6
6
|
script,
|
|
7
7
|
timeline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5MXHQCWH.js";
|
|
9
9
|
import "./chunk-GFCJYE75.js";
|
|
10
10
|
import "./chunk-2XGNOG2U.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-7IQUN2SB.js";
|
|
12
|
+
import "./chunk-H54BN5R7.js";
|
|
13
|
+
import "./chunk-HDAMZF5B.js";
|
|
14
14
|
import "./chunk-46KT47TH.js";
|
|
15
15
|
import {
|
|
16
16
|
wrongArgument
|
|
@@ -26,8 +26,10 @@ defineProject({ title, theme, chapters }). <chapter> is a chapter name such as
|
|
|
26
26
|
title card). Each chapter module holds its script, storyboard notes and
|
|
27
27
|
animations; messages name its lines (file:line:col).
|
|
28
28
|
|
|
29
|
-
aula check <folder> [<chapter> ...]
|
|
30
|
-
every check, with no narration and no frames
|
|
29
|
+
aula check <folder> [<chapter> ...] [--json]
|
|
30
|
+
every check, with no narration and no frames, and
|
|
31
|
+
a note for each word whose reading is not clear;
|
|
32
|
+
--json prints the result as one JSON object
|
|
31
33
|
aula preview <folder> <out> [<chapter>[:<line>] ...]
|
|
32
34
|
PNG pictures for review: per chapter, stills,
|
|
33
35
|
motion stills, contact sheets and moves.md
|
|
@@ -53,7 +55,7 @@ var VALUED = {
|
|
|
53
55
|
"--port": "a port number"
|
|
54
56
|
};
|
|
55
57
|
function parse(argv, allowed) {
|
|
56
|
-
const args = { positional: [], values: /* @__PURE__ */ new Map() };
|
|
58
|
+
const args = { positional: [], values: /* @__PURE__ */ new Map(), flags: /* @__PURE__ */ new Set() };
|
|
57
59
|
for (let i = 0; i < argv.length; i++) {
|
|
58
60
|
const arg = argv[i] ?? "";
|
|
59
61
|
const what = VALUED[arg];
|
|
@@ -63,6 +65,8 @@ function parse(argv, allowed) {
|
|
|
63
65
|
if (value === void 0) throw wrongArgument(`${arg} needs ${what}`);
|
|
64
66
|
if (!/^[0-9]+$/.test(value)) throw wrongArgument(`${arg} ${value} is not a number`);
|
|
65
67
|
args.values.set(arg, Number(value));
|
|
68
|
+
} else if (allowed.includes(arg)) {
|
|
69
|
+
args.flags.add(arg);
|
|
66
70
|
} else if (arg.startsWith("--")) {
|
|
67
71
|
throw wrongArgument(`unknown option ${arg}`, "run `aula help` for the options of each command");
|
|
68
72
|
} else {
|
|
@@ -72,6 +76,7 @@ function parse(argv, allowed) {
|
|
|
72
76
|
return args;
|
|
73
77
|
}
|
|
74
78
|
var OPTIONS = {
|
|
79
|
+
check: ["--json"],
|
|
75
80
|
web: ["--port"]
|
|
76
81
|
};
|
|
77
82
|
var isHelp = (command) => command === void 0 || command === "help" || command === "-h" || command === "--help";
|
|
@@ -92,11 +97,11 @@ function folderArgs(cwd, command, args) {
|
|
|
92
97
|
throw wrongArgument("wrong number of arguments", "run `aula help` for the usage");
|
|
93
98
|
return { folder: path.resolve(cwd, folder), rest };
|
|
94
99
|
}
|
|
95
|
-
async function run(capabilities, cwd, command, project, rest) {
|
|
100
|
+
async function run(capabilities, cwd, command, project, rest, flags = /* @__PURE__ */ new Set()) {
|
|
96
101
|
const [first = "", ...more] = rest;
|
|
97
102
|
switch (command) {
|
|
98
103
|
case "check":
|
|
99
|
-
return check(capabilities, cwd, project, rest);
|
|
104
|
+
return check(capabilities, cwd, project, rest, flags.has("--json"));
|
|
100
105
|
case "preview":
|
|
101
106
|
return preview(capabilities, cwd, project, path.resolve(cwd, first), more);
|
|
102
107
|
case "export":
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-H54BN5R7.js";
|
|
2
2
|
import {
|
|
3
3
|
SERVER_WEIGHTS_PATH
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HDAMZF5B.js";
|
|
5
5
|
import {
|
|
6
6
|
exists
|
|
7
7
|
} from "./chunk-46KT47TH.js";
|
|
@@ -40,8 +40,9 @@ async function asset(capabilities, path) {
|
|
|
40
40
|
}
|
|
41
41
|
if (!path.startsWith("/assets/")) return null;
|
|
42
42
|
const name = path.slice("/assets/".length);
|
|
43
|
+
const parts = name.split("/");
|
|
43
44
|
const kind = KINDS.get(name.slice(name.lastIndexOf(".")));
|
|
44
|
-
if (!plain
|
|
45
|
+
if (parts.length > 2 || !parts.every(plain) || kind === void 0) return null;
|
|
45
46
|
const body = await read(`assets/${name}`);
|
|
46
47
|
return body ? { body, kind } : null;
|
|
47
48
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./aula-voice-worker-DfzMG86o.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();
|