PROduction Audio On Linux With Debian 12

Disclaimer

This how I configure Linux workstations for realtime 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 take a look at Debian, Rocky, or Ubuntu LTS.


What about PipeWire?

PipeWire is a (relatively) new server under heavy development. While I’m confident that it’s the future of Linux audio I’m not a fan of testing in production.


So it begins 

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

Note: After configuring the system I will dial back the CPU frequency until the system begins generating xruns. 


1. During the install I select the XFCE Desktop Manager. This prevents Debian from installing Wayland.

 


2. After the initial install the it’s time to get a realtime 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. Crack open your motherboard manual and locate the USB holes connected directly to the CPU. Use them for your audio interface. 


And that’s how I configure workstations for realtime audio using Debian 12 and Jack. Feel free to leave questions on the YouTube video.

You can watch the system in action live on Twitch.