From 9f894e1d9e5b2f11f53995018cdae6f768f63d21 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Fri, 10 Jan 2025 15:26:01 +0100 Subject: [PATCH] Use default voice in Edge TTS (#141) --- apps/readest-app/src/services/tts/TTSController.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/readest-app/src/services/tts/TTSController.ts b/apps/readest-app/src/services/tts/TTSController.ts index eeec956d..30674c9f 100644 --- a/apps/readest-app/src/services/tts/TTSController.ts +++ b/apps/readest-app/src/services/tts/TTSController.ts @@ -155,7 +155,10 @@ export class TTSController extends EventTarget { async setVoice(voiceId: string) { this.state = 'setvoice-paused'; this.ttsClient.stop(); - if (this.ttsEdgeVoices.find((voice) => voice.id === voiceId && !voice.disabled)) { + const useEdgeTTS = !!this.ttsEdgeVoices.find( + (voice) => (voiceId === '' || voice.id === voiceId) && !voice.disabled, + ); + if (useEdgeTTS) { this.ttsClient = this.ttsEdgeClient; } else { this.ttsClient = this.ttsWebClient;