[PLUG] KXStudio, JACK, ALSA, and Linux apps

Keith Lofstrom keithl at gate.kl-ic.com
Mon Aug 18 21:16:54 UTC 2014


Not a problem, but a possible solution to a sound problem.

Yesterday at Linux Clinic, I spent the whole session attempting
to help Barry, an musician from Monmouth, who appeared with an
older laptop configured for dual boot.  On one partition, Ubuntu
14.04.1, on the other, KXStudio, a specialized Debian distro for
professional music studios, with a low latency kernel and other
optimizations for sound handling. 

Barry had done a pretty good job setting the system up on his own,
especially for a non-software person; those who say Linux is "too
hard" aren't paying attention.

His problem?  Firefox and Chromium and Skype and other sound-using
apps worked fine when Ubuntu was booted, but would not pass sound
to the speakers or headphone socket when the KXStudio distro was
booted.  Barry's music gear made sound with KXStudio just fine. 

The problem seems to be ALSA (Advanced Linux Sound Architecture),
which will only listen to one application at once.  KXStudio uses
a sound architecture called JACK, which will accept dozens of
inputs, mix them, and monopolize ALSA for output.  For speed
and latency issues, this seems to be wired straight into the
kernel, so nothing besides JACK can produce sound through ALSA.

This screws up other Linux applications trying to use ALSA, but
that is actually good - if you are mixing a record, you don't
want error beeps and other notifications in the sound channel.

Our workaround, only partly completed at the end of the clinic,
is to run Ubuntu inside virtualbox, and for Barry to purchase
a $10 USB audio dongle.  Although we could not verify this, my
recollection is that virtualbox gives you your choice of sound
hardware for its sound output, and if there is a USB sound
device, second sound card, or whatever, you can select that during
setup.  If Barry can use a USB dongle with a separate output for
headphones, he is still free to patch that output back through a
microphone input to JACK, so he can (for example) play along with
a Youtube video, but otherwise the sound systems remain separate.

There may be other options - perhaps there is a patch for
Virtualbox to feed JACK.  Virtualbox can feed pulseaudio or OSS,
and there are kernel hacks to feed those into JACK, but those
produce inferior sound, and probably mess with kernel latency. 
Ten bucks for a USB dongle provides a portable solution that
uses cheap hardware instead of CPU cycles to get the job done.  

In real studios, the solution is multiple computers, which is
why nobody has tried too hard to tweak KXstudio to work with
Linux sound applications like firefox.

Keith

P.S. We also learned that there is no easy way to set up 
virtualbox installing a guest distro from a thumb drive.  We
spent way too much time on that, and finally burned 14.04 onto
a DVD.  Virtualbox, any color you want as long at it's black.
Manditory Options.  See Figure One.

-- 
Keith Lofstrom          keithl at keithl.com



More information about the PLUG mailing list