Linux audio

Making sound by banging rocks together 44 thousand times per second

Professional audio output on linux: possible, but not smooth.

General setup

The lowlatency

apt install linux-lowlatency

Using Windows VSTs on Linux

As distinct from running Linux VSTs on Linux, which is now a thing apparently? Not, AFAIK, a common thing.

Anyway, it is sometime possible to run Windows VSTs on linux apparently, if painful. 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.)

Ontology of Linux sound systems

🏗 Include the different standards, sub-standards, compatability layers, compatabiility layers standards, legacy and surly coexistence APIs.

See the lengthy techradar intro or the optimisic ubuntu studio intro.

What I took from this is that there are a lot of standards that interact in complicated ways, but only 2 of them matter, probably.

Pulseaudio is the amateur version in that it is universally supported everything works without you thinking about it, but it doesn’t neessarily work well. It’s prone to horrible failure modes, notably being sloooooow and not afaict 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.

As far as I can tell, if you do several different things with your computer you need both. How to do that is covered below.

Jack

Cadence reputedly eases much pain in managing the jack infrastructure, and is recommended by Bitwig users.

JackAss routes midi from jack-blind hosts:

JackAss is a VST plugin that provides JACK-MIDI support for VST hosts. Simply load the plugin in your favourite host to get a JACK-MIDI port. Each new plugin instance creates a new MIDI port.

Virtual ports for bidirectional patching

  • 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)

  • internal routing with JACK explains why you can’t make it do what you expect with routing sub-buses to different apps – you need lotsa virtual channels:

    With a basic implementation of JACK now set up, we can begin to tweak JACK to our needs—internal routing. For those of you with larger 8-channel interfaces, you probably have noticed a slight problem with JACK: you do not have all eight microphone inputs available anymore! This is because we need to tell JACK how many inputs we want (both in and out).

    For OS X users, simply adjust the Virtual I/O settings under Preferences until your hearts content and you should be good to go. For Linux and PC users however, things are not so easy. While the Channel I/O option sounds like a perfect match, it really does nothing most of the time. Instead we need to edit an .INI file.

    • Close down JACK, as well as any connected apps.
    • Go to where you installed JACK (most likely C:Files(x86)).
    • In the 32 or 64 bit folder (depending on what version you are using) there is a file called JackRouter.ini
    • Open JackRouter.ini with Notepad, and change the input and output values to however many channels you want. Presto!
    • Restart Jack Control, enter your DAW, and you should now have a multitude of inputs and outputs at your disposal.

    perhaps this is /etc/jackdrc and ~/.jackdrc on Ubuntu?

  • Ubuntu recommends using a GUI for config then persisting to disk.

  • How to add extra sound cards to your jack setup

TBC.

PulseAudio

Basically: don’t touch it. The defaults work. That’s the whole point.

Manuel Amador Briz CC BY-SA 3.0:

Pulseaudio muntology

Jack + PulseAudio

Jackd statement.

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:

apt install qjackctl pulseaudio-module-jack

Then configure qjackctl to run the following command after startup. Copy it into "Setup…" > "Options" > "Execute script after Startup":

pactl set-default-sink jack_out

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 pulse audio 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.

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.