Description
Describe the bug
Using Speech SDK for JavaScript v1.44.1, In speech-to-speech translation, when using AutoDetectSourceLanguageConfig
and not specify the speechRecognitionLanguage
for speech language, it throws error: throwIfNullOrUndefined:SpeechServiceConnection_RecoLanguage
.
If specify the speechRecognitionLanguage
, for example speechRecognitionLanguage='en-US'
. The error is gong. But the auto detect source language is not working, it is only recognize the English speech. They are conflicting.
The code example:
const speechConfig = SpeechSDK.SpeechTranslationConfig.fromSubscription(config.SPEECH_SUBSCRIPTION_KEY, config.SPEECH_SERVICE_REGION);
speechConfig.outputFormat = SpeechSDK.OutputFormat.Detailed;
speechConfig.addTargetLanguage(TargetLanguage);
speechConfig.setProperty(SpeechSDK.PropertyId.SpeechServiceConnection_TranslationVoice, "en-US-JennyNeural");
const audioConfig = SpeechSDK.AudioConfig.fromStreamInput(stream);
const autoDetectSourceLanguageConfig = SpeechSDK.AutoDetectSourceLanguageConfig.fromLanguages(AutoDetectLanguages);
autoDetectSourceLanguageConfig.mode = SpeechSDK.LanguageIdMode.Continuous;
const recognizer = SpeechSDK.TranslationRecognizer.FromConfig(speechConfig, autoDetectSourceLanguageConfig, audioConfig);
recognizer.recognizing = speechRecognizing;
recognizer.recognized = speechRecognized;
recognizer.synthesizing = speechSynthesizing;
In above code, the speechConfig.speechRecognitionLanguage
is not specified. It is throwing error Error: throwIfNullOrUndefined:SpeechServiceConnection_RecoLanguage
at runtime.
Reference the C# code example: the method TranslationWithMultiLingualFileAsync_withLanguageDetectionEnabled
in https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/samples/csharp/sharedcontent/console/translation_samples.cs.
Actually there is no need to specify the speechRecognitionLanguage
property when using AutoDetectSourceLanguageConfig
to auto detect source langauge of speech.
So I found the checking speechRecoginitionLanguage
property condition in source code, and commented out it to make it not throw error when not specify speechRecoginitionLanguage
value. It is works, and the auto detect source language also working.
So I think there is a bug, when using AutoDetectSourceLanguageConfig
for speech to speech translation. There is no need to specify the speechRecoginitionLanguage
value.
JavaScript SDK version:
1.44.1
Platform, Operating System, and Programming Language
- OS: Windows
- Hardware - x64
- Programming language: JavaScript
- Browser Chrome, Edge