Nothing on the internet is forever, so for posterity's sake, here is most of the text on the link. I'm using Jack instead of Pipewire (had trouble with Pipewire).
Important: This guide will no longer be maintained as I have not used Ubuntu-based distros in a long time. Please visit https://github.com/chmaha/ArchProAudio for up-to-date information that is generally transferable to all distros with changes to package system commands.
A Pro Audio Tuning Guide for Ubuntu (and other Ubuntu/Debian-based distros)
Following this guide will hopefully allow you to get the best possible performance on Linux for professional audio needs. Even though these steps are well-tested, it is wise to research what each step accomplishes and why (the search engine is your friend ).
Fundamentals
To get started after installing Ubuntu, you could try just steps 2, 4 and 6 below. If you need to use windows plugins on Linux also follow step 12 (easy: wine-staging, more advanced but potentially more performance: wine-tkg). Based on your individual pro audio needs, workflows, hardware specifications and more, your mileage may vary. If you are still having audio performance issues, try following the full guide...
Pipewire?
Ubuntu includes a way of switching to Pipewire (see https://ubuntuhandbook.org/index.php/20 ... untu-2204/ & https://pipewire.org/ for more details). You may choose to wait until it ships as default in future releases although it is just as easy to roll things back. To switch to Pipewire run:
sudo apt install pipewire-audio-client-libraries libspa-0.2-bluetooth libspa-0.2-jack
sudo apt install wireplumber pipewire-media-session-
sudo cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/
sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/
sudo ldconfig
sudo apt remove pulseaudio-module-bluetooth
systemctl --user --now enable wireplumber.service
pactl info
Be sure to say 'yes' to removing conflicting packages. Reboot! It would also be wise to install a graph manager like qpwgraph to be able to make connections between apps and devices:
In distros that use Ubuntu 22.10 or Debian 12 repos and higher:
sudo apt install qpwgraph
otherwise,
flatpak install flathub org.rncbc.qpwgraph
For information on setting up flatpak see https://www.flatpak.org/setup/.
That should give you everything you need to get up and running. I consider Pipewire ready for primetime at this point. For Debian-specific instructions please see For Debian in particular see https://wiki.debian.org/PipeWire.
Pipewire configuration
If you want to change the default samplerate, buffer size etc, you need to copy /usr/share/pipewire/pipewire.conf over to /etc/pipewire/ and uncomment a few lines:
2022-04-19_09-19
To temporarily change samplerate/buffer size do not use PIPEWIRE_LATENCY environment variable. Instead, use:
pw-metadata -n settings 0 clock.force-rate <samplerate>
and
pw-metadata -n settings 0 clock.force-quantum <buffer-size>
To return to default values:
pw-metadata -n settings 0 clock.force-rate 0
and
pw-metadata -n settings 0 clock.force-quantum 0
See https://gitlab.freedesktop.org/pipewire ... uffer-size and https://gitlab.freedesktop.org/pipew...ormance-tuning for more details.
Back to ALSA/Pulse?
In the unlikely event you need to switch back:
sudo apt remove pipewire-audio-client-libraries libspa-0.2-bluetooth libspa-0.2-jack
sudo apt install pipewire-media-session wireplumber-
rm -f ~/.config/systemd/user/pipewire-session-manager.service
systemctl --user --now enable pipewire-media-session
If the sound still isn't working:
systemctl --user --now disable pipewire-pulse.service pipewire-pulse.socket
systemctl --user --now reenable pulseaudio.service pulseaudio.socket
substituting --user for --global if you originally enabled globally.
Full In-depth Guide
- Install a flavor of Ubuntu (or other favorite Ubuntu-based or Debian-based distro)
To make your life easier, install either Ubuntu Studio or AVLinux. Almost all of the following tweaks are taken care of. Otherwise, pick a regular distro such as Ubuntu, MXLinux etc.
- Install a low-latency kernel (Ubuntu-based)
sudo apt update && sudo apt upgrade -y
sudo apt install linux-lowlatency
reboot
Or, for even better performance:
Liquorix (Debian-based or Ubuntu-based)
sudo apt update && sudo apt upgrade -y
sudo apt install software-properties-common apt-transport-https wget ca-certificates gnupg2 ubuntu-keyring -y
sudo add-apt-repository ppa:damentz/liquorix -y
sudo apt update
sudo apt-get install linux-image-liquorix-amd64 linux-headers-liquorix-amd64 -y
reboot
- rtcqs (formerly known as realtimeconfigquickscan)
git clone https://codeberg.org/rtcqs/rtcqs.git
cd rtcqs
./src/rtcqs/rtcqs.py
- Add user to audio group and configure realtime privileges
I believe that installing jackd2 takes care of the following these days. It is always worth double-checking especially if using pipewire.
sudo nano /etc/security/limits.d/audio.conf
Add the following lines:
@audio - rtprio 95
@audio - memlock unlimited
Then create an audio group (if it doesn't exist already) and add your user to it:
sudo groupadd audio
sudo usermod -a -G audio $USER
Log out/in or reboot...
- Add "threadirqs" as kernel parameter
sudo nano /etc/default/grub
change GRUB_CMDLINE_LINUX="" to GRUB_CMDLINE_LINUX="threadirqs"
sudo update-grub
- Set governor to "performance"
i. Temporary:
sudo cpupower frequency-set -g performance
ii. Permanent:
Add cpufreq.default_governor=performance as a kernel parameter:
sudo nano /etc/default/grub
LIne should now read:
GRUB_CMDLINE_LINUX="cpufreq.default_governor=performance threadirqs"
sudo update-grub
or, for kernels < 5.9:
sudo nano /etc/default/cpupower # uncomment governor and change to performance
systemctl enable --now cpupower.service
systemctl start cpupower.service
- Swappiness
sudo nano /etc/sysctl.d/99-sysctl.conf
add "vm.swappiness=10"
- Spectre/Meltdown Mitigations
If you run rtcqs.py and it gives you a warning about Spectre/Meltdown Mitigations, you could add mitigations=off to GRUB_CMDLINE_LINUX. Warning: disabling these mitigations will make your machine less secure! https://wiki.linuxaudio.org/wiki/system ... itigations
- Install udev-rtirq
git clone https://github.com/jhernberg/udev-rtirq.git
cd udev-rtirq
sudo make install
reboot
- Jack2 + Jack D-Bus (skip this step if you switched to Pipewire)
sudo apt install qjackctl jackd2
Enable Jack D-Bus interface:
image
- DAW & Plugins
REAPER: http://reaper.fm/download.php