mirror of
https://github.com/jambonz/speech-utils.git
synced 2026-07-17 01:31:48 +00:00
wip
This commit is contained in:
+6
-5
@@ -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('<speak')) {
|
||||
/**
|
||||
* Note: it seems that to use custom voice ssml is required with the voice attribute
|
||||
* Otherwise sending plain text we get "Voice does not match"
|
||||
*/
|
||||
if (!content.startsWith('<speak')) content = `<speak>${text}</speak>`;
|
||||
content = `<speak>${text}</speak>`;
|
||||
}
|
||||
speechConfig.speechSynthesisOutputFormat = trimSilence ?
|
||||
SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm :
|
||||
|
||||
Reference in New Issue
Block a user