I am using bing speech in botframeowrk as below:
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)'
})
}
I want to change language from 'en-us' to some other language, is there any options that i should add like lang:'it-it'.
And also is there a way that i can change languages based on what language user speaks?
There are 2 different items: voice input (SpeechRecognizer) and voice output (SpeechSynthesizer)
There is an optional locale
parameter that you can pass like you pass subscriptionKey
, see sources:
export interface ICognitiveServicesSpeechRecognizerProperties {
locale?: string,
subscriptionKey?: string,
fetchCallback?: (authFetchEventId: string) => Promise<string>,
fetchOnExpiryCallback?: (authFetchEventId: string) => Promise<string>
}
There is a fallback if none provided (source):
const locale = properties.locale || 'en-US';
Use gender
and voiceName
parameters (sources):
export interface ICognitiveServicesSpeechSynthesisProperties {
subscriptionKey?: string,
gender?: SynthesisGender,
voiceName?: string,
fetchCallback?: (authFetchEventId: string) => Promise<string>,
fetchOnExpiryCallback?: (authFetchEventId: string) => Promise<string>
}
For the possible values for those parameters, you can find a list here: https://learn.microsoft.com/en-us/azure/cognitive-services/speech/api-reference-rest/bingvoiceoutput#SupLocales