[lug] sound recording roadblocks and solutions

Neal McBurnett nealmcb at avaya.com
Tue Sep 5 20:48:38 MDT 2000

I'm amazed at how hard it has been to find a way to record audio
in linux.  So I started writing a question to the lug.  As
so often happens, the process of writing good questions resulted
in figuring out most of the answers I was looking for.

I'm currently running redhat 6.1.  [Yeah, I'll upgrade to 6.2
when I free up some disk space - sigh]

The sound howto says to just cat /dev/audio to a file.  This
results in files that are very small, and which can be played back by
catting back to /dev/audio, but which other recommended tools (see
below) can't seem to handle at all.  I can't figure out what
the sampling rate or bits/sample are, they seem to be even less that
8000 Hz, 8 bits/sample.

The sound howto (March 1999) also suggests a tool called "vrec" which
is not part of my redhat 6.1 system.  No package of that name is
visible anywhere and we searches with google haven't led me to any
code (just some old man pages), so I'm guessing it is in some other
package or is obsolete.

Downloading krecord sends me on another unsuccessful search for

Ah - so the sound howto is out of date - clearly.  Yeah - I know,
keeping things up to date is a pain, and I do appreciate all the good
stuff in there....  Perhaps copying this to the maintainer will help.

Thankfully, a more up-to-date faq with relevant info is the mp3 howto.

This, along with my experimentation, suggests that the good tools are
rawrec or wavplay/wavrec for getting input from the hardware in WAV
format, lame (for creating mp3's from .wav files), and aumix (for
setting record and playback volumes and balance.  Aumix is more
capable and flexible than xmixer).  Wavrec and xmixer are part of my
redhat distribution.

Lame is much faster than bladeenc and doesn't have problems with
mono inputs.

So this works well for recording a mono input to my "line in"
and putting it in file.mp3:
	rawrec -c 1 | lame -x -m m - file.mp3

and this should do the stereo case:
	rawrec | lame -x - file.mp3

The lame encoding records at about twice real-time at this speed
on my pentium 266, so this works great.  And it results in about
1/2 MB/minute, producing good audio quality, which isn't bad at all.

Waverec really really wants to write to a file, and even a pipe
doesn't work (it tries to seek on it for some odd reason).  I
didn't need the "-x" option to lame when using wavrec.

Hopefully this will help someone out there....


Neal McBurnett <neal at bcn.boulder.co.us>  303-538-4852
Avaya Communication / Internet2 / Bell Labs / Lucent Technologies
http://bcn.boulder.co.us/~neal/      (with PGP key)

More information about the LUG mailing list