Configuring ALSA

Linux uses to different driver systems for sound: OSS (Open Sound System) or ALSA (Advanced Linux Sound Architecture). ALSA is in many ways superior to OSS, which also has been marked as deprecated in kernel version 2.6. For those apps that only work with OSS, ALSA has an OSS-emulation layer. Another nice thing about ALSA, is that it provides software mixing, so that it is possible to play multiple sounds streams at the same time, but that only works for apps using ALSA, and not via the OSS-emulation.

This pages contains:

Kernel support

To use ALSA you need the driver modules, libs and utilities. If you use Gentoo there is detailed instruction available in the Gentoo Linux ALSA Guide. Else you can find instructions on ALSA's page

If you run a 2.4 kernel you only have to enable sound core, and then emerge alsa-driver:

Configure your kernel with these settings:
Enable asSetting Name
Sound
YSound card support
Table 1.1 : Setting to enable sound support in 2.4
If you use 2.6 you will have to enable several ALSA modules:
Device Drivers  --->
    Sound  --->
        <*> Sound card support
	    Advanced Linux Sound Architecture  --->
		<M> Advanced Linux Sound Architecture
		<M> Sequencer support
		<M> OSS Mixer API
		<M> OSS PCM (digital audio) API
		[*] OSS Sequencer API
		    PCI devices  --->
		        <M> Emu10k1 (SB Live!, Audigy, E-mu APS)
Code listing 1.1
Use a mixer, like alsamixer (part of ALSA utilities) to unmute the channels, and adjust volume.

For more information:

Sound mixing

In order for two or more programs to play a sound at the same time, for example Gaim and xmms, the sound stream from both programs have to be mixed together into one stream which the sound card can play. If your sound card does not provide hardware mixing (The SoundBlaster Live! Player 5.1 for example provides hardware mixing) you need to use software mixing. You can either use a sound mixing daemon like esd or arts, but ALSA it self provides software mixing, so there is no need for an external program. ALSA's software mixing is called dmix. In newer versions of ALSA dmix is enabled by default, else you can control it by creating a ~/.asoundrc with the following contents (NOTE! this is specific for the integrated sound on the A7V):
pcm.!default {
        type plug
        slave.pcm "dmixer"
}
 
pcm.dsp0 {
        type plug
        slave.pcm "dmixer"
}
 
pcm.dmixer  {
        type dmix
        ipc_key 1024
        slave {
                pcm "hw:0,0"
                period_time 0
                period_size 1024
                buffer_size 8192
                rate 44100
        }
        bindings {
                0 0
                1 1
        }
}
 
ctl.mixer0 {
        type hw
        card 0
}
Code listing 1.2
With these setting I'm able to play multiple streams at the same time. I have configured xmms to use these settings: User defined audio device: dmixer, mplayer works with: mplayer -ao alsa9:dmixer, aplay and ogg123 works with out any changes.

For more information:

[ Top | Bottom ]
Hi! you have reached the old part of my homepage, be sure to checkout my new site