Wednesday, November 10, 2010

Real time audio and Ubuntu Studio

I've have been trying to work with the Linux audio recording and editing software for some time now, but it's not been quite a very satisfying experience. One of the problems I had and wasn't able to solve was the real time kernel issue: the soundserver jackd needs for some things to work properly, to run on a real time enabled kernel. And the thing is I couldn't find the right information in the internet to help me out with this (in fact it's surprisingly easy).

So recently I read about Ubuntu Studio, a Linux distro based obviously on Ubuntu which focuses mostly on audio and video recording and editing stuff. And I read about the kind of tuned kernel the distro was shipped with... and I decided to give a try.
I download the latest one (10.10) and, though it's not a live distro, which I didn't expect and I thing it's a pity that you can't try it without installing it, I nevertheless had a spendable partition on which I could install it. It's a pretty normal Debian installer, quite straight forward, and … congratulations to the Ubuntu Studio guys, they've done a great job! There's lots of interesting software, some of which I never heard (or read) of before.
The point of all this is actually, you don't have to really install a Ubuntu Studio if you already have an Ubuntu (or any other Linux installed) and you don't want to have more than one distro. Just install it to a virtual image (maybe there are already some virtual images available out there), try the software they ship with it, and copy their configuration settings.
And, as for what was my original problem, the real time linux kernel, just put the appended file (the Ubuntu Studio guys named it audio.conf) into /etc/security/limits.d (if the directory limits.d doesn't already exist, just create it), and put this lines into it:
# Provided by the jackd package.
#
# Changes to this file will be preserved.
#
# If you want to enable/disable realtime permissions, run
#
# dpkg-reconfigure -p high jackd
@audio - rtprio 95
@audio - memlock unlimited
#@audio - nice -19

and, of course, check that your user (the user you start the audio programs with) belongs to the 'audo' group.

Actually, it' easier than that: on a debian-like system, if jackd is already installed, and as the previous audio.conf file suggests, just execute:
dpkg-reconfigure -p high jackd
Or choose 'yes' in a fresh jackd install.

Another possibility is, if you already have a Ubuntu up and running, install the Ubuntu Studio related packages and you don't need the whole new Ubuntu Studio distro.