I have an old machine celeron 333MHz , 98 MB SDRAM 100MHz FSB, Intel 440LX motherboard and Aztec 2320 chipset ISA soundcard. Recently I installed Fedora core 2 with linux kernel 2.6 on my machine. The installation went quite smoothly other than a minor temporary glich that I couldn't move the mouse pointer while installing so had to navigate using the keyboard. But when I booted into linux after installation and tried playing a music file, It gave the error that no sound cards were detected. I know that my sound card is an Aztec 2320 based ISA card. So I went about finding out whether this sound card is supported by linux. I googled for the same, posted queries in linux mailing lists and visited comp.os.linux.hardware, alt.os.linux, alt.comp.linux newsgroups.
I found out that Alsa (Advanced Linux Sound Architecture) is a open standards group whose primary aim is to provide sound driver support for the sound cards in linux. And they are doing a commendable job. There is also another group called OSS (Open Sound System) which used to give sound support for linux. But because it had some limitations, it was not able to meet the demands of the linux community.And ALSA was able to meet those demands much better. From kernel 2.6 onwards ALSA support is compiled in the kernel by default. You can read more about it at
alsa-project.org .
Coming back to my problem, I found out from their
website (Thanks to Sishir Birmiwal - Ittiam Systems Ltd for pointing out this link) that Aztec 2320 is indeed supported by ALSA. The driver to be loaded is
snd_azt2320.
So I logged in as 'root' and first executed the command to check if this module is loaded as follows:
# lsmod
This showed that the module is not loaded. Next I loaded the module as follows:
# modprobe snd_pcm_oss
# modprobe snd_azt2320
Then I did a lsmod and found that the module has successfully loaded. Also modprobe will load all other modules on which snd_azt2320 depends on. ie. it does a dependency check - so you don't have to worry about loading dependent modules. The module snd_pcm_oss is needed and had to be loaded seperatly because it didn't load otherwise.
For loading the snd_azt2320 module each time I boot my machine, I included the above lines in the /etc/rc.d/rc.local file. Though I wonder if there is a better way than that.
Then I included a few lines into my
/etc/modules.conf file as given below.
# File: /etc/modules.conf
# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-azt2320
# module options should go here
# OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
# card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
The alsa website had suggested including a few more lines of code in the above file but It works for me with just the above lines. I guess you can include more lines of code if you have more than 1 sound card on your machine.
Alsa Mixer mutes all the channels by default. So you have to unmute and set channel values with a software mixer. I used alsamixer for the purpose but you may also use kmix for the same. Here I turned on the volume to max value, changed the PCM settings to max value and closed the program. Now I was able to hear the sound quite well.
Then I saved the settings using the command :
# alsactl store
The above command basically saves your alsa mixer settings to be retrieved for use later. Finally there was one more thing to do ie. retrieve the settings each time you reboot your machine. This I achieved by including the following line at the bottom of the /etc/rc.d/rc.local file.
# File: /etc/rc.d/rc.local file
alsactl restore
Now I optimised the alsa PCM plugins for use with alsa-aware applications. This is done in the .asoundrc file. This file has to reside in your $HOME directory. You may not have this file by default - in which case, you have to create it. My .asoundrc file contents are as follows:
// .asoundrc file
pcm.azt2320 {
type hw
card 0
}
ctl.azt2320 {
type hw
card 0
}
pcm.dsp0 {
type plug
slave.pcm "dmix"
}
In the .asoundrc file, I have included a section called pcm.dsp0 which is the dmix plugin. This is desirable as, only then will you be able to play multiple audio streams simultaneously (Which is impossible without dmix). If you don't include that section in your .asoundrc file, you will be able to hear sound from only one application at a time.
I also copied this file (.asoundrc) into my '/etc/skel' directory so that for each new user that is created, this file will be automatically copied into his/her $HOME directory.
Note: If you want to achieve some fancy stuff like adding a 5 sec delay to any of your audio streams, you may visit
ladspa.org and use their plugins. You can also get a variety of plugins at
plugin.org.uk . Remember, to use any plugins, you have to enter the necessary code in your
.asoundrc file.
Even though the above steps are for the Aztec 2320 sound card, I believe they are valid for sound cards of any other make. Just replace
snd_azt2320 module with the module of your respective sound card. Also don't forget to change the respective lines in the
/etc/modules.conf file too.
Update : If you donot know the module of your sound card, you can get a clue if you browse the directories containing the modules. In Linux with kernel 2.4, the modules end with the extention '.o ' and in kernel 2.6 it is '.ko' . Just execute the following commands to check the sound modules you have on your machine:
find /lib/ -iname \*sound\*.ko
for kernel 2.6 and
find /lib/ -iname \*sound\*.o
for kernel 2.4 .