fivetech commited on
Commit
c5622cf
·
1 Parent(s): adbfdcb

Voz femenina por defecto (es_ES-sharvard speaker F); lib patched para speakerId

Browse files
vendor/piper/piper-tts-web.js CHANGED
@@ -243,11 +243,13 @@ const _TtsSession = class _TtsSession {
243
  voiceId,
244
  progress,
245
  logger,
246
- wasmPaths
 
247
  }) {
248
  __privateAdd(this, _TtsSession_instances);
249
  __publicField(this, "ready", false);
250
  __publicField(this, "voiceId", "en_US-hfc_female-medium");
 
251
  __publicField(this, "waitReady", false);
252
  __privateAdd(this, _createPiperPhonemize);
253
  __privateAdd(this, _modelConfig);
@@ -385,7 +387,7 @@ predictChunk_fn = async function(text) {
385
  "/espeak-ng-data"
386
  ]);
387
  });
388
- const speakerId = 0;
389
  const noiseScale = __privateGet(this, _modelConfig).inference.noise_scale;
390
  const lengthScale = __privateGet(this, _modelConfig).inference.length_scale;
391
  const noiseW = __privateGet(this, _modelConfig).inference.noise_w;
 
243
  voiceId,
244
  progress,
245
  logger,
246
+ wasmPaths,
247
+ speakerId
248
  }) {
249
  __privateAdd(this, _TtsSession_instances);
250
  __publicField(this, "ready", false);
251
  __publicField(this, "voiceId", "en_US-hfc_female-medium");
252
+ __publicField(this, "speakerId", 0);
253
  __publicField(this, "waitReady", false);
254
  __privateAdd(this, _createPiperPhonemize);
255
  __privateAdd(this, _modelConfig);
 
387
  "/espeak-ng-data"
388
  ]);
389
  });
390
+ const speakerId = this.speakerId ?? 0;
391
  const noiseScale = __privateGet(this, _modelConfig).inference.noise_scale;
392
  const lengthScale = __privateGet(this, _modelConfig).inference.length_scale;
393
  const noiseW = __privateGet(this, _modelConfig).inference.noise_w;
workers/model-worker.js CHANGED
@@ -52,16 +52,17 @@ const holdLoadMs = Number(SEARCH.get("holdLoadMs")) || 0; // testing: stretch ou
52
  const post = (msg, transfer = []) => self.postMessage(msg, { transfer });
53
 
54
  // Piper TTS: native Spanish voice. `?voice=model` keeps the model's own voice; any
55
- // other value is a Piper voice id (e.g. es_ES-davefx-medium, es_MX-claude-high).
56
  let ttsSession = null;
57
  let ttsWarm = Promise.resolve();
58
- const ttsVoice = SEARCH.get("voice") ?? "es_ES-davefx-medium";
 
59
  if (ttsVoice !== "model") {
60
  post({ kind: "progress", status: "Preparando voz" });
61
  ttsWarm = (async () => {
62
  try {
63
  const lib = await import("../vendor/piper/piper-tts-web.js");
64
- ttsSession = await lib.TtsSession.create({ voiceId: ttsVoice, logger: (m) => console.log("tts:", m) });
65
  post({ kind: "progress", status: "Voz lista" });
66
  } catch (err) {
67
  console.warn("voice load failed:", err);
 
52
  const post = (msg, transfer = []) => self.postMessage(msg, { transfer });
53
 
54
  // Piper TTS: native Spanish voice. `?voice=model` keeps the model's own voice; any
55
+ // other value is a Piper voice id (e.g. es_ES-sharvard-medium) + `?speaker=` (F=1).
56
  let ttsSession = null;
57
  let ttsWarm = Promise.resolve();
58
+ const ttsVoice = SEARCH.get("voice") ?? "es_ES-sharvard-medium";
59
+ const ttsSpeaker = Number(SEARCH.get("speaker")) || 1;
60
  if (ttsVoice !== "model") {
61
  post({ kind: "progress", status: "Preparando voz" });
62
  ttsWarm = (async () => {
63
  try {
64
  const lib = await import("../vendor/piper/piper-tts-web.js");
65
+ ttsSession = await lib.TtsSession.create({ voiceId: ttsVoice, speakerId: ttsSpeaker, logger: (m) => console.log("tts:", m) });
66
  post({ kind: "progress", status: "Voz lista" });
67
  } catch (err) {
68
  console.warn("voice load failed:", err);