You are hereListen to /dev/dsp and record to MP3 when there is some sound to record

Listen to /dev/dsp and record to MP3 when there is some sound to record


By dgtlmoon - Posted on 04 October 2006

Something I wrote for a small project, initially designed to listen my radio scanner via /dev/dsp and record when it hears something, this uses python and some threads to launch instances of 'lame' encoder and then insert them into MySQL.

The app has a threshold for incomming sound levels and starts recording when the threshold is reached, there is also a setting for time-distance between hearing things so you dont end up a billion little mp3s because the audio is dropping out, just a nice long mp3.

'lame' is configured to convert the raw audio from /dev/dsp to extremly lo-fi (about telephone quality) and then the handler thread inserts that binary into the mysql table for future reference. CPU usage is really good at abuot 1% on my 1.4ghz laptop plus what ever overhead lame requires which is not much for my default settings (around abuot telephone quality)

Get the audio sampling script here, you'll have to tune the DB and 'lame' settings and create a DB schema that suits your needs but should be reliable anyway
Your rating: None