@beff/aula-cli 0.4.1 → 0.4.2

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.
@@ -305,6 +305,8 @@ var HOP = 300;
305
305
  var MAX_TOKENS = 250;
306
306
  var LEAD = 16;
307
307
  var FIRST = 3;
308
+ var TRAIL = 16;
309
+ var SILENT = new Set(';:,.!?\u2014\u2026"()\u201C\u201D ');
308
310
  var PEAK = 0.99;
309
311
  function limited(audio) {
310
312
  let loudest = 0;
@@ -328,12 +330,14 @@ async function layout(parts, words, audio) {
328
330
  const edges = [0];
329
331
  for (let i = 0; i < spoken.durations.length; i++) edges.push((edges[i] ?? 0) + Number(spoken.durations[i]) * HOP);
330
332
  const head = Math.max((edges[1] ?? 0) - LEAD * HOP, 0);
331
- const tail = edges.at(-2) ?? head;
332
333
  const first = Math.max((edges[1] ?? 0) - FIRST * HOP, head);
334
+ const last = known.findLastIndex((phoneme) => !SILENT.has(phoneme));
335
+ const end = edges.at(-2) ?? head;
336
+ const tail = last < 0 ? end : Math.min(end, Math.max((edges[last + 1] ?? end) + TRAIL * HOP, head));
333
337
  known.forEach((phoneme, i) => {
334
- const start = (i === 0 ? first : edges[i] ?? head) - head + offset;
335
- const end = (edges[i + 1] ?? tail) - head + offset;
336
- timings.push({ phoneme, start: start / SAMPLE_RATE, end: end / SAMPLE_RATE });
338
+ const start = Math.min(i === 0 ? first : edges[i] ?? head, tail) - head + offset;
339
+ const stop = Math.min(edges[i + 1] ?? tail, tail) - head + offset;
340
+ timings.push({ phoneme, start: start / SAMPLE_RATE, end: stop / SAMPLE_RATE });
337
341
  });
338
342
  const pause = index < batches.length - 1 ? Math.floor(pauseAfter(batch) * SAMPLE_RATE) : 0;
339
343
  pieces.push({ audio: spoken.audio?.subarray(head, tail) ?? null, length: tail - head, pause });
package/dist/src/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  studentWeightFile,
15
15
  timeAulaVoice,
16
16
  tokenBatches
17
- } from "./chunk-S54ZVMWJ.js";
17
+ } from "./chunk-6LC3WXJ7.js";
18
18
 
19
19
  // src/cli.ts
20
20
  import { spawn } from "node:child_process";
@@ -271,9 +271,9 @@ var base = Capabilities.create({
271
271
  },
272
272
  spawn
273
273
  });
274
- var { diagnosticsOf, printDiagnostics } = await import("./problems-BOX43W3Z.js");
274
+ var { diagnosticsOf, printDiagnostics } = await import("./problems-7BVC64RO.js");
275
275
  var { host, loadProject } = await import("./project-NWT5MDQI.js");
276
- var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, webOptions } = await import("./run-GOYOUYXS.js");
276
+ var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, webOptions } = await import("./run-5WC5WRZ2.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-PFMYGOU2.js");
299
+ const { serve } = await import("./server-GK3EWFX3.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,7 +312,7 @@ async function main(argv) {
312
312
  return 0;
313
313
  }
314
314
  if (command === "tokens") {
315
- const { tokens, tokensArgs } = await import("./commands-CCEO6TTU.js");
315
+ const { tokens, tokensArgs } = await import("./commands-QCUCX2GF.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;
@@ -12,7 +12,7 @@ import "./chunk-GFCJYE75.js";
12
12
  import "./chunk-2XGNOG2U.js";
13
13
  import "./chunk-BT3Z5CJI.js";
14
14
  import "./chunk-S74JLCZK.js";
15
- import "./chunk-S54ZVMWJ.js";
15
+ import "./chunk-6LC3WXJ7.js";
16
16
  import "./chunk-46KT47TH.js";
17
17
  import "./chunk-7KT36JRP.js";
18
18
  export {
@@ -2,7 +2,7 @@ import {
2
2
  printDiagnostics
3
3
  } from "./chunk-BT3Z5CJI.js";
4
4
  import "./chunk-S74JLCZK.js";
5
- import "./chunk-S54ZVMWJ.js";
5
+ import "./chunk-6LC3WXJ7.js";
6
6
  import {
7
7
  diagnosticsOf
8
8
  } from "./chunk-7KT36JRP.js";
@@ -10,7 +10,7 @@ import "./chunk-GFCJYE75.js";
10
10
  import "./chunk-2XGNOG2U.js";
11
11
  import "./chunk-BT3Z5CJI.js";
12
12
  import "./chunk-S74JLCZK.js";
13
- import "./chunk-S54ZVMWJ.js";
13
+ import "./chunk-6LC3WXJ7.js";
14
14
  import "./chunk-46KT47TH.js";
15
15
  import {
16
16
  wrongArgument
@@ -1,7 +1,7 @@
1
1
  import "./chunk-S74JLCZK.js";
2
2
  import {
3
3
  SERVER_WEIGHTS_PATH
4
- } from "./chunk-S54ZVMWJ.js";
4
+ } from "./chunk-6LC3WXJ7.js";
5
5
  import {
6
6
  exists
7
7
  } from "./chunk-46KT47TH.js";
@@ -0,0 +1 @@
1
+ import{t as e}from"./aula-voice-worker-CZGtnmSr.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();