Speech recognition 如何在机器人中更改bing语音的语言

Speech recognition 如何在机器人中更改bing语音的语言,speech-recognition,botframework,bing-speech,Speech Recognition,Botframework,Bing Speech,我在BotframeWork中使用bing语音,如下所示: var speechOptions = { speechRecognizer: new CognitiveServices.SpeechRecognizer( { subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY' }), speechSynthesizer: new CognitiveServices.SpeechSynthesizer(

我在BotframeWork中使用bing语音,如下所示:

var speechOptions = 
{
    speechRecognizer: new CognitiveServices.SpeechRecognizer(
    {
        subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY'
    }),
    speechSynthesizer: new CognitiveServices.SpeechSynthesizer(
    {
        subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY',
        gender: CognitiveServices.SynthesisGender.Female,
        voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
    })
}
我想将语言从“en-us”改为其他语言,是否有任何选项需要添加,比如lang:“it-it”


还有一种方法可以根据用户所说的语言来更改语言吗?

有两种不同的项目:语音输入(SpeechRecognitor)和语音输出(Speech合成器)

语音识别器 有一个可选的
locale
参数,您可以像传递
subscriptionKey
一样传递该参数,请参见:

语音合成器 使用
gender
voiceName
参数():

导出接口ICognitiveServicesPeechsSynthesisProperties{
subscriptionKey?:字符串,
性别?:合成键,
voiceName?:字符串,
fetchCallback?:(authFetchEventId:string)=>Promise,
fetchOnExpiryCallback?:(authFetchEventId:string)=>Promise
}
对于这些参数的可能值,您可以在此处找到一个列表:

export interface ICognitiveServicesSpeechRecognizerProperties {
    locale?: string,
    subscriptionKey?: string,
    fetchCallback?: (authFetchEventId: string) => Promise<string>,
    fetchOnExpiryCallback?: (authFetchEventId: string) => Promise<string>
}
const locale = properties.locale || 'en-US';
export interface ICognitiveServicesSpeechSynthesisProperties {
    subscriptionKey?: string,
    gender?: SynthesisGender,
    voiceName?: string,
    fetchCallback?: (authFetchEventId: string) => Promise<string>,
    fetchOnExpiryCallback?: (authFetchEventId: string) => Promise<string>
}