PDA

View Full Version : Can anyone explain Linux sound?



Moik
9th September 2006, 09:50 AM
Can anyone give an overview of the how the sound works in FC5? I understand there are two main drivers(?) ALSA and OSS. I believe ALSA installs by default and is compiled as part of the kernel, though I suspect OSS is also installed. I'm using KDE3.5 and you can switch between ALSA and OSS in the control centre, and I think this starts a process called artsd which I understand is the sound server. I believe there is something similar on Gnome called esd(?).

Due to artsd hogging the sound resource and refusing to share I have the sound system disabled in KDE, but it still works from somewhere (best not to ask questions I figured). I've checked the processes (ps -e | grep artsd and similar for esd) and neither appear to be running.

I recently had a problem where I managed to disable the sound completely whilst trying to work out how to get my microphone working. This was eventually solved by muting the sound in alsamixer/kmix. :confused:

So basically I don't know whether I'm using ALSA or OSS. I don't appear to have any sound servers running, sound is muted in alsamixer and everything works fine. I don't appear to have any software control over the volume (xmms ignores me and alsamixer is muted - totem seems to work though). So where is my sound coming from and how do you normally switch between ALSA and OSS if you aren't using the KDE control centre?

hollywoodb
9th September 2006, 03:41 PM
ALSA has an OSS compatibility layer... if you do a 'lsmod | grep snd' you will see some modules end in "_oss". This is for some applications that support OSS output but not ALSA natively.

Arts is a sound daemon that offers some additional features for some applications. You can force an app to use the arts sound system by starting it with 'artsdsp <appname>' from terminal. In KDE you can disable arts and sound can still be pumped through /dev/dsp, which is the standard place to output sound directly.... If you cat a file ( 'cat /etc/cpuinfo > /dev/dsp' ) you'll get static for example.

You don't necesarily need arts or esd in my opinion, and I prefer not to use them. On the other hand, some ALSA drivers for certain cards don't support hardware mixing, so you can only play one sound at a time, that is only one process can be using /dev/dsp at a time. ALSA tries to get around this with a thing called dmix which is basically software mixing. It can be anywhere from easy to a complete pain to set that up. There's a lot of documentation on the ALSA website.

All in all you don't actually switch between ALSA and OSS, the kernel modules loaded for your sound card are ALSA modules with an OSS compatibility layer. You can choose from within applications (xmms) which sound output protocol to use. In most cases I find it better to use ALSA, but the choice is yours.

As far as alsamixer goes, this is going to affect volume for applications that use OSS output as well. Master and PCM are your big output sliders.... Mic, Line, and Capture are for input. Depending on your card there may be quite a few others. In order to capture from an input you need to have either Mic or Line AND Capture turned up, without them muted. On my Nforce 3 chipset, I can turn up Mic or Line and hear them through the speakers, but I can't record anything unless I turn up Capture. The alsamixer setup varies significantly from card to card, though, and your setup may be different.

At least that's my take on the issue ;D

http://en.wikipedia.org/wiki/ALSA_(Linux)
http://alsa.opensrc.org/AlsaSharing
Both good reads, Hope this helps.

Moik
10th September 2006, 11:29 AM
Thanks for the info. I'll do some research (especially on dmix).

I'm on Nforce 2 using SoundBlaster Live with the onboard sound turned off (or so I believe), but all the things that show up in kmix have weird names like IEC958 Center/LFE. There is a slider for Capture Feedback, but there doesn't seem to be a slider for Mic/Line in. Only a selector for one or the other (and I don't know which one it should be). I'm sure I'll work it out.

EDIT: Just switched to Mic in with the capture at about 70 and I can hear it through the speakers. Excellent. Thanks for the advice.