首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Azure text-to-speech中更改声音?

如何在Azure text-to-speech中更改声音?
EN

Stack Overflow用户
提问于 2021-06-22 22:00:38
回答 2查看 149关注 0票数 1

我试着把我的React网站改成使用英国声音:

代码语言:javascript
复制
const voice = "Microsoft Server Speech Text to Speech Voice (en-GB, LibbyNeural)"
speechConfig.speechSynthesisVoiceName = voice;
speechConfig.speechRecognitionLanguage = "en-GB";
const audioConfig = AudioConfig.fromDefaultMicrophoneInput();

return new SpeechRecognizer(speechConfig, audioConfig);

但我听到的都是美国人的声音。我遗漏了什么?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-06-23 00:45:10

正如Ryan所指出的,您将希望使用SpeechSynthesizer而不是SpeechRecognizer。这里有一个到TTS sample code on github的链接。

样例应该会让事情变得清晰起来,并让你开始行动起来。请务必注意audioConfig和speechConfig属性。例如,speechSynthesisVoiceName需要使用提供的here中的语音名称标签进行更改。(再往下一页是standard voices)。而speechRecognitionLanguage将被speechSynthesisLanguage取代。这些只是几个例子,但是github示例应该可以清楚地说明所有问题。

代码语言:javascript
复制
var audioConfig = sdk.AudioConfig.fromAudioFileOutput(filename);
var speechConfig = sdk.SpeechConfig.fromSubscription(settings.subscriptionKey, settings.serviceRegion);

// setting the synthesis language, voice name, and output audio format.
// see https://aka.ms/speech/tts-languages for available languages and voices
speechConfig.speechSynthesisLanguage = settings.language;
speechConfig.speechSynthesisVoiceName = "en-US-GuyNeural";

// create the speech synthesizer.
var synthesizer = new sdk.SpeechSynthesizer(speechConfig, audioConfig);
票数 1
EN

Stack Overflow用户

发布于 2021-06-23 00:31:04

SpeechRecognizer用于将语音转换为文本,如果您想将文本转换为语音,则需要使用SpeechSynthesizer。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68084982

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档