I’m not going to get into the story of Open Sound System. Let’s just say that OSS was deprecated years ago and ALSA is the standard. Recently OSS was GPLed and now you can use it with no problems. The following was what I gathered about the subject, tested in Ubuntu 9.04 (linux mint 7 to tell the truth) on an Acer Aspire One. I sometimes reference things by wrong names by sheer ignorance, but you’ll get the idea. I present instructions for installation, configuring applications to work with OSS and a path to debug some of the most common problems encountered with OSS.
1.Why consider OSS
There are a number of reasons to consider using OSS in your system. Some say OSS has better sound quality, it’s hard to tell really. Some soundcards, of the more professional variety, are only properly supported with OSS. You know, 5.1 sound and the like. Some say it takes less resources, but really it’s nothing extravagant. A list of supported hardware can be found on this pdf.
A good reason to use OSS is to refuse to use ALSA+pulseaudio and avoid its problems. If you have propper support for your hardware in ALSA, then alright, ALSA works ok, but pulseaudio is just there to ruin your audio. Pulseaudio is the reason strange shit happens with sound. It’s why you experience sound clipping for no reason, it’s the reason skype audio breaks randomly on ubuntu 9.04, etc and etc ad absurdum. If you’ve used any distro with pulseaudio running on the background you have experienced problems with audio. There is no ideal pulseaudio set up, pulseaudio is a big piece of shit with useless features, it is the exact definition of bloatware and has random problems with no possibility of solution. With OSS you won’t have these problems. No, you’ll have a different set of problems. But hey, at least they are predictable and you might be able to solve them.
2. Why not consider OSS
OSS has its own issues. Assuming your hardware is supported, what will not work for sure is automatic headphone recognition and suspend/resume. Some workarounds are available, but it will not work out of the box.
The bigger problem with OSS though is support. It’s not supported very well. I mean support in terms of active development and integration with your desktop. Your system sounds will not work out of the box in GNOME. The base system itself is quite good and has extraordinary potential, but no one is really working on it to the fullest extent. The GUI mixer applet is just a proof of concept to be honest. Look at it
It tries to do inteligent things like calling pink-jack to your mic input, green jack to the headphone. The idea is brilliant, but it doesn’t work 100% and ends up being confusing. It is still better than alsa though. Consider this usual mess.
Just your everyday user-friendly, sane piece of software engineering. ALSA FTW!
3.Getting it up and running
Installing OSS is pretty simple. If you haven’t tried OSS before, the more intelligent thing to do is disable ALSA and pulseaudio instead of uninstalling them. First thing is to blacklist all alsa sound modules using the two following commands
sudo cat /lib/linux-sound-base/noALSA.modprobe.conf >> /etc/modprobe.d/blacklist.conf
sudo echo "blacklist snd_hda_intel
blacklist soundcore" >> /etc/modprobe.d/blacklist.conf # One whole command
Noticed that that last one should be on whole command, paragraphs and everything. Run this
sudo dpkg-reconfigure linux-sound-base
And choose OSS from the list. Now you have to reboot. If you would like to check if the ALSA modules have indeed not been loaded, try running lsmod.
Install all the needed dependencies like so
sudo aptitude install libtool libgtk2.0-dev libesd0 libsdl1.2debian-oss build-essential binutils linux-headers-`uname -r` gawk
Now you are ready to install. There is a deb package available. You can get it from the 4front website or directly here, the latest package as of the writing of this article. The recommended way to do it is installing the package using dpkg, for some reason the GUI app is said not to install it properly.
sudo dpkg -i oss-linux*.deb
And that’s that. OSS has been installed and should now be running. You can check it by running lsmod and checking for the new modules.
In system->preferences->sound you should change everything to OSS4 (if OSS4 is not available, then OSS will work too) like so
Notice the Default Mixer tracks
Note the last part, Default Mixer Track. When you change your volume using the volume applet, the volume you are changing is whatever track is choosen here.
This is what I mean by volume applet
And we’re done.
Configuration and debugging
Now you will want to test your audio. This might be quite an involved process.
Flash 10 should be working out of the box if you have the package flashplugin-non-free-extrasound installed. If not working, try reinstalling the package. Totem should be working since the propper Gstreamer backend (packages gstreamer0.10-plugins-bad and/or gstreamer0.10-plugins-ugly). Regarding Wine, you need to change the sound driver to OSS in the Wine Configuration thing. Mplayer and vlc may have to be configured on their own options to have audio working. I will dedicate a whole section to Skype.
In case something’s wrong, here’s an explanation of some of the tools available, things you can do with them and things to look up. I will put them in an order that makes sense as a debugging procedure.
osstest is a command line utility that will play audio on all output devices avaialbe, it will run thru all devices registered in /dev/oss/oss_hdaudio/ (note that the last folder oss_hdaudio is driver specific). Running this will reveal if your soundcard is properly supported and the driver is properly installed. If you hear the audio test, then any playback problem lay elsewhere.
ossxmix is the mixer GUI you’ve seen a screenshot earlier. It looks pretty bad and confusing. There’s a couple of things I would like point out.
vmix stands for virtual mixer. This needs to be enabled for you to have multiple applications outputing audio at the same time, if you can’t play music in totem while watching a video a youtube, this is what you should be looking at. vmix0-src should be set to Production for the best sound quality possible. vmix0-outvol/-invol are respectively the volume of the ouput and the input, meaning playback and recording respectively. At the bottom you will see the mixer itself, several channels available and each application will connect to one of the channels. You can have one application occupy multiple channels, for instance, skype may use one input channel and one output and you will see both channels in the mixer. I don’t know as of now if there is a maximum number of channels and if you can do anything to change them. I still haven’t had any problems with that.
In the middle rows you will have the rest of the devices your soundcard is packing. It’s an enormous mess and the mess will be different from soundcard to soundcard, so I won’t go too deep on this. And note that by mess I don’t mean just mess in presentation, the driver itself may have some bugs and the controls will not work as intended or even in a logical way. To try to understand what is doing what, you can play some music in whatever program is working, play with the controls and see the changes in real time. It is useful to find out how to manually mute the internal speaker of your laptop, since like I mentioned, headphone detection doesn’t normally work. Microphone problems will be solved also by playing with the mixer, but the easiest way to use the mixer with ossrecord as I’ll explain in a second.
ossdevlinks shows the symlinks to which /dev/dsp* entries point. From what I understand, versions prior to OSSv4 used these /dev/dsp* entries, but in V4 they use different entries and basically the dsp ones link to the ones used in V4. You need to run it as sudo and with the -v option, sudo ossdevlinks -v . Here’s an example output
4 audio devices
/dev/dsp4 is the next free legacy device
/dev/dsp0: symlink -> /dev/oss/oss_hdaudio0/pcm0 OK
/dev/dsp1: symlink -> /dev/oss/oss_hdaudio0/pcm1 OK
/dev/dsp2: symlink -> /dev/oss/oss_hdaudio0/pcmin0 OK
/dev/dsp3: symlink -> /dev/oss/oss_hdaudio0/pcmin1 OK
Here’s a brief explanation of what I understand of this output. pcm0/1 are respectively the internal speaker of my laptop and the headphone. I can see this by running osstest and checking wich pcm is which. So choosing the playback channel is done. pcmin0/1 are two available inputs, which in theory I would guess should be the internal and the external mic. This is a bit more tricky, because in effect you can only select one mic at a time, which one is selected in the mixer.
This will come in handy to use ossrecord and to setup skype or any application that uses the dsp links.
ossrecord will record audio from the currently selected input device. An interesting way to use it is to redirect its output directly to ossplay like so
ossrecord - | ossplay -
Using this you can listen immediately to what’s being recorded. If you are having trouble with choosing the internal mic or the external mic in a laptop, for instance, with this command you can listen in real time to changes you make in the mixer. The problems you might be dealing with are a combination of muting and selection. Example, you might have the external mic selected, but if its muted you won’t hear a thing. Yep, it’s a mess.
In my case I was able to choose the external mic by doing the following irrational procedure
ossrecord -d/dev/dsp3 - | ossplay -
The -d option forces ossrecord to listen to a specific device. With dsp3, selecting speaker/dmic I heard the external/internal mic respectively. Here’s a screenshot of what I mean.
There is no difference between this and something absolutely random
Bottomline, by trial and error I found out that /dev/dsp3 is outputting the selected microphone in the mixer. Selecting the mic in the mixer was a shot in the dark. I knew which input devices were available by checking ossdevlinks and noticing that dsp2/3 were linked to pcmin0/1.
By know you should’ve have mastered your soundcard if the installation went alright. There are still some things worth mentioning.
The volume applet is tricky. When you use your keyboard to change the volume it’s the same as changing it in the volume applet, and which mixer track this affects is chosen in the sound preferences dialog as I mentioned earlier. Going to volume control you will access the mixer. Since no more alsa and no more pulseaudio, you will have only one mixer available which is much more sane. This has basically the same options ossxmix has (note that you have to enable all the possible options choosing preferences and putting them all visible), but presented in a different way. I do not recommend using this, although it works, I do believe some options are missing, I recommend setting your audio using ossxmix.
ossmix is the command line mixer. Running ossmix will dump all the information ossxmix presents graphically. By using ossmix with some options, you can change the levels and switches you change in ossxmix. In theory, if you wish to have headphones automatically detected you should try to automatically run a specific command that mutes the laptop internal speaker when the headphone is detected. I have yet to find how to do this. Also, if you’d like to mute/unmute the internal speaker easily, you can try to do a script that toggles the value and then make a shortcut on the desktop that runs the script, enabling you to mute/unmute with a double click. I haven’t done this, but it shouldn’t be too difficult, it’s a basic if/then/else structure.
ossinfo will display information regarding the current configuration. Running ossinfo -v4 will display all available information.
I believe this is worth a section of its own. In case you’re running Ubuntu, you should have the medibuntu repository installed and this will provide the required packages. The skype package only supports ALSA/pulseaudio. If you have this installed and wish to start using OSS, uninstall the skype package and install skype-static-oss. As a side note, this version of skype will not blend in your GTK theme, it comes with a “static” qt configuration.
You will need to configure the audio. In the options you can see that the devices are referenced as /dev/dspX instead of a more user friend reference, like in the screenshot.
You think this is bad? Ever seen how it looks like with ALSA+pulse?
By know you should know how to deal with this. I have explained how to find out what the dsp links are referencing, which ones are input or output and how to test them in real time. Usually you’re sound out and ringing should be /dev/dsp, the sound in you should find out by using ossrecord.
3.Other problems and things I found out
Disabling vmix will make sound applications use much less cpu (around half), but you can one play one at a time. It is mentioned in this forum post that disabling vmix for recording channels will bring the cpu down. I honestly did not understand the procedure so well, what do you mean dettach then attach?bah, I think I did it but didn’t really see any effects.
Suspend/resume I did not find a solution. In theory, you should disable audio by running soundoff on suspend and renable it by running soundon on resume, and this implies altering whatever scripts are run in both operations. Does any one know how to this?
The workaround to enable gnome sounds is quite simple but I don’t remember where I saw it.
After I got everything working I purged pulseaudio from my system, but didn’t touch alsa. It should not be a problem.
I initially installed OSS to try to tackle 3 issues.
First, I noticed that pulseaudio was using a lot of CPU and I head that OSS used less resources. On the CPU level, I did not see any real difference, only with vmix disabled would CPU usage come considerably down. Some people report other results though.
Second, I use spotify to listen to music. With alsa/pulseaudio the sound was choppy, freezing at least twice every minute and it was annoying me. Changing the wine driver to OSS and running spotify with padsp, a wrapper for pulseaudio, brought the choppiness down but not completely and the CPU usage was very high. I expected that running OSS natively with solve all the problems. Well, CPU went to normal because you don’t need the wrapper anymore, choppiness went further down but never disappeared. I am still trying to figure out how to solve the issue.
Thirdly, skype in Ubuntu 9.04 is not working well. The sound freezes after a random amount of time and there is no definite solution. By the use of voodoo I was able to make it work, but honestly I don’t even remember what I did. With OSS skype works fine.
So, bottom line, after installing OSS runs quite well but it did not solve all my problems. I like that the mixing is less insane than with alsa+pulse, but it sadly has some problems and the GUI mixer is not intuitive by any means. Since I did a lot of research, I know that some soundcards are only supported by OSS and there isn’t any good in-depth guide I could find online, I decided to write this.
For further help, please check the 4front user forum. What this guide contains is basicaly all I know about OSS.
arch linux wiki
4front user forum
Pdf from 4front with installation instructions, hardware support and general overview of tools.
Tags: /dev/dsp, 4, 8.10, 9.04, alsa, audio, bug, debug, debugging, device, dsp, entry, ext, external, four, how, how-to, install, installation, int, internal, intrepid, jaunty, link, mic, microphone, not, open, OSS, ossinfo, ossmix, ossplay, ossrecord, OSSv4, ossxmix, problem, problems, pulse, pulseaudio, skype, sound, system, to, tutorial, ubuntu, v4, version, working