@beff/aula-cli 0.2.0 → 0.3.1
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-SW5BNPAM.js → chunk-4C4BQTKI.js} +20 -24
- package/dist/src/{chunk-PSI7MMGP.js → chunk-A5KM5EYE.js} +43 -4
- package/dist/src/{chunk-D2BDOCX7.js → chunk-WE2U2UBP.js} +24 -7
- package/dist/src/{chunk-BMP6H3SZ.js → chunk-ZOSYUMKY.js} +6 -9
- package/dist/src/cli.js +8 -8
- package/dist/src/{commands-CEBO6WWE.js → commands-4LDW6L23.js} +4 -4
- package/dist/src/{problems-FFAR72WZ.js → problems-WGY5NWFQ.js} +3 -3
- package/dist/src/{run-DU2H6FZI.js → run-KXGYQUDF.js} +14 -9
- package/dist/src/{server-7AN6XCTF.js → server-PU2ZLWVN.js} +4 -3
- package/dist/web/app/assets/65d089fc/aula-method.js +1 -0
- package/dist/web/app/assets/65d089fc/aula.js +1 -0
- package/dist/web/app/assets/{build-worker.js → 65d089fc/build-worker.js} +8 -8
- package/dist/web/app/assets/65d089fc/index.js +52 -0
- package/dist/web/app/assets/__vite-browser-external-BcnWWh3P.js +1 -0
- package/dist/web/app/assets/{aula-voice-worker-DNzLI-en.js → aula-voice-worker-auUeqfk1.js} +10 -10
- package/dist/web/app/assets/{aula.core5-BmrvjVro.wasm → aula.core5-CdA2Cc_n.wasm} +0 -0
- package/dist/web/app/assets/{index-cL-Dm_aw.css → index-C_rGCAZR.css} +1 -1
- package/dist/web/app/assets/protocol-BucA_SVY.js +15 -0
- package/dist/web/app/assets/{src-B22P60S6.js → src-BV6xlpP7.js} +6 -6
- package/dist/web/app/index.html +4 -4
- package/package.json +2 -2
- package/dist/web/app/assets/__vite-browser-external-B6HdzU1j.js +0 -1
- package/dist/web/app/assets/aula-method.js +0 -1
- package/dist/web/app/assets/aula.js +0 -1
- package/dist/web/app/assets/index-D6yaOVRx.js +0 -53
- package/dist/web/app/assets/protocol-CDkth-6D.js +0 -15
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.3](https://github.com/lucasavila00/aula-voice/releases/tag/v0.1.3) (`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.3/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
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
// ../aula-narration/src/align.ts
|
|
2
|
-
var WORD = /(?:\[[^\][\s]*\]\(\/[^/]*\/\)|\S)+/g;
|
|
3
|
-
function tokens(text) {
|
|
4
|
-
return [...text.matchAll(WORD)].map((match) => ({ text: match[0], char: match.index }));
|
|
5
|
-
}
|
|
6
2
|
function roundHalfEven(value) {
|
|
7
3
|
const floor = Math.floor(value);
|
|
8
4
|
const rest = value - floor;
|
|
@@ -11,8 +7,7 @@ function roundHalfEven(value) {
|
|
|
11
7
|
return floor % 2 === 0 ? floor : floor + 1;
|
|
12
8
|
}
|
|
13
9
|
var ms = (seconds) => roundHalfEven(seconds * 1e3) / 1e3;
|
|
14
|
-
function alignWords(
|
|
15
|
-
const source = tokens(text);
|
|
10
|
+
function alignWords(source, spoken, read) {
|
|
16
11
|
if (read.length !== source.length) {
|
|
17
12
|
throw new Error(`${String(source.length)} words but ${String(read.length)} readings`);
|
|
18
13
|
}
|
|
@@ -61,11 +56,11 @@ function alignWords(text, spoken, read) {
|
|
|
61
56
|
ends[w] = phone.end;
|
|
62
57
|
});
|
|
63
58
|
let last = 0;
|
|
64
|
-
return source.map((
|
|
59
|
+
return source.map((text, w) => {
|
|
65
60
|
const start = starts[w] ?? Number.NaN;
|
|
66
61
|
const end = ends[w] ?? Number.NaN;
|
|
67
62
|
const found = !Number.isNaN(start) && start >= last;
|
|
68
|
-
const time = { text
|
|
63
|
+
const time = { text, start: ms(found ? start : last), end: ms(found ? end : last) };
|
|
69
64
|
if (found) last = end;
|
|
70
65
|
return time;
|
|
71
66
|
});
|
|
@@ -155,12 +150,12 @@ async function tokenBatches(vocab, phonemize2, text) {
|
|
|
155
150
|
}
|
|
156
151
|
var STRESS = "\u02C8\u02CC";
|
|
157
152
|
var isSound = (phoneme) => new RegExp("\\p{L}", "u").test(phoneme) && !STRESS.includes(phoneme);
|
|
158
|
-
async function timesOfWords(phonemize2,
|
|
153
|
+
async function timesOfWords(phonemize2, words, timings) {
|
|
159
154
|
const spoken = timings.filter((timing) => isSound(timing.phoneme));
|
|
160
155
|
if (!spoken.length) throw new Error("the model gave no phoneme timings");
|
|
161
156
|
const read = [];
|
|
162
|
-
for (const word of
|
|
163
|
-
return alignWords(
|
|
157
|
+
for (const word of words) read.push(Array.from(await phonemize2(word)).filter(isSound));
|
|
158
|
+
return alignWords(words, spoken, read);
|
|
164
159
|
}
|
|
165
160
|
|
|
166
161
|
// ../aula-narration/src/vocab.ts
|
|
@@ -283,24 +278,24 @@ var KOKORO_VOCAB = /* @__PURE__ */ new Map([
|
|
|
283
278
|
]);
|
|
284
279
|
|
|
285
280
|
// ../aula-narration/src/aula-voice.ts
|
|
286
|
-
var AULA_VOICE_RELEASE = "v0.1.
|
|
281
|
+
var AULA_VOICE_RELEASE = "v0.1.3";
|
|
287
282
|
var RELEASE_URL = `https://github.com/lucasavila00/aula-voice/releases/download/${AULA_VOICE_RELEASE}`;
|
|
288
283
|
var AULA_VOICE_FILES = {
|
|
289
284
|
model: {
|
|
290
285
|
path: "model.safetensors",
|
|
291
286
|
bytes: 33489768,
|
|
292
|
-
sha256: "
|
|
287
|
+
sha256: "122b3602c825f3ae23e23d44239da3641d14fb83bedec230f8e23952836b9e20"
|
|
293
288
|
},
|
|
294
289
|
config: {
|
|
295
290
|
path: "config.json",
|
|
296
291
|
bytes: 2346,
|
|
297
|
-
sha256: "
|
|
292
|
+
sha256: "e71a54f3a27ca153fd2cea9470395889cbc86cd6d66476ffbcf3918087443c6d"
|
|
298
293
|
}
|
|
299
294
|
};
|
|
300
295
|
var AULA_VOICE_WEIGHTS = {
|
|
301
296
|
path: "aula-voice.avw",
|
|
302
297
|
bytes: 33478208,
|
|
303
|
-
sha256: "
|
|
298
|
+
sha256: "7a6039017a2783f7f3954a3531148e761b683807ebd3bb1436505f72379e81a1"
|
|
304
299
|
};
|
|
305
300
|
var SERVER_WEIGHTS_PATH = `/models/${AULA_VOICE_WEIGHTS.path}`;
|
|
306
301
|
var aulaVoiceUrl = (file) => `${RELEASE_URL}/${file.path}`;
|
|
@@ -317,7 +312,8 @@ function limited(audio) {
|
|
|
317
312
|
const scale = PEAK / loudest;
|
|
318
313
|
return audio.map((sample) => sample * scale);
|
|
319
314
|
}
|
|
320
|
-
async function layout(parts,
|
|
315
|
+
async function layout(parts, words, speed, audio) {
|
|
316
|
+
const text = words.join(" ");
|
|
321
317
|
const batches = await batchesOf(parts.phonemize, text, MAX_TOKENS);
|
|
322
318
|
if (!batches.length) throw new Error(`Nothing to say: ${JSON.stringify(text)} has no phonemes`);
|
|
323
319
|
const pieces = [];
|
|
@@ -341,10 +337,10 @@ async function layout(parts, text, speed, audio) {
|
|
|
341
337
|
pieces.push({ audio: spoken.audio?.subarray(head, tail) ?? null, length: tail - head, pause });
|
|
342
338
|
offset += tail - head + pause;
|
|
343
339
|
}
|
|
344
|
-
return { pieces, total: offset, words: await timesOfWords(parts.phonemize,
|
|
340
|
+
return { pieces, total: offset, words: await timesOfWords(parts.phonemize, words, timings) };
|
|
345
341
|
}
|
|
346
|
-
async function speakAulaVoice(parts,
|
|
347
|
-
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);
|
|
348
344
|
const samples = new Float32Array(total);
|
|
349
345
|
let offset = 0;
|
|
350
346
|
for (const piece of pieces) {
|
|
@@ -353,8 +349,8 @@ async function speakAulaVoice(parts, text, speed) {
|
|
|
353
349
|
}
|
|
354
350
|
return { samples: limited(samples), sampleRate: SAMPLE_RATE, words };
|
|
355
351
|
}
|
|
356
|
-
async function timeAulaVoice(parts,
|
|
357
|
-
const { total, words } = await layout(parts,
|
|
352
|
+
async function timeAulaVoice(parts, given, speed) {
|
|
353
|
+
const { total, words } = await layout(parts, given, speed, false);
|
|
358
354
|
return { samples: total, sampleRate: SAMPLE_RATE, words };
|
|
359
355
|
}
|
|
360
356
|
|
|
@@ -510,10 +506,10 @@ function studentWeightFile(model, config) {
|
|
|
510
506
|
}
|
|
511
507
|
}
|
|
512
508
|
const tensors = readSafetensors(model);
|
|
513
|
-
const
|
|
509
|
+
const tokens = tensors.get("tokens.weight");
|
|
514
510
|
const voices = tensors.get("voices.weight");
|
|
515
|
-
if (!
|
|
516
|
-
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;
|
|
517
513
|
const headBlocks = new Set(
|
|
518
514
|
[...tensors.keys()].filter((n) => n.startsWith("head.blocks.")).map((n) => n.split(".")[2])
|
|
519
515
|
).size;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
timeChapter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZOSYUMKY.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, checkLexicon, 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();
|
|
@@ -102,6 +102,7 @@ function checkProject(project, host, only) {
|
|
|
102
102
|
const byChapter = [...unloaded, ...[...own].toSorted(([a], [b]) => a - b)];
|
|
103
103
|
const reported = [
|
|
104
104
|
...checkLexicon(project, { host }),
|
|
105
|
+
...checkTitle(project, { host }),
|
|
105
106
|
...byChapter.flatMap(([index, d]) => inScope(index) ? d : [])
|
|
106
107
|
];
|
|
107
108
|
const elsewhere = byChapter.flatMap(([index, d]) => inScope(index) ? [] : d);
|
|
@@ -145,6 +146,38 @@ function clipPlan(narrations, fps) {
|
|
|
145
146
|
return { clips, seconds: starts.at(-1) ?? 0 };
|
|
146
147
|
}
|
|
147
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
|
+
|
|
148
181
|
// ../aula-project/src/preview.ts
|
|
149
182
|
import { chapterNames as chapterNames2, FPS } from "@beff/aula/run";
|
|
150
183
|
|
|
@@ -242,6 +275,9 @@ Metaphor: ${text.metaphor}
|
|
|
242
275
|
return out;
|
|
243
276
|
}
|
|
244
277
|
|
|
278
|
+
// ../aula-project/src/videos.ts
|
|
279
|
+
import { estimateNarration } from "@beff/aula/text";
|
|
280
|
+
|
|
245
281
|
// ../aula-project/src/workspace.ts
|
|
246
282
|
import * as Engine from "@beff/aula";
|
|
247
283
|
import { diagnosticOf, importUserModule, loadEngine } from "@beff/aula/run";
|
|
@@ -263,6 +299,9 @@ export {
|
|
|
263
299
|
chapterIndexes,
|
|
264
300
|
exportCheck,
|
|
265
301
|
clipPlan,
|
|
302
|
+
wordNotes,
|
|
303
|
+
noteLine,
|
|
304
|
+
notesLine,
|
|
266
305
|
previewTargets,
|
|
267
306
|
targetChapters,
|
|
268
307
|
previewJobs,
|
|
@@ -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-A5KM5EYE.js";
|
|
23
26
|
import {
|
|
24
27
|
narrateScript,
|
|
25
28
|
scriptAudio,
|
|
26
29
|
wav
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZOSYUMKY.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) {
|
|
@@ -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
|
}
|
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-4C4BQTKI.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-WGY5NWFQ.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-KXGYQUDF.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-PU2ZLWVN.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-4LDW6L23.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-WE2U2UBP.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-A5KM5EYE.js";
|
|
14
|
+
import "./chunk-ZOSYUMKY.js";
|
|
15
|
+
import "./chunk-4C4BQTKI.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-A5KM5EYE.js";
|
|
4
|
+
import "./chunk-ZOSYUMKY.js";
|
|
5
|
+
import "./chunk-4C4BQTKI.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-WE2U2UBP.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-A5KM5EYE.js";
|
|
12
|
+
import "./chunk-ZOSYUMKY.js";
|
|
13
|
+
import "./chunk-4C4BQTKI.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-ZOSYUMKY.js";
|
|
2
2
|
import {
|
|
3
3
|
SERVER_WEIGHTS_PATH
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4C4BQTKI.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{_ as e,f as t}from"../src-BV6xlpP7.js";var n=8,r=.5,i=3,a=3,o=[`view`,`claim`,`forecast`,`estimate`,`proposed`,`external`,`schematic`,`not measured`,`expected`,`alleged`],s=1,c=e=>JSON.stringify(e);function l(e){return e.toLowerCase().match(/[a-z0-9$%]+/g)??[]}function u(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function d(e,t){let n=l(e),r=` ${l(t).join(` `)} `;for(let e=0;e+a<=n.length;e++)if(r.includes(` ${n.slice(e,e+a).join(` `)} `))return!0;return!1}function f(e){let t=e.toLowerCase();return o.some(e=>t.includes(e))||/(^|[^\p{L}\p{N}_])\p{Lu}[\p{L}\p{N}_.&-]*['’]s(?![\p{L}\p{N}_])/u.test(e)}function p(e,t){let n=Math.max(e.low[0]-t.high[0],t.low[0]-e.high[0],0),r=Math.max(e.low[1]-t.high[1],t.low[1]-e.high[1],0);return Math.hypot(n,r)<=s}function m(e,t,a){let o=[],s=(t,n=e.place)=>{o.push({message:t,...n===void 0?{}:{at:n}})};a.mechanism.trim()===``&&s(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`),a.sources.length===0&&s(`the paragraph has no sources (give its sources, or ["recap"])`);for(let e of a.sources)u(e)&&!t.exists(e)&&s(`${c(e)}: this path is not a file: correct the path or add the file`);let l=t.paragraphs.flatMap(e=>e.says.map(e=>e.text)).join(` `),m=new Map;for(let t of e.screen.instants)for(let e of t.texts)m.set(JSON.stringify([e.place,e.text]),e);for(let e of m.values())e.text.split(/\s+/).filter(Boolean).length>i&&s(`text on screen over ${String(i)} words: ${c(e.text)}; make it shorter`,e.place),d(e.text,l)&&s(`text on screen repeats the narration: ${c(e.text)}; use other words`,e.place);let h=new Map;for(let t of e.screen.instants){let e=new Set(t.texts.filter(e=>e.opacity>r).map(e=>e.id)).size,i=JSON.stringify(t.place);e>(h.get(i)?.count??n)&&h.set(i,{count:e,at:t.place})}for(let{count:e,at:t}of h.values())s(`${String(e)} labels on screen (about ${String(n)} at most): show fewer labels at one time, or split the picture`,t);let g=new Map,_=new Set;for(let t of e.screen.instants)for(let e of t.dashed)t.texts.some(t=>f(t.text)&&p(t,e))?_.add(e.id):g.set(e.id,e);for(let[e,t]of g)_.has(e)||s(`dashed shape with no attribution text near it: put a text that says whose view it is, such as "Smith's view", next to it`,t.place);return t.number===t.count&&e.index===t.paragraphs.length-1&&(a.sources.length!==1||a.sources[0]!==`recap`)&&s(`the video must end with a recap paragraph (sources: ["recap"])`),o}function h(n){let r=e(`paragraph`,n);return({sources:e},n)=>t({mechanism:r,sources:e},n??((t,n)=>m(t,n,{mechanism:r,sources:e})))}export{m as findings,h as paragraph};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as checkChapter,n as checkLexicon,r as checkTitle,l as defineChapter,u as defineProject,d as isProjectDefinition,c as m,f as paragraph,p as pronounce,a as readChapter,o as renderChapter,m as renderScene,h as say,g as show,_ as tagText}from"../src-BV6xlpP7.js";
|