First install libsndfile! http://www.mega-nerd.com/libsndfile/
Then:

make install

Then run 'setlistener' with as parameter the device to listen to.
setlistener /dev/dsp

Then, with the left and right arrow keys, move the '|' until the
word "<silence>" appears. No, don't you move the '|' to the maximum
right, move it to the right until the "<silence>" just constantly
appears. Then: remember the value "Current level: ".

Next step is creating the file /etc/listener.conf
Copy the example listener.conf to the location mentioned above and
edit it to suit your needs.
For example:

wav_path = /home/folkert/recordings
devname = /dev/dsp
detect_level = 800
min_duration = 1
rec_silence = 5
sample_rate = 44100
compression = ima-adpcm
exec = /home/folkert/encode_sample

sample_rate sets the samplerate at which the samples are recorded.
Be warned: only the levels supported by your soundcard can be
entered here!

rec_silence sets the number of seconds to keep on recording when
no sound is detected. if during those 5 seconds sound is detected
again, the timer is restarted.

min_duration sets how many samples must be above the threshold (the
'detect_level') before recording starts.
The samplerate is set to 44.1kHz so if you set min_duration to
4410, the minimum length (duration) of sound before the recording
starts is: 0.1s (or: one tenth of a second).

compression sets the compressionmethod. Can be:
u-law, a-law, ima-adpcm, ms-adpcm, gsm-6.10
If you omit the compression-line completely, no compression is
used.

exec selects the script/program to execute after the sample was
recorded. This first (and only) parameter for that script is the
filename of the sample.

The final step is starting the program:
listener
and that's it!


If you have any suggestions or anything else, do not hesitate
to contact me at the following e-mail address:
folkert@vanheusden.com
