diff --git a/MRCP/ms-common/include/common.h b/MRCP/ms-common/include/common.h
index 88f6dfac..3ca175a2 100644
--- a/MRCP/ms-common/include/common.h
+++ b/MRCP/ms-common/include/common.h
@@ -2,21 +2,25 @@
namespace Microsoft
{
- namespace speechlib
- {
- struct Common
- {
- static constexpr const char* SPEECH_SECTION = "speech_configs";
- static constexpr const char* SPEECH_SDK_REGION = "speech_sdk_region";
- static constexpr const char* SPEECH_SDK_KEY = "speech_sdk_key";
- static constexpr const char* MAX_SYNTHESIZER = "max_synthesizer";
- static constexpr const char* SR_USE_LOCAL_CONTAINER = "sr_use_local_container";
- static constexpr const char* TTS_USE_LOCAL_CONTAINER = "tts_use_local_container";
- static constexpr const char* SR_LOCAL_ENDPOINT = "sr_local_endpoint";
- static constexpr const char* SR_LOCAL_KEY = "sr_local_key";
- static constexpr const char* TTS_LOCAL_ENDPOINT = "tts_local_endpoint";
- static constexpr const char* TTS_LOCAL_KEY = "tts_local_key";
- };
+namespace speechlib
+{
+struct Common
+{
+ static constexpr const char* SPEECH_SECTION = "speech_configs";
+ static constexpr const char* SPEECH_SDK_REGION = "speech_sdk_region";
+ static constexpr const char* SPEECH_SDK_KEY = "speech_sdk_key";
+ static constexpr const char* MAX_SYNTHESIZER = "max_synthesizer";
+ static constexpr const char* SR_USE_LOCAL_CONTAINER =
+ "sr_use_local_container";
+ static constexpr const char* TTS_USE_LOCAL_CONTAINER =
+ "tts_use_local_container";
+ static constexpr const char* SR_LOCAL_ENDPOINT = "sr_local_endpoint";
+ static constexpr const char* SR_LOCAL_KEY = "sr_local_key";
+ static constexpr const char* TTS_LOCAL_ENDPOINT = "tts_local_endpoint";
+ static constexpr const char* TTS_LOCAL_KEY = "tts_local_key";
+ static constexpr const char* TTS_LOCALE = "tts_locale";
+ static constexpr const char* TTS_VOICE_NAME = "tts_voice_name";
+};
- }
-}
+} // namespace speechlib
+} // namespace Microsoft
diff --git a/MRCP/ms-recog/packages.config b/MRCP/ms-recog/packages.config
index bfebb7db..fd5134f8 100644
--- a/MRCP/ms-recog/packages.config
+++ b/MRCP/ms-recog/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/MRCP/ms-synth/packages.config b/MRCP/ms-synth/packages.config
index bfebb7db..fd5134f8 100644
--- a/MRCP/ms-synth/packages.config
+++ b/MRCP/ms-synth/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/MRCP/ms-synth/src/synthesizer_pool.h b/MRCP/ms-synth/src/synthesizer_pool.h
index 442cdcd7..376706a0 100644
--- a/MRCP/ms-synth/src/synthesizer_pool.h
+++ b/MRCP/ms-synth/src/synthesizer_pool.h
@@ -21,7 +21,14 @@ class SpeechSynthesizerFactory
ConfigManager::GetStrValue(Common::SPEECH_SECTION, Common::TTS_LOCAL_KEY);
static auto endpoint =
ConfigManager::GetStrValue(Common::SPEECH_SECTION, Common::TTS_LOCAL_ENDPOINT);
- speechConfig = SpeechConfig::FromEndpoint(endpoint, localKey);
+ if(localKey.empty())
+ {
+ speechConfig = SpeechConfig::FromEndpoint(endpoint);
+ }
+ else
+ {
+ speechConfig = SpeechConfig::FromEndpoint(endpoint, localKey);
+ }
}
else
{
@@ -32,10 +39,21 @@ class SpeechSynthesizerFactory
speechConfig = SpeechConfig::FromSubscription(subscriptionKey, region); // create from subscription
}
-
+
speechConfig->SetSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat::Raw16Khz16BitMonoPcm);
- speechConfig->SetSpeechSynthesisVoiceName(
- "Microsoft Server Speech Text to Speech Voice (en-US, JessaNeural)");
+ static auto locale =
+ ConfigManager::GetStrValue(Common::SPEECH_SECTION, Common::TTS_LOCALE);
+ if(!locale.empty())
+ {
+ speechConfig->SetSpeechSynthesisLanguage(locale);
+ }
+ static auto voiceName =
+ ConfigManager::GetStrValue(Common::SPEECH_SECTION, Common::TTS_VOICE_NAME);
+ if(!voiceName.empty())
+ {
+ speechConfig->SetSpeechSynthesisVoiceName(voiceName);
+ }
+
return SpeechSynthesizer::FromConfig(speechConfig, nullptr);
}
diff --git a/MRCP/sample-conf/config.json b/MRCP/sample-conf/config.json
index b3bd1538..b5497c3a 100644
--- a/MRCP/sample-conf/config.json
+++ b/MRCP/sample-conf/config.json
@@ -8,6 +8,8 @@
"sr_local_key": "",
"tts_use_local_container": false,
"tts_local_endpoint": "",
- "tts_local_key": ""
+ "tts_local_key": "",
+ "tts_locale": "",
+ "tts_voice_name": "Microsoft Server Speech Text to Speech Voice (en-US, JessaNeural)"
}
}
\ No newline at end of file