[Alsa-user] How to capture not muted sound only?
Brought to you by:
perex
From: Alexander K. <ako...@gm...> - 2010-09-28 12:26:41
|
Hi all, could somebody advise on how to omit capturing of a muted sound in the following situation? There's an application that check presence of auto-initiated audio on some web pages. The application prepares environment (creates appropriate ~/.asoundrc file), launches a browser, opens a web page in the browser, waits some time, closes the browser, and checks presence of file with captured audio stream. Here's content of ~/.asoundrc file: pcm.app_writer { type file slave { pcm null } file { @func getenv vars [ APP_AUDIO_FILE ] default "/dev/null" } format "wav" } pcm_slave.app_converter { pcm app_writer format u8 channels 1 rate 100 } pcm.app_transmitter { type plug slave app_converter } pcm.!default { @func refer name { @func concat strings [ "pcm." { @func getenv vars [ ALSA_DEFAULT_PCM ] default null } ] } } Here're CLI commands used to launch the browser: export APP_AUDIO_FILE=/tmp/sound export ALSA_DEFAULT_PCM=app_transmitter firefox <http://...> & And everything works properly... except one thing: in case a muted flash movie is played on web page then the corresponding audio stream is redirected into /tmp/sound as well. (But I'd like to capture not muted sound only). So, is there a way to capture not muted sound only? E.g. (random ideas): a) Modify ~/.asoundrc file so that it doesn't redirect audio stream into APP_AUDIO_FILE in case sound is muted. b) Ask ALSA about current audio settings of flash player before closing the browser. -- Alexander O. Kobernik |