[alsa-devel] [PoC] ahwmon: alsa "hw" what-you-hear recorder

Takashi Iwai tiwai at suse.de
Thu Jan 21 12:57:36 CET 2016


On Tue, 12 Jan 2016 03:21:16 +0100,
Sergey wrote:
> 
> Hello.
> 
> I needed a tool to test if anything loud is playing right now. So I wrote
> "ahwmon" - alsa hw monitoring tool. It's based on dmix idea: it gets "hw"
> shared playback buffer, but reads from the buffer instead of writing.
> 
> Code is mostly copied from alsa-lib, but it uses kernel /dev/snd/pcm*
> files directly and doesn't depend on alsa-lib or dmix. May work for
> other apps playing to "hw", including pulseaudio and jackd.
> 
> What do you think about it? Can something like this get into alsa-lib or
> alsa-utils or alsa-plugins? It could be a capture side of "dmix" plugin,
> which has no capture now. Maybe someone with strong dmix knowledge
> can port it to dmix?

This is an interesting idea.  I like the simplicity of your method,
despite the known limitations.  I suppose it can be well implemented
as a normal alsa-lib plugin?


thanks,

Takashi

> 
> Build:
>   gcc -o ahwmon ahwmon.c
> 
> Usage:
>   ./ahwmon [-v] [-v] <card_index> <device_index> [<subdevice_index>]
> subdevice 0 is used by default
> it outputs .wav stream to stdout
> 
> Use cases:
> * Card VUmeter:
>   ./ahwmon 0 0 | aplay -V stereo -D null
> * Dump what you hear:
>   ./ahwmon 0 0 > audiodump.wav
> * Duplicate output of one card to another:
>   ./ahwmon 0 0 | aplay -D plughw:1,0
> * Stream what you hear to another pc:
>   ./ahwmon 0 0 | nc 192.168.1.10 12345
> 
> Known limitations:
> * supports S16_LE and S32_LE only.
> * breaks clients attempting to close and reopen "hw"
> 
> Any ideas are welcome!
> -- 
>   Sergey


More information about the Alsa-devel mailing list