Discover a microphone device, to later discover if it is receiving input
Hi all,
I am writing a program that aims to auto-discover the microphone device that the user is speaking into. I started off by querying device hints and collected all devices with the IO types of null, since I have not found any devices with the type of Input. I am puzzled how it is possible that there is no Input, where a microphone device should not be able to emit sound. This is the list on my particular machine:
Name of device: sysdefault:CARD=SB Description of device: HDA ATI SB, ALC892 Analog Default Audio Device I/O type of device: (null)
Name of device: front:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog Front speakers I/O type of device: (null)
Name of device: surround21:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 2.1 Surround output to Front and Subwoofer speakers I/O type of device: Output
Name of device: surround41:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 4.1 Surround output to Front, Rear and Subwoofer speakers I/O type of device: Output
Name of device: surround50:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 5.0 Surround output to Front, Center and Rear speakers I/O type of device: Output
Name of device: surround71:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers I/O type of device: Output
Name of device: sysdefault:CARD=SB Description of device: HDA ATI SB, ALC892 Analog Default Audio Device I/O type of device: (null)
Name of device: front:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog Front speakers I/O type of device: (null)
Now, I am more puzzled, because none of them is a microphone device explicitly. How can my program determine which of them is actually a microphone?
Also, why are devices are duplicated in the output from snd_device_name_hint()? The very first device is also repeated as the 2nd last one...
Regards, Alex
On the page https://www.alsa-project.org/wiki/Tutorials_and_Presentations there are dead links.
ALSA 0.9.0 HOWTO http://www.suse.de/%7Emana/alsa090_howto.html - Dr Matthias Nagorni has writen a comprehensive tutorial for audio application developers. is dead. The article has been removed.
Howto use the ALSA API http://equalarea.com/paul/alsa-audio.html - Paul Davis has also written a brief explanation. is dead. His site has been removed from the hosting site.
ALSA Sequencer (draft) http://www.alsa-project.org/%7Efrank/alsa-sequencer/ - Frank van de Pol's draft on programming the alsa sequencer. is dead, 404 error.
Kernel OSS-Emulation http://www.alsa-project.org/%7Eiwai/OSS-Emulation.html - Takashi Iwai has written some notes on how ALSA handles OSS applications. is dead, 404 error.
It is worth trying to restore them because there are very few resources on ALSA programming.
Regards Alex
There seems to be zero interest in restoring the tutorials, even though only 1 tutorial link works. I totally get it that it may be hard for you to reach out to the authors of external material on dead web sites. But you should have not so much difficulty restoring those 404 pages that link back to your own wiki. Could you?
Thanks Alex
On 2020-10-04 05:17 PM, info wrote:
On the page https://www.alsa-project.org/wiki/Tutorials_and_Presentations there are dead links.
ALSA 0.9.0 HOWTO http://www.suse.de/%7Emana/alsa090_howto.html - Dr Matthias Nagorni has writen a comprehensive tutorial for audio application developers. is dead. The article has been removed.
Howto use the ALSA API http://equalarea.com/paul/alsa-audio.html - Paul Davis has also written a brief explanation. is dead. His site has been removed from the hosting site.
ALSA Sequencer (draft) http://www.alsa-project.org/%7Efrank/alsa-sequencer/ - Frank van de Pol's draft on programming the alsa sequencer. is dead, 404 error.
Kernel OSS-Emulation http://www.alsa-project.org/%7Eiwai/OSS-Emulation.html - Takashi Iwai has written some notes on how ALSA handles OSS applications. is dead, 404 error.
It is worth trying to restore them because there are very few resources on ALSA programming.
Regards Alex
Can maintainers of this list please give a straight answer: is asking questions and leaving comments here a waste of time?
On 2020-10-04 12:22 PM, info wrote:
Hi all,
I am writing a program that aims to auto-discover the microphone device that the user is speaking into. I started off by querying device hints and collected all devices with the IO types of null, since I have not found any devices with the type of Input. I am puzzled how it is possible that there is no Input, where a microphone device should not be able to emit sound. This is the list on my particular machine:
Name of device: sysdefault:CARD=SB Description of device: HDA ATI SB, ALC892 Analog Default Audio Device I/O type of device: (null)
Name of device: front:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog Front speakers I/O type of device: (null)
Name of device: surround21:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 2.1 Surround output to Front and Subwoofer speakers I/O type of device: Output
Name of device: surround41:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 4.1 Surround output to Front, Rear and Subwoofer speakers I/O type of device: Output
Name of device: surround50:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 5.0 Surround output to Front, Center and Rear speakers I/O type of device: Output
Name of device: surround71:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers I/O type of device: Output
Name of device: sysdefault:CARD=SB Description of device: HDA ATI SB, ALC892 Analog Default Audio Device I/O type of device: (null)
Name of device: front:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog Front speakers I/O type of device: (null)
Now, I am more puzzled, because none of them is a microphone device explicitly. How can my program determine which of them is actually a microphone?
Also, why are devices are duplicated in the output from snd_device_name_hint()? The very first device is also repeated as the 2nd last one...
Regards, Alex
Dne 09. 10. 20 v 14:39 info napsal(a):
Can maintainers of this list please give a straight answer: is asking questions and leaving comments here a waste of time?
Unfortunately, the hint list does not give information about the connected mixer outputs or inputs. It's just a list of available PCM devices in the system.
If the I/O type is (null) it means that both directions may be available.
We have better device enumeration in UCM (Use Case Manager) by the use, but the configurations are not available for all hardware yet.
BTW: Your e-mail header (From:) and signature does not seem trustly.
Jaroslav
On 2020-10-04 12:22 PM, info wrote:
Hi all,
I am writing a program that aims to auto-discover the microphone device that the user is speaking into. I started off by querying device hints and collected all devices with the IO types of null, since I have not found any devices with the type of Input. I am puzzled how it is possible that there is no Input, where a microphone device should not be able to emit sound. This is the list on my particular machine:
Name of device: sysdefault:CARD=SB Description of device: HDA ATI SB, ALC892 Analog Default Audio Device I/O type of device: (null)
Name of device: front:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog Front speakers I/O type of device: (null)
Name of device: surround21:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 2.1 Surround output to Front and Subwoofer speakers I/O type of device: Output
Name of device: surround41:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 4.1 Surround output to Front, Rear and Subwoofer speakers I/O type of device: Output
Name of device: surround50:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 5.0 Surround output to Front, Center and Rear speakers I/O type of device: Output
Name of device: surround71:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers I/O type of device: Output
Name of device: sysdefault:CARD=SB Description of device: HDA ATI SB, ALC892 Analog Default Audio Device I/O type of device: (null)
Name of device: front:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog Front speakers I/O type of device: (null)
Now, I am more puzzled, because none of them is a microphone device explicitly. How can my program determine which of them is actually a microphone?
Also, why are devices are duplicated in the output from snd_device_name_hint()? The very first device is also repeated as the 2nd last one...
Regards, Alex
On Sun, 04 Oct 2020 18:22:43 +0200, info wrote:
Hi all,
I am writing a program that aims to auto-discover the microphone device that the user is speaking into. I started off by querying device hints and collected all devices with the IO types of null, since I have not found any devices with the type of Input. I am puzzled how it is possible that there is no Input, where a microphone device should not be able to emit sound. This is the list on my particular machine:
Name of device: sysdefault:CARD=SB Description of device: HDA ATI SB, ALC892 Analog Default Audio Device I/O type of device: (null)
Name of device: front:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog Front speakers I/O type of device: (null)
Name of device: surround21:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 2.1 Surround output to Front and Subwoofer speakers I/O type of device: Output
Name of device: surround41:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 4.1 Surround output to Front, Rear and Subwoofer speakers I/O type of device: Output
Name of device: surround50:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 5.0 Surround output to Front, Center and Rear speakers I/O type of device: Output
Name of device: surround71:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers I/O type of device: Output
Name of device: sysdefault:CARD=SB Description of device: HDA ATI SB, ALC892 Analog Default Audio Device I/O type of device: (null)
Name of device: front:CARD=SB,DEV=0 Description of device: HDA ATI SB, ALC892 Analog Front speakers I/O type of device: (null)
Now, I am more puzzled, because none of them is a microphone device explicitly. How can my program determine which of them is actually a microphone?
Also, why are devices are duplicated in the output from snd_device_name_hint()? The very first device is also repeated as the 2nd last one...
Apart from the lack of the Input direction (maybe a bug in the hint code), the fundamental problem is that the driver cannot tell always the device type at all for each PCM stream. It's simply because a stream may give you any input type depending on the mixer route; it's the case of HD-audio. So, the same PCM device may be a mic, or a headset mic, or a line-in, or whatever.
Sometimes there are dedicated PCM devices for certain inputs, but most of the PCM streams are generic purpose.
Takashi
When Audacity uses ALSA, it somehow knows that something is a front mic. In the total absence of documentation that I noted in my other email, how can I replicate this behaviour? I do not insist on using hints. They were just mentioned somewhere on the Net. I am agreeable to use any methods in ALSA API to discover the mic, but w/o documentation, I have no way of knowing what it is, short of reverse engineering your library. Is this the way you envisioned adoption of ALSA: everyone is supposed to reverse-engineer?
Regards Alex
On 2020-10-09 11:35 AM, Takashi Iwai wrote:
Apart from the lack of the Input direction (maybe a bug in the hint code), the fundamental problem is that the driver cannot tell always the device type at all for each PCM stream. It's simply because a stream may give you any input type depending on the mixer route; it's the case of HD-audio. So, the same PCM device may be a mic, or a headset mic, or a line-in, or whatever.
Sometimes there are dedicated PCM devices for certain inputs, but most of the PCM streams are generic purpose.
Takashi
participants (3)
-
info
-
Jaroslav Kysela
-
Takashi Iwai