Low latency kernels

Ubuntu, Kubuntu

A low latency kernel is included as part of Ubuntu Studio. If you are running any other variant of Ubuntu Feisty (eg. Kubuntu) you can add the Studio components to your existing installation.

After installation, reboot and be sure to choose the lowlatency kernel from the boot menu at startup, if it is not already the default.

Other Setups

If you don't use ubuntustudio or another specialized studio distribution, you may need to tweak certain things in your rt-kernel by hand.

First things:

1. Add yourself to the audio group. This is the group that owns the /dev/snd/* set of files and joining this group means that you too are part-owner of the audio real-estate. I suppose it might be worthwhile checking that in your setup the group ownership of the /dev/snd/* are the audio group.

In debian variants the cli command is:

adduser yourusername audio

Ubuntu users can write in terminal:

sudo usermod -a -G audio yourusername

Archlinux users can use:

sudo gpasswd audio -a yourusername

If you know the commands for other distros, please update this page.

2. Open the /etc/security/limits.conf (you will need to have admin privileges for this)

It should have a section which looks like this somewhere near the end. If it doesn't, add it.

@audio rtprio 99
@audio nice -15
@audio memlock 250000

This means that members (including devices) of the audio group have real time privileges and that devices in the audio group are not “nice” at all. They arbitrarily push other processes out of the queue to use the kernel. This is of course necessary for audio work so that you don't hear delays and clicks in your music.

These are the main ones for assuring that you can use jackd in the real-time mode. If you have further problems, you may need to search through the http://lowlatency.linuxaudio.org/ website to see what things they have to say about irq interrupts and other such arcane matters.

This page was brought to you by someone who has a very basic knowledge of what to do with an rt-kernel. I hope that someone reads this who has more knowledge and improves and updates it. Thanks to the good people on the https://lists.sourceforge.net/lists/listinfo/rosegarden-user][rosegarden-user mailing list who responded with much of the information on this page.

Shelagh Manton 2008/08/21 19:28

This is directly lifted from a mail on rosegarden-user that talks about these settings.

Other settings which might improve the audio performance are found in:

### in /etc/sysctl.conf,

### dev.rtc.max-user-freq=1024
### dev.hpet.max-user-freq=1024
### dev.rtc.max-user-freq=2048
### dev.hpet.max-user-freq=2048

Aside: If they aren't in that file, put them in and uncomment those you want to try out.

In newer kernels dev.rtc.max-user-freq doesn't exist anymore, instead it's now under /sys and therefore not configurable via /etc/sysctl.conf (as far as I know). Therefore alternatively the following two lines in /etc/rc.d/rc.local can do the same thing:

echo 2048 >/sys/class/rtc/rtc0/max_user_freq
echo 2048 >/proc/sys/dev/hpet/max-user-freq

You are free to try with different values, but some of those changes will require a new login session, and/or a reboot to take effect. So if you are not sure, a reboot would be better, and also ensures that it does the same thing if you do need to reboot from time to time. You can also experiment to learn about those.

Of course after all those, jackd command line parameters will be crucial for xruns issues. I use mainly onboad/built-in audio chips (snd_intel8x0 module), I also use a SoundBlaster Live! card. Here are the parameters I use for the SoundBlaster Live! card, I believe it also works fine with the Intel onboard audio chipset.

 /usr/bin/jackd -R -P10 -dalsa -dhw:1 -r44100 -p128 -n2

Shelagh Manton 2008/08/21 19:28

low-latency_kernels.txt · Last modified: 2022/05/06 16:07 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki