Linux Audio Optimizations

:penguin: Configuring a Linux system for real-time audio is a huge topic which is probably much better discussed elsewhere. There are hardly universal answers which apply to every system because it very much depends on your needs and your Linux flavor. Additionally it’s a moving target and advice becomes quickly outdated. When finding advice online, always question if it’s up-to-date.
Nevertheless we’d like to share and document some of our system tweaks and experiences. We currently use (K)ubuntu based systems, for which these suggestions apply. Please comment with your corrections or amendments.

Audio Performance Optimizations

  • Setting the system for performance CPU scaling will improve performance. You can do this conveniently from the panel using the indicator-cpufreq applet.
  • Recomended packages/repositories/PPAs: rncbc, KXStudio
  • Run Pd with realtime priority.
  • Use a lowlatency Kernel (see details at bottom of this post).
  • Install the rtirq-init package. source code and readme
  • Load the Kernel with the threadirqs option. To do so, edit /etc/default/grub and change GRUB_CMDLINE_LINUX="" to GRUB_CMDLINE_LINUX="threadirqs" and then run sudo update-grub
  • Use rtcqs (formerly known as realtimeconfigquickscan) script to scan for more recommended tweaks.

I like to compile Pd myself. For that I either download tha latest release or clone the git repository and configure it with these options:
./configure --enable-jack --disable-portaudio --disable-mmio --disable-oss --enable-fftw
This way there will be no legacy OSS-MIDI to distract and no portaudio support.

Community

Further issues may be solved with help from fellow Linux Audio users. They can be found on the Linux Audio User Mailinglist, the Linuxmusicians Forum, the linuxaudio subreddit or in the Linux Audio Facebook Group.

Ressources

Linux Distributions for Audio Production

Linux Distributions for Embedded Audio




Manual kernel install howto
  • Go the kernel archive for a lowlatency kernel (5.15.21 seems to be the newest with a lowlatency variant)
  • Navigate to the newest kernel version (If you use the proprietary NVIDIA driver you can usually only upgrade until the next minor version without breaking the graphics driver)
  • Download the following four files to your disk:
    linux-headers-{version}-lowlatency_{version}_amd64.deb
    linux-headers-{version}_{version}_all.deb
    linux-image-unsigned-{version}-lowlatency_{version}_amd64.deb
    linux-modules-{version}-lowlatency_{version}_amd64.deb
  • install with sudo dpkg -i linux-*.deb
  • reboot
2 Likes

Update 2021: pipewire has landed and makes many things a lot easier. If you are already on a pipewire system, some of the suggestions above are no longer relevant. However, beware that in a pipewire system low-latency configuration is more cumbersome to achieve as the convenient GUI tools to twak the settings don’t exist yet.