I am trying to implement Acoustic Echo Cancellation (AEC) using Microsoft's Speech SDK in C#. I am using AudioProcessingOptions.Create(AudioProcessingConstants.AUDIO_INPUT_PROCESSING_ENABLE_DEFAULT)
to enable audio processing. However, I am encountering the following exception when initializing the SpeechRecognizer
:-
Exception: Exception with an error code: 0x1b (SPXERR_RUNTIME_ERROR)
Code Snippet:
using (var audioProcessingOptions = AudioProcessingOptions.Create(AudioProcessingConstants.AUDIO_INPUT_PROCESSING_ENABLE_DEFAULT))
{
using (var audioConfig = AudioConfig.FromDefaultMicrophoneInput(audioProcessingOptions))
{
try
{
SpeechConfig config1 = SpeechConfig.FromSubscription(HaiStaticData.strSTTVoiceKey, HaiStaticData.strSTTVoiceRegion);
using (SpeechRecognizer recognizer = new SpeechRecognizer(config1, audioConfig)) // Exception occurs here
{
// Recognition logic
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
I suspect the issue might be related to:
- Incorrect use of
AudioProcessingOptions
for enabling AEC.
- Missing or incompatible microphone settings for AEC.
- SDK version compatibility issues.
Questions:
- Is
AudioProcessingConstants.AUDIO_INPUT_PROCESSING_ENABLE_DEFAULT
the correct flag for enabling AEC in Microsoft Speech SDK?
- Are there any specific microphone or hardware requirements for AEC to work properly?
- Could this error be caused by an unsupported SDK version? If so, which version fully supports AEC?
I am using .NETFramework 4.7.2 and Microsoft.CognitiveServices.Speech SDK 1.42.0.
Any guidance or troubleshooting steps would be appreciated.