This is a little how-to I made for myself to remember how I did it and in the hope it may prove usefull for others...
First of all, a little explanation. The problem with integrated chipsets like AC'97 is that they lack a hardware mixer. In Windows this isn't a problem, because the sound drivers all come with nicely configured software mixers. The Linux sound modules, however, need some extra configuring to enable software mixing possible. When software mixing is not enabled, this results in only one linux program being able to use the sound card at a time.
"As hardware manufacturers try to cut costs, they seem to be standardizing on AC97 audio for built-in soundcards. In the old days, the de facto standard was Sound Blaster 16 compatibility, but in today’s quest for 5.1 surround and the like everyone has decided to make their cards Intel 8x0 compatible. The Intel feature set is mostly acceptable, and mutable enough for the hardware vendors, but leaves out one important feature: hardware sound mixing. Without hardware mixing, the output channels of the card are capable of outputting only one stream at a time. Windows is able to playback multiple streams because all incoming audio streams are mixed in software (either in the driver or kernel - not sure where). On linux things are a little different - by default, there is no mixing done, unless your card supports it in hardware. So by default, AC97 users (like me) are out of luck." - joeyreid.kicks-ass.net/wordpress/index.php?p=192
ALSA & OSS There are two popular sound systems for Linux: ALSA - Advanced Linux Sound Architecture OSS - Open Sound System
Fortunatly, a software mixer plugin comes with the ALSA modules, it just needs to be configured properly. OSS doesn't have any mixer plugins however, and will cause incompatability problems. So we'll have to deactivate the OSS modules and make the few programs that really need OSS use ALSA through a tool called alsa-oss. There are some RPM's of alsa-oss available at rpmfind.net but these are really outdated, so it's better to just grab the latest source and build it yourself.
You can find the latest version of the alsa-oss source at www.alsa-project.org/alsa/ftp/oss-lib/ I used version 1.0.7 since that was the stable release at time of writing. Of course you should change the version numbers acordingly if you download a newer version.
After downloading the source, open a terminal, change to the directory containing the file and do the following:
$ tar -jxf alsa-oss-1.0.7.tar.bz2 $ cd alsa-oss-1.0.7 $ ./configure --prefix=/usr $ make
*switch to root (using su)
# make install
If you didn't see any errors flashing by, then alsa-oss should be installed properly. Now we need to turn of the OSS modules. Ad the following lines to your /etc/modprobe.conf:
alias snd_pcm_oss off alias snd_mixer_oss off
Now we need to configure the few programs that do not support alsa to make them use alsa-oss. The only program that I use, that only uses OSS, is the Flash player plugin. So that means that you'll have to change the Firefox script. (Asuming that you use firefox that is. If you use another browser then you'll have to figure it out yourself) Open /usr/bin/firefox and add look for the following part:
# This script is meant to run a mozilla program from the mozilla ## rpm installation. ## ## The script will setup all the environment voodoo needed to make ## mozilla work.
and add the following two lines directly below it:
LD_PRELOAD=/usr/lib/libaoss.so export LD_PRELOAD
Well, that takes care of Firefox. If you have any other OSS-only programs that you know off, it often is enough to add 'aoss' in front of the shortcuts. This will make them use ALSA and thus also ALSA's software mixer. If you use mplayer you'll need to edit the /home/-USER-/.mplayer/gui.conf for every user and change the following:
ao_oss_mixer = "/dev/mixer" INTO ao_oss_mixer = "mixer0" ao_oss_device = "/dev/dsp" INTO ao_oss_device = "dsp0"
All other programs should be configured to use ALSA whenever possible. To explain how goes beond the focus of this howto however.
Now you need to create the file /etc/asound.conf and add the following content to it:
# DMIX device pcm.!output { type dmix ipc_key 1234 slave { pcm "hw:0,0" period_time 0 period_size 1024 buffer_size 8192 rate 48000 } } # DSNOOP device pcm.!input { type dsnoop ipc_key 1234 slave { pcm "hw:0,0" period_time 0 period_size 1024 rate 48000 } } # ASYM duplex device pcm.!duplex { type asym playback.pcm "output" capture.pcm "input" } # Make the duplex device default pcm.!default { type plug slave.pcm "duplex" } # OSS Compability pcm.!dsp0 { type plug slave.pcm "duplex" } ctl.!mixer0 { type hw card 0 }
Safe the file and check whether you don't have any .asoundrc files in the users' home directories. (check using ls -la to show hidden files) delete them if you find any, so that the configurations stay global.
Now reboot, and you should be able to watch (and hear) Flash sites while you're listening to MP3's... Ohh, how wonderfull Linux can be when it all works properly!
SOURCES: alsa config - http://www.fedoraforum.org/forum/showthread.php?t=18522 DMIX plugin - http://alsa.opensrc.org/index.php?page=DmixPlugin other tutorial - http://joeyreid.kicks-ass.net/wordpress/index.php?p=192 alsa-oss sources - http://www.alsa-project.org/alsa/ftp/oss-lib/
1 comment:
Hi, there is alternative oss emulation layer, called forward-oss, it support software mixing and all alsa plugins. http://apt2.freespire.org/CNRUbuntu-20070509/pool/main/f/forward-oss/
Works greate.
Post a Comment