Linux audio
Making sound by banging rocks together 44 thousand times per second
April 23, 2018 — May 1, 2022
Professional audio IO on Linux: possible, but not fun.
1 General setup
The low latency kernel is usually recommended for audio.
However, try without. I found that with my system, the linux-lowlatency
setup led to frequent problems; The razer blade laptop would frequently reboot upon waking from sleep. There are some vague mentions on the internet about how this is maybe to do with interaction with the NVIDIA GPU drivers, and other miscellaneous speculation, but nothing that seems so certain or updated that I will bother linking to it. Further, as an intermittent problem, it will take longer to debug than I have in my life to make music.
2 Using Windows VSTs on Linux
As distinct from running Linux VSTs on Linux, which is now a thing apparently? Not, AFAIK, a common thing.
Apparently, it is sometimes possible if painful to run Windows VSTs on Linux. Not, crucially, for Native Instruments whose Kontakt is my favourite sampler, but for others.
LinVst and vst-bridge seem to be actively supported methods. (Of historical note, the dead projects vstserver and dssi-vst.)
3 Ontology of Linux sound systems
🏗 Include the different standards, sub-standards, compatibility layers, compatibility layers standards, legacy and surly coexistence APIs.
See the lengthy techradar intro or the optimistic ubuntu studio intro. The practical renoise intro gets you there
What I took from this is that there are a lot of standards that interact in complicated ways, but only some of them matter, probably.
Pulseaudio is the amateur version in that it is universally supported everything works without you thinking about it (and crucially, everything works at once, so you can play audio through your DAW and also preview samples in your sample previewer without quitting one or the other), but it doesn’t necessarily work well. Failure modes, notably being sloooooow, glitching, not supporting fancy routing.
Jack is the “pro” version that supports realtime operation and such. Jack is itself a rather complicated nest of standards, but it seems you can ignore a lot of the weirdness and just choose the default implementations of all the internal bits and everything works ok. Bitwig for example, works beautifully on Jack but is prone to glitches in Pulseaudio mode.
There is also ALSA a backend driver layer that some pro-audio apps use to directly talk to the soundcard (and which Jack and Pulseaudio can use?) Where an app uses ALSA directly it will lock the rest of the system out of access to the soundcard, but the app that has stolen will work beautifully.
As far as I can tell, if you do several different things with your computer the aspirationally working setup is Jack with a Pulseaudio front-end and an ALSA back-end. However, the system defaults are typically far from this.
UPDATE: Pipewire is the new hotness. It attempts, apparently, to unify Jack, Pulseaudio and all the other stuff in a way which works well with sandboxed apps and Wayland.
4 Pipewire
5 Jack
Cadence reputedly eases much pain in managing the Jack infrastructure, and is recommended by Bitwig users.
- How do I refer to a soundcard so that the name always works?.
- Difference between qjackctl and patchbay.
- Beginner’s guide to Jack via a DAW (Ardour)
- Ubuntu recommends using a GUI for config then persisting to disk.
- How to add extra sound cards to your Jack setup
- see further instructions under audio routers.
5.1 NSM
Setting up a Jack config including the routing between various apps is handled by the nsm
ecosystem, which is a great idea, but riven by interpersonal strife.
Here is some information about the complicated strife:
- Non Session Manager vs New Session Manager : linuxaudio
- Non Session Manager vs New Session Manager
- Non maintainer claims free software under attack
As a veteran of community volunteering I recognise this kind of grumpiness, and suggest we just ignore it in favour of using whatever works.
Here are two apparently-compatible backends, supported by two different teams of different aesthetics, who hate each other because of their poor community process and social skills. I suspect they both work and are both well-intentioned.
- New Session Manager
- Non Session Manager (seems to be rather hard to install because the maintainer is busy fulminating rn)
- Agordejo is an
nsm
gui - RaySession is also an
nsm
gui
6 PulseAudio
The advice seems to be basically: don’t touch the configuration if you possibly can. The defaults work. That’s the whole point. However, I have had limited success with that approach.
Manuel Amador Briz CC BY-SA 3.0:
7 Jack + PulseAudio
While PulseAudio is running, JACK cannot access the same soundcard that Pulse is using. Even though in theory ALSA provides mechanisms for this to be possible (e.g. “dmix” device access), they do not work well enough to support both of these systems reliably.
What worked for me is the recent qjackctl method:
Then configure qjackctl to run the following command after startup. > Copy it into “Setup…” > “Options” > “Execute script after Startup”:
This seems to work. (reboot is required to get the modules working correctly.)
Background: this is the apotheosis of option 3 of the many types of interaction between PulseAudio and Jack.
You can also use the KXStudio method, which I have not tried:
Install Cadence from the KXStudio repositories. From within Cadence you can enable the ALSA and PulseAudio bridges with the GUI. Done.
Of course, for this you need to install the KXStudio repositories.
A comprehensive walkthrough of the potentials and pitfalls of this method is the asbak’s run-through.
8 The Bitwig way: Jack and maybe ALSA
Here is a recommended setup for
sudo apt-get install alsa-tools alsa-tools-gui alsamixergui patchage jackd2 \
jackd2-firewire qjackctl a2jmidid gmidimonitor
See also Linux realtime audio config.
9 Elk
I wonder if this minimalist audio OS makes life better