Skip to content

Commit

Permalink
update sdk version and modify for local container
Browse files Browse the repository at this point in the history
  • Loading branch information
Yulin Li authored and boltomli committed Oct 19, 2019
1 parent a81fc1b commit c6f912a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 24 deletions.
38 changes: 21 additions & 17 deletions MRCP/ms-common/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion MRCP/ms-recog/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CognitiveServices.Speech" version="1.6.0" targetFramework="native" />
<package id="Microsoft.CognitiveServices.Speech" version="1.7.0" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion MRCP/ms-synth/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CognitiveServices.Speech" version="1.6.0" targetFramework="native" />
<package id="Microsoft.CognitiveServices.Speech" version="1.7.0" targetFramework="native" />
</packages>
26 changes: 22 additions & 4 deletions MRCP/ms-synth/src/synthesizer_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
}

Expand Down
4 changes: 3 additions & 1 deletion MRCP/sample-conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
}

0 comments on commit c6f912a

Please sign in to comment.