Pass the Mic and Record Audio

You don’t need a fancy GUI tool to record audio under Linux. Use SoX’s rec utility to record audio from your microphone—and do it all from the command line.

Some people might wonder, with all the different graphical audio recording tools out there, why you would want to record sound from the command line. Audacity has everything you need to record, edit, and save audio in a nice interface, and I even cover how to use it to record audio in [Hack #34] . Even with these tools available, there are certain advantages to recording audio from the command line. For one, it’s completely scriptable and can be easily scheduled with tools like cron and can be used to create a radio TiVo of sorts. For example, at one point there was a weekly radio show that I sometimes wasn’t home to listen to. I wanted to record the broadcast and listen to it later, so I hooked up my computer microphone input with my radio’s headphone output and left the radio tuned to that channel. Then I set a cron job to turn up my mic volume with aumix [Hack #13] and then run the recording program. This hack tells you how to use the SoX sound sample translator and its included rec frontend to start recording audio with just a few keystrokes.

The SoX sound sample translator is a very powerful audio editing tool. It not only can convert between a number of audio formats, but it can also modify audio input, adding echoes, fade in and out, and other effects. For this hack, I use a frontend included ...

Get Linux Multimedia Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.