command line tool for recording audio and cutting on the fly
| url: | http://www.linuxquestions.org/questions/linux-newbie-8/command-line-tool-for-recording-audio-and-cutting-on-the-fly-657049/ |
|---|
I actually just discovered today a method that works really well. Try this and let me know if it works for you.
First setup alsamixer to record the Line-In, check your levels and so forth:
arecord -D plughw:0,0 -f S16_LE -c1 -r22050 -t raw | lame -r -s 22.05 -m m -b 64 - FILE.mp3
That particular command will give you a single output mp3 file with 22050 Hz sampling, mono, 64 kbps. You can adjust it to your needs of course, check the man pages for arecord and lame:
mp3splt -s -p th=-30,min=1,rm FILE.mp3
The command above will take the mp3 file and split it into multiple tracks based on a silence threshold (th) of -30 dB, a minimum (min) silence duration of 1 second, and remove (rm) the silence from the split tracks.
You'll end up with a directory full of Track **.mp3 files. Then remove or rename any other files in the directory and do the following:
mpgjoin *.mp3 -o JOINED.mp3
This has been working for me on the tests I've performed so far. Hopefully this helps someone, because I've searched high and low for many months and came to the conclusion that there is about 5 of us in the English speaking world that want to do this, and none of us could figure out a way of doing it.
Also, I just wanted to point out that you can limit the recording to a certain amount of time by adding "-d xxx" to the arecord line, where "xxx" is the duration in seconds:
arecord -D plughw:0,0 -f S16_LE -c1 -r22050 -t raw -d 1800 | lame -r -s 22.05 -m m -b 64 - output.mp3
That would record for 30 minutes.
This can also be cron jobbed.
