After I got sound playing to work, as described in my previous tech note, I decided it was time to record a sound sample. After a bit of poking around the ALSA project web site for a while, I decided that I would attempt to do this using the package 'ecasound', which claims to have ALSA v0.5 compatibility, along with a large list of features.

I downloaded the latest stable version (ecasound v1.6.12r10 at the time of this writing) from the ecasound site. I first tried to install from the source rpm, but that failed. I then tried to install the binary rpm, but that failed. As a last resort, I decided to download the .tar.gz source bundle to my home directory. Here is how I built and installed it (as user root):

cd /home/jason
tar zxf ecasound-1.6.12r10.tar.gz
cd ecasound-1.6.12r10/
./configure --disable-qt
make ; make install

I chose the '--disable-qt' option because I do not have the QT graphical libraries installed, and I didn't want to have to install them to get a sound recording program up and running. This build worked without any problems. I think that it was important that I had the ALSA stuff fully installed and working before I even tried this. In either case, the next step was to setup the mixer to allow input from my microphone.

I actually use the 'gamixer' package to futz with the mixer settings, but I'll give the output of the 'amixer' command below because it's part of the ALSA sound utilities that you would have to have installed already if you got this far. I won't list all of the output, but here are the important mixer settings:

Group 'Input Gain',0
  Capabilities: volume mute jointly-mute
  Channels: Front-Left Front-Right
  Limits: min = 0, max = 15
  Front-Left: 12 [80%] [on] [---]
  Front-Right: 12 [80%] [on] [---]
Group 'Master',0
  Capabilities: volume mute capture exclusive-capture
  Capture exclusive group: 1
  Channels: Front-Left Front-Right Rear-Left Rear-Right
  Limits: min = 0, max = 31
  Front-Left: 19 [61%] [on] [---]
  Front-Right: 19 [61%] [on] [---]
  Rear-Left: 31 [100%] [on] [---]
  Rear-Right: 31 [100%] [on] [---]
Group 'MIC',0
  Capabilities: volume mute capture exclusive-capture
  Capture exclusive group: 1
  Channels: Front-Left Front-Right
  Limits: min = 0, max = 31
  Front-Left: 1 [3%] [on] [capture]
  Front-Right: 1 [3%] [on] [capture]
Group 'PCM',0
  Capabilities: volume mute jointly-mute
  Channels: Front-Left Front-Right
  Limits: min = 0, max = 31
  Front-Left: 29 [94%] [on] [---]
  Front-Right: 29 [94%] [on] [---]
To get these settings, you could issue the following commands from the command line (you don't have to be user 'root' to do this):
amixer set MIC unmute capture 29
amixer set 'Input Gain' unmute 12
amixer set PCM unmute 29
amixer set Master unmute 19

The first command unmutes the Microphone. The second command set the input gain to a reasonable level. The last two commands turn on sound output for playback. These probably are not optimal settings, but they did work. The next step is to actually record a sound!

Assuming your 'ecasound' installation went off without a problem, you can start recording with the following command (again, you don't have to do this one as 'root'):

ecasound -i alsa,0,0 -o somefile.wav

This command tells ecasound to use the ALSA API, with card 0, device 0, and to send the output to a file called 'somefile.wav'. When you issue this command, you'll see a output that looks like this:

[jason@taylor:~]$ ecasound -i alsa,0,0 -o somefile.wav ****************************************************************************
* ecasound v1.6.12r10 (C) 1997-2000 Kai Vehmanen *
****************************************************************************

- [ Eca-audio-objects/Adding a new input ] ---------------------------------
(audioio-alsa) Loading libasound shared library.
(eca-audio-objects) Added audio object "alsa,0,0,-1", mode "read".
(audio-io) Format s16_le, channels 2, srate 44100.
(eca-chainsetup) Assigning file to chains: default
- [ Eca-audio-objects/Adding a new output ] --------------------------------
(eca-audio-objects) Added audio object "somefile.wav", mode "read/write".
(audio-io) Format s16_le, channels 2, srate 44100.
(eca-chainsetup) Assigning file to chains: default
- [ Engine/Initializing ] --------------------------------------------------
- [ Engine/Mixmode "simple passive" selected ] -----------------------------

When you see that last line, ecasound is now recording audio. Say something cleve into the microphone (like "Ass Monkeys"). When you're done recording, press CTRL-C to finish the recording session. You will now find a file named 'somefile.wav' sitting in the current directory (I did it in my home directory). To play the file back through your ALSA drivers, you can use this command:

ecasound -i somefile.wav -o alsa,0,0
You should see output that looks like this:
****************************************************************************
* ecasound v1.6.12r10 (C) 1997-2000 Kai Vehmanen *
****************************************************************************

- [ Eca-audio-objects/Adding a new input ] ---------------------------------
(eca-audio-objects) Added audio object "somefile.wav", mode "read".
(audio-io) Format s16_le, channels 2, srate 44100.
(eca-chainsetup) Assigning file to chains: default
- [ Eca-audio-objects/Adding a new output ] --------------------------------
(audioio-alsa) Loading libasound shared library.
(eca-audio-objects) Added audio object "alsa,0,0,-1", mode "write".
(audio-io) Format s16_le, channels 2, srate 44100.
(eca-chainsetup) Assigning file to chains: default
- [ Engine/Initializing ] --------------------------------------------------
- [ Engine/Mixmode "simple passive" selected ] -----------------------------
- [ Engine/Exiting ] -------------------------------------------------------
(audioio-alsa2) WARNING! While writing to ALSA-pcm device C0D0, there were 1 underruns.
- [ Closing session ] ------------------------------------------------------

I'm note sure about why that warning message is generated, but the sound output sounds GREAT, and everything seems to work just fine. So there you go.