Linux ALSA Recording Very Mini HOWTO

This is the information that I wished that I had had earlier this morning. The object of the exercise was to create an mp3 file by talking into my Logitech USB headset.

  1. Have a working ALSA audio system – mine uses standard Gentoo ebuilds.
  2. Find out what device your headset is – with USB this can vary session to session unless you do some clever stuff with udev: arecord -l. My headset was Card 2, subdevice #0.
  3. Do the recording: arecord -f cd -D plughw:2,0 -t raw | lame -x - foo.mp3 …where plughw:2,0 is Card 2, subdevice #0.
  4. Use CTL-C to stop the recording.
  5. Play back foo.mp3 to make sure that it worked.

For more details use man arecord, remember that Google Is Your Friend, and visit the ALSA Web Site.

I have used this method to provide an audio transcript of this article (size: 1.9Mb).