From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PoC] ahwmon: alsa "hw" what-you-hear recorder Date: Thu, 21 Jan 2016 12:57:36 +0100 Message-ID: References: <1452565276.581630768@f237.i.mail.ru> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id CE518260544 for ; Thu, 21 Jan 2016 12:57:38 +0100 (CET) In-Reply-To: <1452565276.581630768@f237.i.mail.ru> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Sergey Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org 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] [] > 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