diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 1e23135..88c992c 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -318,23 +318,24 @@ const synthMicrosoft = async(logger, { let speechConfig; if (use_custom_tts && custom_tts_endpoint_url) { if (apiKey) { - speechConfig = SpeechConfig.fromEndpoint(custom_tts_endpoint_url, apiKey); + speechConfig = SpeechConfig.fromEndpoint(new URL(custom_tts_endpoint_url), apiKey); } else { - speechConfig = SpeechConfig.fromEndpoint(custom_tts_endpoint_url); + speechConfig = SpeechConfig.fromEndpoint(new URL(custom_tts_endpoint_url)); } } else { speechConfig = SpeechConfig.fromSubscription(apiKey, region); } speechConfig.speechSynthesisLanguage = language; speechConfig.speechSynthesisVoiceName = voice; - if (use_custom_tts && custom_tts_endpoint) { + if (use_custom_tts && custom_tts_endpoint ) { speechConfig.endpointId = custom_tts_endpoint; - + } + if (use_custom_tts && !content.startsWith('${text}`; + content = `${text}`; } speechConfig.speechSynthesisOutputFormat = trimSilence ? SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm :