Disclaimer

This how I configure Linux workstations for real-time audio using Debian 12 and Jack. If you’re thinking about doing any of this to your Desktop PC, don’t.


Why Debian?

Production systems should be predictable and stable. Debian manages both. The last thing you want is a package update to knacker your carefully crafted setup. If you’re running a rolling release Linux distribution, this is a matter of when, not if. Unfortunately, this is something people fail to understand until they experience it themselves.

If you’re looking for OS Recommendations, have a look at Debian, Rocky, or Ubuntu LTS.


What about PipeWire?

While I believe PipeWire holds promise for the future of Linux audio, it’s still under active development. This guide will utilize the mature and stable Jack server for a reliable experience.


So it begins 

0. Disable global c-state control and configure the all-core frequency. This keeps the CPU locked at the selected frequency.   


1. During the installation, I select the XFCE Desktop Manager. This prevents Debian from installing Wayland and PipeWire by default.


2. After the initial install, it’s time to get a real-time kernel. If you’re on AMD / Intel, this process is relatively straightforward. NVIDIA users will need to download and install the *.run driver package directly from NVIDIA.

Find the current Linux kernel version.

uname -a 

Locate the matching realtime kernel 

apt search linux-image-KERNELVERSION

Install the realtime kernel 

sudo apt install linux-image-KERNELVERSION-rt-amd64

3. Remove any traces of PipeWire 

sudo apt purge pipewire*

4. Install Jack, Pulseaudio Bridge, nonfree firmware, and rtirq. 

sudo apt install jackd2 qjackctl pulseaudio-module-jack firmware-linux-nonfree rtirq-init

5. Enable threadirqs and disable Spectre / Meltdown mitigations. 

sudo nano /etc/default/grub

6. Hardware timers

sudo nano  /etc/udev/rules.d/40-timer-permissions.rules

Add the following

KERNEL=="rtc0", GROUP="audio"
KERNEL=="hpet", GROUP="audio"

7. Set max user frequency 

sudo nano /etc/tmpfiles.d/maxfreq.conf

Add the following

w    /sys/class/rtc/rtc0/max_user_freq     -    -    -    -   3072

8. Swappiness and watches 

sudo nano /etc/sysctl.d/99-sysctl.conf

Add the following

vm.swappiness = 10
fs.inotify.max_user_watches = 524288

9. Setting resource limits

sudo nano /etc/security/limits.conf

Add the following 

@audio - rtprio 99
@audio - memlock unlimited

10. Add the user to the audio group

sudo usermod -a -G audio replacethiswithyourusername

11. Default values for Pulseaudio

nano ~/.config/pulse/daemon.conf

Add the following 

default-sample-format = float32le
default-sample-rate = 48000
alternate-sample-rate = 44100
default-sample-channels = 2
default-channel-map = front-left,front-right
resample-method = speex-float-10
enable-lfe-remixing = no
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 70
rlimit-rtprio = 90
daemonize = no

12. Update initramfs and reboot the system

sudo update-initramfs -u

13. Plugging your audio interface into USB ports directly connected to the CPU will result in lower latency.


And that’s how I configure workstations for real-time audio using Debian 12 and Jack. You can watch the system in action live on Twitch.

Have questions about your setup? Ask in our forums.

VennStone

View all posts

Add comment

Recent Posts