9/9/08 10:13 pm - Alsa information, disseminated to the masses.
So I've spent a little bit of time over the past few days trying to get audio working on my workstation at home. For those of you interested, here's some spec's on the system:
-Intel Workstation Bord (Don't recall the model number and don't want to look it up)
-Dual Quad Core Xeon Processors 2.0Ghz each
-2Gb of RAM (Soon to be 8Gb)
-Sound is on-board
That's the really important information at this point, so on with the show. I realized that for some reason, my applications were not doing 'simultaneous' audio. Now this system is pretty powerful, so I have it doing a lot. It's my main workstation, it also runs my MythTV front-end, it has a Windows XP Virtual machine in it, and is my main development platform. Soon it will a lso be running about 5 or so small Virtual Machines for a 'cluster' test that I will be running. But I digress.
So I started poking around the Alsa (http://www.alsa-project.org/) documentation. Come to find out, most on-board sound cards do not do hardware mixing. No surprise there. But, according to Alsa's own docs there is a neat Software Mixer built in called Dmix. Again, no real surprise. However, Alsa says that "For ALSA 1.0.9rc2 and higher you don't need to setup dmix. Dmix is enabled as default for soundcards which don't support hw mixing." (http://alsa.opensrc.org/DmixPlugin ). Now this has me intrigued because if it is enabled by default, it sure is not working right.
So after some serious poking around the great Internet, I found some vague steps to enable this and get it working. It required installation of the 'alsa-oss' package, which appears to be non-existant for CentOS5. Bummer. Download the source for it though (ftp://ftp.alsa-project.org/pub/oss-lib/a lsa-oss-1.0.14.tar.bz2 for CentOS5) and compile it. Now, there's a trick to this. Especially if you are running on a 64-bit (x86_64) system. You need to compile it TWICE.
First compile, do the following:
# ./configure --prefix=/usr --libdir=/usr/lib64
# make
# make install
Then compile the following way:
# make clean
# export CFLAGS="-m32"
# ./configure --prefix=/usr --libdir=/usr/lib
# make
# make install
Then after all that is said and done, make sure you run
# ldconfig
But you're not done yet. Open up /usr/bin/aoss and edit it to look like this:
Changing the script to the above code will make it automagically find libaoss.so for the arch that the currently running binary is. THIS IS NOT DOCUMENTED ANYWHERE I COULD FIND. This is the stumbling block that I finally over came this evening. So I decided to share my information with the rest of the world in hopes that it will help.
After that is all said and done, create the file ~/.asoundrc and put in it the following:
This may break mixer functionality, I haven't played with that part of it yet, but it does work. Even for the old OSS stuff, which is what the stuff above with the alsa-oss stuff, mainly deals with.
Enjoy
-Intel Workstation Bord (Don't recall the model number and don't want to look it up)
-Dual Quad Core Xeon Processors 2.0Ghz each
-2Gb of RAM (Soon to be 8Gb)
-Sound is on-board
That's the really important information at this point, so on with the show. I realized that for some reason, my applications were not doing 'simultaneous' audio. Now this system is pretty powerful, so I have it doing a lot. It's my main workstation, it also runs my MythTV front-end, it has a Windows XP Virtual machine in it, and is my main development platform. Soon it will a lso be running about 5 or so small Virtual Machines for a 'cluster' test that I will be running. But I digress.
So I started poking around the Alsa (http://www.alsa-project.org/) documentation. Come to find out, most on-board sound cards do not do hardware mixing. No surprise there. But, according to Alsa's own docs there is a neat Software Mixer built in called Dmix. Again, no real surprise. However, Alsa says that "For ALSA 1.0.9rc2 and higher you don't need to setup dmix. Dmix is enabled as default for soundcards which don't support hw mixing." (http://alsa.opensrc.org/DmixPlugin
So after some serious poking around the great Internet, I found some vague steps to enable this and get it working. It required installation of the 'alsa-oss' package, which appears to be non-existant for CentOS5. Bummer. Download the source for it though (ftp://ftp.alsa-project.org/pub/oss-lib/a
First compile, do the following:
# ./configure --prefix=/usr --libdir=/usr/lib64
# make
# make install
Then compile the following way:
# make clean
# export CFLAGS="-m32"
# ./configure --prefix=/usr --libdir=/usr/lib
# make
# make install
Then after all that is said and done, make sure you run
# ldconfig
But you're not done yet. Open up /usr/bin/aoss and edit it to look like this:
#!/bin/sh # A simple script to facilitate the use of the OSS compatibility library. # Usage: # aossif [ -d /proc/asound ]; then prefix=/usr exec_prefix=${prefix} LD_PRELOAD=libaoss.so${LD_PRELOAD:+:$LD_PRELOAD} exec "$@" else exec "$@" fi exit 1
Changing the script to the above code will make it automagically find libaoss.so for the arch that the currently running binary is. THIS IS NOT DOCUMENTED ANYWHERE I COULD FIND. This is the stumbling block that I finally over came this evening. So I decided to share my information with the rest of the world in hopes that it will help.
After that is all said and done, create the file ~/.asoundrc and put in it the following:
ctl.mixer0 {
type hw
card 0
}
# I also had to add/alter the following, making ALSA use dmix by default
pcm.!default {
type plug
slave.pcm "dmix"
}
This may break mixer functionality, I haven't played with that part of it yet, but it does work. Even for the old OSS stuff, which is what the stuff above with the alsa-oss stuff, mainly deals with.
Enjoy
