cognitive-services-speech-sdk: auto-discovery for input device fails on some linux systems
Mic not found
Exception with an error code: 0xe (SPXERR_MIC_NOT_AVAILABLE)
The SpeechSDK generally works with Arch Linux and Pipewire. However, I encountered an issue where the auto-discovery feature didn’t detect my microphone (SPXERR_MIC_NOT_AVAILABLE). On the same computer it is working with ubuntu(23.10) also with pipewire.
Example: https://gist.github.com/drmaniac/23a4faf462caabd57f0175f281739ada lines 25-26
This is related to microsoft/vscode#205758
Expected behavior I would expect that auto-discovery on linux is more robust.
Version of the Cognitive Services Speech SDK
SpeechSDK-Linux-1.36.0
Platform, Operating System, and Programming Language
- OS: Linux (arch fully patched)
- Hardware - x64
- Programming language: C++
Additional context
terminate called after throwing an instance of 'std::runtime_error'
what(): Exception with an error code: 0xe (SPXERR_MIC_NOT_AVAILABLE)
[CALL STACK BEGIN]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.extension.audio.sys.so(+0xe1e9) [0x7b100da0e1e9]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x1e60ed) [0x7b100fde60ed]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x1010f4) [0x7b100fd010f4]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x1a8613) [0x7b100fda8613]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0xf2841) [0x7b100fcf2841]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x1e60ed) [0x7b100fde60ed]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x1010f4) [0x7b100fd010f4]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x195f5c) [0x7b100fd95f5c]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x19babf) [0x7b100fd9babf]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x133cef) [0x7b100fd33cef]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x133cef) [0x7b100fd33cef]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x187563) [0x7b100fd87563]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x140af9) [0x7b100fd40af9]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x1f9508) [0x7b100fdf9508]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x13e585) [0x7b100fd3e585]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(+0x216e34) [0x7b100fe16e34]
/home/christian/git/test/SpeechSDK-Linux-1.36.0/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so(recognizer_create_speech_recognizer_from_config+0x10b) [0x7b100fcbe8fd]
[CALL STACK END]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (7 by maintainers)
@drmaniac Many thanks for testing this. Based on your results so far it seems the change is good. So if there are no further updates, we’ll include it in the next Speech SDK release (1.37.0).
I played a little bit.
It looks like AudioConfig::FromDefaultMicrophoneInput() might not always correctly detect the default device. Using AudioConfig::FromMicrophoneInput(“default”) seems to work reliably. I confirmed this behavior by changing my default microphone settings in GNOME.
Also my test with
snd_pcm_open(&capture_handle, "default", SND_PCM_STREAM_CAPTURE, 0)have the same working behavior.So maybe it’s only a missing documentation which seams to cause so many confusions.
As far as I see arecord does the same with the ‘default’ string https://git.alsa-project.org/?p=alsa-utils.git;a=blob;f=aplay/aplay.c
@pankopon To answer your question more specifically, WirePlumber sets the default audio alsa device dynamically, so there is a default device but not in any configuration file.
Edit: I installed a older Ubuntu 20.04 in a vbox and tested the AudioConfig with the “default” string. It works also on non pipewire enabled systems.