LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How Does the Kernel Handle Audio? (https://www.linuxquestions.org/questions/linux-general-1/how-does-the-kernel-handle-audio-509479/)

progrock 12-11-2006 03:26 PM

How Does the Kernel Handle Audio?
 
Hi all, if this is the wrong forum for this, sorry, hopefully a mod will move it...

Anyway, what does the linux kernel do with audio? I was just wondering in general, but also I know that windows downmixes everything that you put through it(that's why we have kernel streaming through foobar :)). Does linux do anything like this? I was just wondering, because sometimes I feel like audio comes through a little worse than it started, although I could be dreaming. And if it does, is there a way to fix it?

-prog

matthewg42 12-11-2006 05:39 PM

There is more than one sound system in the kernel. OSS (The Open Sound System), which is now obsolete, and ALSA (Advanced Linux Sound Architecture).

Applications are typically written for one or the other (a few support both). With a bit of luck, OSS will disappear some time soon.

Both OSS and ALSA cards with hardware mixing to do it, but OSS will not do software mixing if the card doesn't support it. This means that if you have a budget soundcard (like many/most laptops), if a program which uses OSS gets the soundcard, everything else gets shut out. There is a work around for this described below.

ALSA does do software mixing between different apps. This feature of ALSA is called dmix. Turning it on is a configuration item. Some distros ship with dmix enabled by default.

There is a method for multiplexing single-channel soundcards between multiple OSS apps using aoss - the ALSA OSS wrapper, which uses ALSA underneath to provide an OSS-compatibile interface to the applications. This works only sometimes though. Personally I've never had little success with it.

Using dmix, I have in the past found that the mixing can cause poor quality, although I've not had that for a while. I had particular problems when using aoss + ALSA causing a lot of noise in the audio to the point where it was not usable. In this case it sounded like someone has cranked the amp up too high and it was clipping very badly, even at low output volumes.

progrock 12-12-2006 11:34 AM

So then how would I go about turning off dmix? If you're not familiar with my distro, just the general idea and I could figure it, most likely. Also, (and I know that is a little off topic)I have an Asus M2N32 mobo that has digital audio outputs, and I'm about to get a receiver that has digital inputs, and I'm really hoping that I won't have to jump through hoops to get that working. What do you think?

matthewg42 12-12-2006 03:45 PM

I don't actually know how to tun off dmix! When I was using gentoo some years ago, to make dmix work I had to write a configuration file and put it into my home directory, called ".asoundrc". Since I've been using Ubuntu it "just works" and I've sort of forgotten the process.

The dmix documentation has instructions to test if it's working, and change the configuration if necessary.

My dmix pointer is just a guess - I don't know that it's the problem. Check other avenues as well. One thing which just occurred to me is a simple check of the mixer settings - make sure your PCM and Master volumes are not at 100% - some soundcards can clip a little if one of the other volume's is too high.

For me, I get best results when my PCM is about 85% and master is no more than 90%.

Many apps in Linux will adjust the PCM setting when you change the volume in the app, but some do their own software volume control. In these cases, keep the volume away from the max setting too. In any case, I find putting the volume to max tends to cause some quality problems. Of course this is hardware dependent.

Another thing to do is find out what is your soundcard and google it with ALSA to see if there are any common problems and solutions for them.

Do you know your soundcard make and model (or better still, the chipset it uses?)


All times are GMT -5. The time now is 03:07 AM.