fix(tts): reduce the pause duration between sentences in Edge TTS, closes #2837 (#2844)

This commit is contained in:
Huang Xin
2026-01-03 08:44:15 +01:00
committed by GitHub
parent a5e09e8454
commit fb41ff5d0c
2 changed files with 3 additions and 2 deletions
@@ -56,7 +56,7 @@ export class EdgeTTSClient implements TTSClient {
}
getPayload = (lang: string, text: string, voiceId: string) => {
return { lang, text, voice: voiceId, rate: this.#rate, pitch: this.#pitch } as EdgeTTSPayload;
return { lang, text, voice: voiceId, rate: 1.0, pitch: this.#pitch } as EdgeTTSPayload;
};
getVoiceIdFromLang = async (lang: string) => {
@@ -169,6 +169,7 @@ export class EdgeTTSClient implements TTSClient {
};
this.#isPlaying = true;
audio.src = audioUrl || '';
audio.playbackRate = this.#rate;
audio.play().catch((err) => {
cleanUp();
console.error('Failed to play audio:', err);
@@ -124,7 +124,7 @@ export class TTSController extends EventTarget {
for await (const _ of iter);
}
async preloadNextSSML(count: number = 2) {
async preloadNextSSML(count: number = 4) {
const tts = this.view.tts;
if (!tts) return;
let preloaded = 0;