# Linux Audio Optimizations

**URL:** <https://discourse.chair.audio/t/linux-audio-optimizations/31>\
**Category:** Linux\
**Created:** [November 8, 2019, 6:40pm UTC](https://discourse.chair.audio/t/linux-audio-optimizations/31 "2019-11-08T18:40:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max](https://discourse.chair.audio/user_avatar/discourse.chair.audio/max/32/12_2.png) [@Max](https://discourse.chair.audio/u/Max)\
**Post date:** [November 8, 2019, 6:40pm UTC](https://discourse.chair.audio/t/linux-audio-optimizations/31/1 "2019-11-08T18:40:14Z")

</div>

🐧 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](https://launchpad.net/~rncbc), [KXStudio](https://kx.studio/Repositories)
- Run Pd with [realtime priority](https://puredata.info/docs/faq/how-can-i-run-pd-with-realtime-priority-in-gnu-linux).
- ~~Use a lowlatency Kernel~~ (not necessary any more, but see details at bottom of this post).
- Install the `rtirq-init` package. [source code and readme](https://github.com/rncbc/rtirq)
- 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)](https://codeberg.org/rtcqs/rtcqs) script to scan for more recommended tweaks.

I like to compile Pd myself. For that I either download tha latest [release](http://msp.ucsd.edu/software.html) or clone the [git repository](https://github.com/pure-data/pure-data/) 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](https://lists.linuxaudio.org/listinfo/linux-audio-user), the [Linuxmusicians Forum](https://linuxmusicians.com/), the [linuxaudio subreddit](https://www.reddit.com/r/linuxaudio) (or, if you have to, in the [Linux Audio Facebook Group](https://www.facebook.com/groups/189734702059/)).

## Ressources

- [https://www.linuxaudio.org](https://www.linuxaudio.org)
- [https://wiki.linuxaudio.org](https://wiki.linuxaudio.org) (careful, largely historic information from ~ 2012)
- [Adjusting Audio Latency · mixxxdj/mixxx Wiki · GitHub](https://github.com/mixxxdj/mixxx/wiki/Adjusting%20Audio%20Latency)

### Linux Distributions for Audio Production

- [KX Studio](https://kx.studio) Repositories (for Debian or Ubuntu based Linux distributions)
- [Ubuntu Studio](https://ubuntustudio.org)
- [AV Linux](https://www.bandshed.net/avlinux)

### Linux Distributions for Embedded Audio

- [Patchbox OS](https://blokas.io/patchbox-os/) for the [Raspberry Pi](https://www.raspberrypi.org/) (+ optional Pisound Hat)
- [Elk Audio OS](https://github.com/elk-audio/elk-pi/releases) for the [Raspberry Pi](https://www.raspberrypi.org/) with Elk Pi Hat
- [Bela](https://bela.io/) for the [BeagleBone](https://beagleboard.org) with a Bela cape  
Disclosure: CHAIR is now working with the Bela Team.

> **Manual kernel install howto**
>
> - Go the kernel archive for a [lowlatency kernel](https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.15.21/) (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](https://semver.org) 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

---

<div class="post-metadata">

**Author:** ![Max](https://discourse.chair.audio/user_avatar/discourse.chair.audio/max/32/12_2.png) [@Max](https://discourse.chair.audio/u/Max)\
**Post date:** [December 18, 2021, 9:22pm UTC](https://discourse.chair.audio/t/linux-audio-optimizations/31/2 "2021-12-18T21:22:47Z")

</div>

Update 2021: [pipewire](https://pipewire.org/) 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.
