ALSA, which stands for
ALSA's main features include efficient support for all types of audio
interfaces ranging from consumer sound cards to professional sound
equipment, fully modularized drivers, SMP and thread safety, backward
compatibility with OSS and a user-space library
First, you need to know what drivers your sound card uses. In most cases, sound
cards (onboard and otherwise) are PCI based and
We now proceed to find out details about the sound card.
# lspci -v | grep -i audio 0000:00:0a.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1 (rev 06)
We now know that the sound card on the machine is a Sound Blaster Live! and the
card manufacturer is Creative Labs. Head over to the
If you intend to use MIDI, then you should add
Let us now configure the kernel to enable ALSA.
# cd /usr/src/linux # make menuconfig
Now we will look at some of the options we will have to enable in the 2.6 kernel to ensure proper ALSA support for our sound card.
Please note that for ease of use, all examples show ALSA built as modules. It
is advisable to follow the same as it then allows the use of
Device Drivers ---> Sound --->(This needs to be enabled) <M> Sound card support(Make sure OSS is disabled) Open Sound System ---> < > Open Sound System (DEPRECATED)(Move one step back and enter ALSA) Advanced Linux Sound Architecture ---> <M> Advanced Linux Sound Architecture(Select this if you want MIDI sequencing and routing) <M> Sequencer support(Old style /dev/mixer* and /dev/dsp* support. Recommended.) <M> OSS Mixer API <M> OSS PCM (digital audio) API(You now have a choice of devices to enable support for. Generally, you will have one type of device and not more. If you have more than one sound card, please enable them all here.) (Mostly for testing and development purposes, not needed for normal users unless you know what you are doing.) Generic devices --->(For ISA Sound cards) ISA devices --->(IF you had the Gravis, you would select this option) <M> Gravis UltraSound Extreme(Move one level back and into PCI devices. Most sound cards today are PCI devices) PCI devices --->(We now select the emu10k1 driver for our card) <M> Emu10k1 (SB Live!, Audigy, E-mu APS)(Or an Intel card would be) <M> Intel/SiS/nVidia/AMD/ALi AC97 Controller(Or if you have a VIA Card) <M> VIA 82C686A/B, 8233/8235 AC97 Controller(Move one level back and select in case you have an USB sound card) USB Devices --->
Now that your options are set, you can (re)compile the kernel and ALSA support
for your card should be functional once you reboot into the new kernel. Don't
forget to update your GRUB configuration to use the newly built kernel.
You can now proceed to
# emerge alsa-utils
Recent versions of
To configure your sound card just type
# alsaconf
You will now see a neat menu guided interface that will automatically probe
your devices and try to find out your sound card. You will be asked to pick
your sound card from a list. Once that's done, it will ask you permission to
automatically make required changes to
We're now almost all setup. Whichever method you chose to install ALSA, you'll
need to have something load your modules or initialize ALSA and restore your
volume settings when your system comes up. The ALSA Initscript handles all of
this for you and is called
# rc-update add alsasound boot * alsasound added to runlevel boot * rc-update complete.
Next, just check the
Before we move on to testing, there's one last
(Substitute <username> with your user) # gpasswd -a <username> audio Adding user <username> to group audio
We've completed all the setups and prerequisites, so let's fire up ALSA. If
you ran
# /etc/init.d/alsasound start
Now that the required things have been taken care of, we need to check up on
the volume as in certain cases, it is muted. We use
(Opens up a console program. Only required settings are shown) # alsamixer
This is how the ALSA Mixer
Now, we shall unmute the channels, and set volume levels as needed.
After you're all done, your ALSA Mixer should look similar to the one below. Note the 00 instead of the MM and also the volume levels for some optimum settings.
Finally. Some music. If everything above is perfect, you should now be able to
listen to some good music. A quick way to test is to use a command line tool
like
(Install the applications you want) # emerge madplay mpg123(To play .ogg files) # emerge vorbis-tools
And then play your favorite sound track...
# madplay -v /mnt/shyam/Music/Paul\ Oakenfold\ -\ Dread\ Rock.mp3
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
Title: Dread Rock
Artist: Paul Oakenfold
Album: Matrix Reloaded
Year: 2003
Genre: Soundtrack
Soundtrack
00:04:19 Layer III, 160 kbps, 44100 Hz, joint stereo (MS), no CRC
# ogg123 Paul\ Oakenfold\ -\ Dread\ Rock.ogg
Audio Device: Advanced Linux Sound Architecture (ALSA) output
Playing: Paul Oakenfold - Dread Rock.ogg
Ogg Vorbis stream: 2 channel, 44100 Hz
Genre: Soundtrack
Transcoded: mp3;160
Title: Dread Rock
Artist: Paul Oakenfold
Date: 2003
Album: Matrix Reloaded
Time: 00:11.31 [04:28.75] of 04:40.06 (200.6 kbps) Output Buffer 96.9%
You can now add the
If for some reason you're unable to hear sound, the first thing to do would
be to check your
(First and foremost, if /proc/asound/cards shows your card, ALSA has picked up your sound card fine.) # cat /proc/asound/cards 0 [Live ]: EMU10K1 - Sound Blaster Live! Sound Blaster Live! (rev.6, serial:0x80271102) at 0xb800, irq 11(This displays the current running ALSA version) # cat /proc/asound/version Advanced Linux Sound Architecture Driver Version 1.0.8 (Thu Jan 13 09:39:32 2005 UTC).(ALSA OSS emulation details) # cat /proc/asound/oss/sndstat Sound Driver:3.8.1a-980706 (ALSA v1.0.8 emulation code) Kernel: Linux airwolf.zion 2.6.11ac1 #2 Wed May 4 00:35:08 IST 2005 i686 Config options: 0 Installed drivers: Type 10: ALSA emulation Card config: Sound Blaster Live! (rev.6, serial:0x80271102) at 0xb800, irq 11 Audio devices: 0: EMU10K1 (DUPLEX) Synth devices: NOT ENABLED IN CONFIG Midi devices: 0: EMU10K1 MPU-401 (UART) Timers: 7: system timer Mixers: 0: SigmaTel STAC9721/23
The other most common issue users face is the dreaded "Unknown symbol in module" error. An example of the same is shown below.
# /etc/init.d/alsasound start
* Loading ALSA modules ...
* Loading: snd-card-0 ... [ ok ]
* Loading: snd-pcm-oss ...
WARNING: Error inserting snd_mixer_oss
(/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-mixer-oss.ko): Unknown
symbol in module, or unknown parameter (see dmesg) FATAL: Error inserting
snd_pcm_oss
(/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-pcm-oss.ko): Unknown
symbol in module, or unknown parameter (see dmesg)
[ !! ]
* Loading: snd-mixer-oss ...
FATAL: Error inserting snd_mixer_oss
(/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-mixer-oss.ko): Unknown
symbol in module, or unknown parameter (see dmesg)
[ !! ]
* Loading: snd-seq ... [ ok ]
* Loading: snd-emu10k1-synth ... [ ok ]
* Loading: snd-seq-midi ... [ ok ]
* Restoring Mixer Levels ... [ ok ]
And when you take a look at
(Only relevant portions are shown below) # dmesg | less ACPI: PCI Interrupt 0000:02:06.0[A] -> Link [APC3] -> GSI 18 (level, low) -> IRQ 209 snd_mixer_oss: Unknown symbol snd_unregister_oss_device snd_mixer_oss: Unknown symbol snd_register_oss_device snd_mixer_oss: Unknown symbol snd_mixer_oss_notify_callback snd_mixer_oss: Unknown symbol snd_oss_info_register snd_pcm_oss: Unknown symbol snd_unregister_oss_device snd_pcm_oss: Unknown symbol snd_register_oss_device snd_pcm_oss: Unknown symbol snd_mixer_oss_ioctl_card snd_pcm_oss: Unknown symbol snd_oss_info_register snd_mixer_oss: Unknown symbol snd_unregister_oss_device snd_mixer_oss: Unknown symbol snd_register_oss_device snd_mixer_oss: Unknown symbol snd_mixer_oss_notify_callback snd_mixer_oss: Unknown symbol snd_oss_info_register
The above issue is caused when you switch from the
The solution is quite easy. We just need to manually remove the problem causing
directory after you unmerge
# rm -rf /lib/modules/$(uname -r)/alsa-driver
Another reason for error messages similar to the ones above could be a file in
(Check dmesg to confirm) # dmesg | grep device_mode snd: Unknown parameter `device_mode'(Now, to get to the source of the issue) # grep device_mode /etc/modprobe.d/*
Usually it is a file called
First, check to make sure that you enabled the
If your sound card is one of those that come with on-board MIDI synthesizers
and you would like to listen to some .mid files, you have to install
# emerge awesfx
After copying over the Soundfont files, we can then play a midi file as shown.
You can also add the
(First, copy the Soundfont) # cp /mnt/win2k/Program\ Files/CreativeSBLive2k/SFBank/8MBGMSFX.SF2 /usr/share/sounds/sf2/(Or get it from your SoundBlaster CD) # cp /mnt/cdrom/AUDIO/ENGLISH/SFBANK/8MBGMSFX.SF2 /usr/share/sounds/sf2/(We load the specific Soundfont) # asfxload /usr/share/sounds/sf2/8MBGMSFX.SF2
You can now play midi files using a program like
(Check open ports) # aplaymidi -l Port Client name Port name 64:0 EMU10K1 MPU-401 (UART) EMU10K1 MPU-401 (UART) 65:0 Emu10k1 WaveTable Emu10k1 Port 0 65:1 Emu10k1 WaveTable Emu10k1 Port 1 65:2 Emu10k1 WaveTable Emu10k1 Port 2 65:3 Emu10k1 WaveTable Emu10k1 Port 3(Pick a port, and play a mid file) # aplaymidi --port=65:0 /mnt/shyam/music/midi/mi2.mid
If your sound card lacks a hardware synthesizer, you could use a virtual one
like
# emerge timidity++
For timidity to play sounds, it needs a sound font. Fortunately, the ebuild will
install some sound font packages for you. There are a few other font packages
available in Portage, such as
# eselect timidity list # eselect timidity set eawpatches
Don't forget to add
# rc-update add timidity default # /etc/init.d/timidity start
You can now try out
Some specific sound cards can benefit from certain tools provided by the
# emerge alsa-tools
You can have more than one sound card in your system simultaneously, provided
that you have built ALSA as modules in your kernel. You just need to specify
which should be started first in
options snd-emu10k1 index=0 options snd-via82xx index=1
Or, if you have two cards that use the same driver, you specify them on the same line, using comma-separated numbers. Here's an example for a system with three sound cards, two of which are the same Intel High Definition Audio card.
options snd-ymfpci index=0 options snd-hda-intel index=1,2
You may want to install some plugins for extra functionality.
# emerge -avt alsa-plugins
Everyone who contributed to the earlier version of the Gentoo ALSA Guide: Vincent Verleye, Grant Goodyear, Arcady Genkin, Jeremy Huddleston, John P. Davis, Sven Vermeulen, Benny Chuang, Tiemo Kieft and Erwin.