Alsa-Devel Archive on lore.kernel.org
 help / color / Atom feed
* Discover a microphone device, to later discover if it is receiving input
@ 2020-10-04 16:22 info
  2020-10-04 21:17 ` Dead link in wiki under Tutorials info
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: info @ 2020-10-04 16:22 UTC (permalink / raw)
  To: alsa-devel

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Dead link in wiki under Tutorials
  2020-10-04 16:22 Discover a microphone device, to later discover if it is receiving input info
@ 2020-10-04 21:17 ` info
  2020-10-16 17:33   ` info
  2020-10-09 12:39 ` Discover a microphone device, to later discover if it is receiving input info
  2020-10-09 15:35 ` Takashi Iwai
  2 siblings, 1 reply; 7+ messages in thread
From: info @ 2020-10-04 21:17 UTC (permalink / raw)
  To: alsa-devel

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discover a microphone device, to later discover if it is receiving input
  2020-10-04 16:22 Discover a microphone device, to later discover if it is receiving input info
  2020-10-04 21:17 ` Dead link in wiki under Tutorials info
@ 2020-10-09 12:39 ` info
  2020-10-09 14:07   ` Jaroslav Kysela
  2020-10-09 15:35 ` Takashi Iwai
  2 siblings, 1 reply; 7+ messages in thread
From: info @ 2020-10-09 12:39 UTC (permalink / raw)
  To: alsa-devel

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
>
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discover a microphone device, to later discover if it is receiving input
  2020-10-09 12:39 ` Discover a microphone device, to later discover if it is receiving input info
@ 2020-10-09 14:07   ` Jaroslav Kysela
  0 siblings, 0 replies; 7+ messages in thread
From: Jaroslav Kysela @ 2020-10-09 14:07 UTC (permalink / raw)
  To: info, alsa-devel

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
>>
>>
> 
> 


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discover a microphone device, to later discover if it is receiving input
  2020-10-04 16:22 Discover a microphone device, to later discover if it is receiving input info
  2020-10-04 21:17 ` Dead link in wiki under Tutorials info
  2020-10-09 12:39 ` Discover a microphone device, to later discover if it is receiving input info
@ 2020-10-09 15:35 ` Takashi Iwai
  2020-10-09 16:11   ` info
  2 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2020-10-09 15:35 UTC (permalink / raw)
  To: info; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Discover a microphone device, to later discover if it is receiving input
  2020-10-09 15:35 ` Takashi Iwai
@ 2020-10-09 16:11   ` info
  0 siblings, 0 replies; 7+ messages in thread
From: info @ 2020-10-09 16:11 UTC (permalink / raw)
  Cc: alsa-devel

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
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dead link in wiki under Tutorials
  2020-10-04 21:17 ` Dead link in wiki under Tutorials info
@ 2020-10-16 17:33   ` info
  0 siblings, 0 replies; 7+ messages in thread
From: info @ 2020-10-16 17:33 UTC (permalink / raw)
  To: alsa-devel

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
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 16:22 Discover a microphone device, to later discover if it is receiving input info
2020-10-04 21:17 ` Dead link in wiki under Tutorials info
2020-10-16 17:33   ` info
2020-10-09 12:39 ` Discover a microphone device, to later discover if it is receiving input info
2020-10-09 14:07   ` Jaroslav Kysela
2020-10-09 15:35 ` Takashi Iwai
2020-10-09 16:11   ` info

Alsa-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \
		alsa-devel@alsa-project.org
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git