I am attempting to invoke a bash action triggered by audio input. A very simple sound detection sensor (no record) with adjustable threshold utilizing a pc's onboard audio chipset and audio microphone would do the trick, something like the perl script at http://photodoto.com/index.php/2008/02/25/tethered-shooting-with-linux/ Nothing against perl, but I am hoping to eventually use this on a resource challenged hardware setup, so keeping things as close to the kernel and bash as possible is imperative. Along those lines, solutions using ALSA and OSS are also out of the mix. Is it possible to make use of proc and/or device nodes via bash to accomplish this task? Thanks for any enlightenment.
2 Answers
Not unless someone does a binary extension to bash
to configure the audio device... that requires both the ability to handle random binary data and the ability to issue audio-device-specific ioctl()
calls.
-
dd bs=8k count=4 </dev/audio >testing-mic.raw
records 32768 bytes of audio– cdaaawgCommented Apr 16, 2012 at 2:32 -
@cdaaawg, it does, at some default format/bit rate that you cannot control, and using that audio as a trigger (as per the OP's question) would be difficult from the shell. Commented Apr 16, 2012 at 2:35
dd bs=8k count=4 </dev/audio >testing-mic.raw
records 32768 bytes of audio, while cat testing-mic.raw >/dev/audio
will playback that recorded audio. I am unsure of how to handle that raw audio file to get a baseline out of it though