@张寒轩 I have tried the sample and it seems to work as expected.
Could you try to use the complete sample referenced above directly?
If an answer is helpful, please click on or upvote which might help other community members reading this thread.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I'm new to here Azure. And I only want to use the text to speech function with Azure.
I've follow the tour how-to-speech-synthesis to write the code. And everything looks fine. But the broswer only sound up once. I've try to change the config and location of the service but failed still.
what's more, there are no any error in F12. So it confuse me a lot. And don't know what to do.
In Addition, I'm using global Azure in China for free account. the last service has been set to South Korea. Is it problem in net? I'm getting more confused with the code has worked well for once.
PPPPPPPPPPPPPPPPPPPPPPPPPlase help me. Thanks a lot.
here is the code.
function synthesizeSpeech() {
const speechConfig = SpeechSDK.SpeechConfig.fromSubscription("***", "koreacentral");
// Set either the `SpeechSynthesisVoiceName` or `SpeechSynthesisLanguage`.
speechConfig.speechSynthesisLanguage = "zh-CN";
// speechConfig.speechSynthesisVoiceName = "zh-CN-YunyeNeural";
const audioConfig=SpeechSDK.AudioConfig.fromDefaultSpeakerOutput();
const synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig, audioConfig);
synthesizer.speakTextAsync(
t,
result=>{
if(result){
synthesizer.close();
return result.audioData;
}
},
error=>{
console.error(error);
synthesizer.close();
}
)
}
t=some Chinese characters
;