Closed belaoud001 closed 2 months ago
Hi, FromOpenRange()
cannot be used with SpeechRecognizer
(and there is no plan add support). Please see API documentation:
Only SpeechSynthesizer and embedded speech translation can detect the source language automatically.
Hey there!
I’m trying to set up automatic language detection with the FromOpenRange() function because I’d prefer not to list every language manually with the FromLanguages() method. However, I keep running into this snag where it throws an error at me, insisting that I should use FromLanguages() instead.
I have a feeling I’m missing a crucial piece of the puzzle here, which is why I’m turning to you for some guidance. Any insights would be greatly appreciated.
Thanks a bunch!
` var speechConfig = ConfigureSpeechRecognition(); var autoDetectSourceLanguageConfig = AutoDetectSourceLanguageConfig.FromOpenRange(); var audioInputStream = CreateAudioInputStream(stream); var stopRecognition = new TaskCompletionSource();
using (var audioConfig = AudioConfig.FromStreamInput(audioInputStream)) { using (var speechRecognizer = new SpeechRecognizer(speechConfig, autoDetectSourceLanguageConfig, audioConfig)) `