klaudio 0.12.3 → 0.12.4
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/bin/cli.js +2 -0
- package/package.json +1 -1
- package/src/tts.js +4 -6
package/bin/cli.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
if (process.argv[2] === "play") {
|
|
5
5
|
const { handlePlayCommand } = await import("../src/player.js");
|
|
6
6
|
await handlePlayCommand(process.argv.slice(3));
|
|
7
|
+
// Hard exit: skip native module destructors (onnxruntime crashes during cleanup)
|
|
7
8
|
process.exit(0);
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -28,6 +29,7 @@ if (process.argv[2] === "say") {
|
|
|
28
29
|
const { speak } = await import("../src/tts.js");
|
|
29
30
|
await speak(text, { voice });
|
|
30
31
|
}
|
|
32
|
+
// Hard exit: skip native module destructors (onnxruntime crashes during cleanup)
|
|
31
33
|
process.exit(0);
|
|
32
34
|
}
|
|
33
35
|
|
package/package.json
CHANGED
package/src/tts.js
CHANGED
|
@@ -317,10 +317,9 @@ async function speakPiper(text, onProgress) {
|
|
|
317
317
|
|
|
318
318
|
function speakMacOS(text) {
|
|
319
319
|
return new Promise((resolve) => {
|
|
320
|
-
|
|
321
|
-
execFile("say", ["-v", "Samantha", text], { timeout: 15000 }, (err) => {
|
|
320
|
+
execFile("say", ["-v", "Samantha", text], { timeout: 30000 }, (err) => {
|
|
322
321
|
if (err) {
|
|
323
|
-
execFile("say", [text], { timeout:
|
|
322
|
+
execFile("say", [text], { timeout: 30000 }, () => resolve());
|
|
324
323
|
} else {
|
|
325
324
|
resolve();
|
|
326
325
|
}
|
|
@@ -374,13 +373,12 @@ export async function speak(text, options = {}) {
|
|
|
374
373
|
? { voice: null, onProgress: options } // backwards compat: speak(text, onProgress)
|
|
375
374
|
: options;
|
|
376
375
|
|
|
377
|
-
// macOS: use built-in `say` (
|
|
378
|
-
// can abort the process with a C++ exception before JS can catch it)
|
|
376
|
+
// macOS: use built-in `say` (Kokoro's native phonemizer module crashes on macOS)
|
|
379
377
|
if (platform() === "darwin") {
|
|
380
378
|
return speakMacOS(text);
|
|
381
379
|
}
|
|
382
380
|
|
|
383
|
-
// Try Kokoro (best quality,
|
|
381
|
+
// Try Kokoro (best quality, Linux/Windows)
|
|
384
382
|
if (await isKokoroAvailable()) {
|
|
385
383
|
try {
|
|
386
384
|
await speakKokoro(text, voice);
|