Monday, August 01, 2005

ALSA sprach Zarathustra

Technically it's no longer the weekend, so I hope you'll forgive me for bringing you the secret of Advanced Linux Sound Architecture (ALSA) a few hours later than promised. Believe me, it will be worth the wait. ALSA makes Ubuntu a platform truly ready for multimedia.

Before we can use ALSA, we need a particular library called libesd-alsa0. I found and installed the package using Synaptic. As usual, you could also use the terminal.

sudo apt-get install libesd-alsa0

ALSA requires a set of instructions to function properly. Luckily we have one that works on most hardware. First I created the configuration file.

sudo gedit /etc/asound.conf

Then I copied and pasted the following lines into the file and saved it.

pcm.card0 {
type hw
card 0
}

pcm.!default {
type plug
slave.pcm "dmixer"

}


pcm.dmixer {
type dmix
ipc_key 1025
slave {
pcm "hw:0,0"
period_time 0
period_size 2048 #1024
buffer_size 32768 #4096
#periods 128
rate 48000 #44100
}
bindings {
0 0
1 1
}
}

We need to do something similar for the ESD configuration file. We'll use the mv command to rename the existing file first.

sudo mv /etc/esound/esd.conf /etc/esound/esd.conf.bak
sudo gedit /etc/esound/esd.conf


Please note that the .bak extension that I use for my backup files is actually a Windows file extension. I doubt it will cause any problems for my system, since Linux and Windows run on different file systems and thus my faux backup files are unlikely to ever cross paths with their Windows counterparts. If you have any doubts, you can use the filename.conf_backup convention for yours. But I digress. The new ESD configuration should read as follows.

[esd]
auto_spawn=1
spawn_options=-terminate -nobeeps -as 2 -d default
spawn_wait_ms=100
# default options are used in spawned and non-spawned mode
default_options=

Finally we need to tell GNOME to use ALSA. Go to System -> Preferences -> Multimedia Systems Selector or enter gstreamer-properties in the Terminal. I changed the audio input and output to ALSA. After I rebooted, everything worked beautifully. My thanks go out to all the Ubuntu Forums members who helped gather the above information.

No comments: