Independent ALSA and linux audio support site


From the ALSA wiki

Jump to: navigation, search




Configure build environment

Create a directory, copy and unpack source:

mkdir /usr/src/alsa-0.9.0rc2/
ln -s /usr/src/alsa-0.9.0rc2/ /usr/src/alsa
cp /directory/where/you/put/alsa-*.bz2 /usr/src/alsa
cd /usr/src/alsa
bunzip2 -v alsa-*.bz2
tar -xvf alsa-lib-0.9.0rc2.tar
tar -xvf alsa-utils-0.9.0rc2.tar
tar -xvf alsa-driver-0.9.0rc2.tar

Make sure "make install" can find I am using the Debian make-kpkg system for compiling and installing my kernels. It does not leave in the kernel source directory. It was necessary for me to create two symlinks in order for the alsa-driver "make install" procedure to find my

cd /boot
ln -s`uname -r`
cd /usr/src/linux/
ln -s /boot/

Before I made these links "make install" for the drivers would fail at the depmod stage with an error like this (with `uname -r` here standing in for the current running kernel):

depmod -a -F /lib/modules/`uname -r`/build/ `uname -r`
depmod: Can't read /lib/modules/`uname -r`/build/

I don't think this step is needed if you compiled your kernel with the more traditional "make dep; make clean; make bzImage; make install; make modules; make modules_install" chain of commands.

Compile and install alsa-drivers

cd /usr/src/alsa/alsa-driver-0.9.0rc2

Read the INSTALL file. Make sure your kernel has sound support turned on. You also need to have your configured kernel sources installed. If you want to pass some options to configure, ./configure --help will show you what's available. I chose to use the defaults:


Build the modules and install them in /lib/modules/`uname -r`/kernel/sound/:

make install

Create device nodes in /dev/snd/. (Actually, links to /proc/asound/dev/:


The INSTALL file tells you to edit /etc/modules.conf. On Debian this file is generated by the update-modules utility based on files in /etc/modutils/. I added the following lines to /etc/modutils/aliases then ran update-modules:

alias char-major-116 snd
alias snd-card-0 snd-ymfpci

Load the modules into the running kernel:

depmod snd-ymfpci

Compile and install alsa-lib

This is necessary in order to build and install the alsa-utils.

cd /usr/src/alsa/alsa-lib-0.9.0rc2
make install

Compile and install alsa-utils

Alsa-utils includes alsactl, alsamixer, amixer and aplay. They are useful tools for testing and working with your soundcard.

cd /usr/src/alsa/alsa-lib-0.9.0rc2
make install

Testing record and playback

I tested recording first through a cheap microphone that plugs directly into the mic input with a mini-jack and then with a hand-held cassette recorder/player plugged into the line input via a mini-jack patch cable. I also tested playback.

Start alsamixer:


Prepare the soundcard for recording from the microphone:

Alsamixer displays an ncurses interface to the various devices within the soundcard. You can select devices using the left and right arrow keys or n and p for (n)ext and (p)revious. Level for the selected device can be adjusted with the up and down arrow keys or w and x. Mute status can be toggled with the m key. Capture status can be toggled with the space bar.

All devices were muted the levels set to zero. Then 'Capture' and 'ADC' were unmuted and turned all the way up.

Added by jago25_[email protected] -

(Line in port capture works but I am unable to get the Mic in port to capture. Need fuller/cleaner explaination of what does what)

Test recording:

arecord -d 30 -f cd -t wav test.wav

This records a file named test.wav of (t)ype wav in cd (f)ormat for a (d)uration of 30 seconds.

Prepare the soundcard for playback:

Except for Master, PCM and Wave, I muted, turned off capture and set the level to zero for all devices. Master, PCM and Wave were unmuted and set to the maximum "green" level.

Test playback:

aplay -f cd test.wav

Prepare the soundcard for duplex recording from line input:

Except for Master, PCM, Capture and ADC, I muted, turned off capture and set the level to zero for all devices. Master, PCM and Wave were unmuted and set to the maximum "green" level. This allows the input to play through the speakers while it is recording.

arecord -d 30 -f cd -t wav testline.wav

Set up the soundcard and test playback the same way as above.

Storing and restoring mixer settings

alsactl allows you to store the current mixer settings to a file and then restore those settings at a later time. For each mixer scenario described above you can store the settings in a file and then use that file to set the soundcard:

Set the devices via alsamixer for recording from the mic as described above.

alsactl -f micrecord.conf store

Set the devices via alsamixer for recording from line input as descrbed above.

alsactl -f linerecord.conf store

Set the devices via alsamixer for playback as described above.

alsactl -f micrecord.conf store

Then you can switch between the different scenarios without using alsamixer:

alsactl -f foo.conf restore

Set default levels to be used on boot up:

alsactl store

See the .asoundrc Wiki page for more info about ALSA configuration.


The Gentoo Linux Distribution also has good help for installing and setting up Alsa on thier website:

Top of website, -> Documentation -> Desktop Configuration Guide -> Alsa

Low latency ymfpci cards

and generally do anything useful you need to set the period size. For example:

jackd -d alsa -d default -r 44100 -p 512 -n 3

The key setting here is:

-p 512

This gives you a latency of \~74ms. Using /dev/rtc and other kernel latency settings / patches should help.


(majority of work)

(a few small additions)

Retrieved from ""

Category: Sound cards