13 November 2008

ALSA record output to file

In ~/.asoundrc


pcm.!default {
type file
slave.pcm {
type plug
slave.pcm {
type hw
card 0
device 0
subdevice -1
}
}
file /dev/shm/audio.raw
format raw
}


Note the file it's been recorded to is in RAM to make things faster.
You can convert the raw audio to mp3 file with the following:

ffmpeg -ac 2 -f s16le -i /dev/shm/audio.raw -acodec mp3 -ab 192k output.mp3

No comments: