2014-05-31

Sound multiplexing in Linux

Linux's default sound system is pretty bare-bones. These days the go-to solution for sound drivers is Alsa. Alsa is just enough to get you the ability to get sound in and out of the machine, and adjust whatever the hardware supports. On thing it does not do by default is multiplexing. That is, only one application can make sound at a time.

This is a problem, and a problem many people have solved many ways. The result has been a plethora of different sound daemons and standards to go with them, jack, esd, pulseaudio, etc. The idea is you run a daemon that talks to the hardware (via the kernel) and everyone else sends it's sound stream through the daemon, which mixes it for you.

Now, when I set up my laptop with ubuntu-server, what I got by default was pulse-audio. My laptop has an interesting sound card feature, the sound-card can play out of both the headphone jack, and the speakers, at the same time. Often plugging in headphones cuts out the speaker, but not on this machine. Instead there are seperate volume controls for the two outputs.

That's all well and good, but pulse-audio is designed to need minimal configuration, and similar to so much software of it's ilk, that means it's not configurable. As a result it has different ideas about what should happen when I plug in my headphones than I do (in particular, it likes to crank the volume WAY up). It does mute the speakers, but I find the changing of my volume to ear-bleeding to me unacceptable. Since I couldn't change this, I removed pulse-audio.

I use my laptop to listen to music, as well as sometimes to receive phone-calls via gmail, skype, etc. These applications require sound, and without multiplexing I can't hear the phone ring if I'm listening to music. So, I needed a new multiplexer.

In comes dmix. dmix is alsa's own multiplexing solution. It's built right in, no need to use some other protocol, or some daemon that's too smart for it's own good. It's not shiny, it's not featureful, but it's simple and works. To make it the default you just edit the file "/etc/asound.conf". I'm not going to go into details on how, there's plenty of pages out there on how, but should you want this basic feature, without some heavyweight solution, give it a try.

Update

Someone requested some references, I hadn't bother as I had little trouble finding them but I may have gotten lucky. So here we go

5 comments:

  1. OSS was the one that did little more than hardware abstraction.

    Alsa has so much abstraction it not only lets you do software mixing but you can even set the sound daemons as backends. But that doesn't seem to have stopped more sound daemons from being written.

    ReplyDelete
  2. Introducing an encompass sound framework inside your home can end up being to some degree complex or it can end up being simple. Vizio s2121w-d0

    ReplyDelete
  3. Say for example, virtual surround system is efficient is giving out quality sound just like the multi-surround sound speakers does, but with fewer cables and minimal speakers.https://www.amplifierexperts.com/how-to-choose-an-amplifier-for-your-cars-sound-system/

    ReplyDelete
  4. Surround sound systems, whatever the brand is, have the same sound principle. Say for example, virtual surround system is efficient is giving out quality sound just like the multi-surround sound speakers does, but with fewer cables and minimal speakers.read more

    ReplyDelete