Ardour and pipewire-jack quantum/sample rate settings

Hi, I don’t know if this has already been discussed, but in Linux, when using pipewire-jack, you can customize the quantum/sample rate settings for each individual Jack client in the .config folder. This allows them to start with their own specific quantum/sample rate settings. This is especially useful if you don’t want all your programs to run with the same settings. For example, you might want to listen to audio from your browser, or from the Strawberry player, and also open a DAW. With individual settings, each program gets its intended quantum/sample rate settings. This prevents ALL programs from having to run with the same audio settings, as is the case when using a program like Cable, or when changing the system-wide values ​​via the terminal. Such changes are always system-wide. All programs, even if they don’t actually need them, then get the same settings, which leads to increased resource consumption and, of course, more frequent xruns.

Now to the actual problem: The above-mentioned procedure works very, very well with Qtractor and Hydrogen, for example, as well as with Firefox and several other programs, but unfortunately not at all with Ardour and the very outdated LMMS.

I don’t rule out that I’m doing something wrong myself, but by now I’m certain that the problem lies with the programs themselves. Yes, in Ardour you can directly select pipewire-jack in the settings and then also set the quantum. So far, so good. However, you can’t also set the sample rate there if you want to use pipewire-jack. Ardour always starts with the default pipewire setting, which is known to be 48,000 Hz. Changing the sample rate to 96,000 Hz for Ardour is only possible via a prior system-wide setting, which then affects every program.

Is this something that will change in the future?

If you have allowed 96000 in pipewire.conf, for example

default.clock.allowed-rates = [ 96000 48000 44100 ]

then something like this should be possible, start in terminal:

PIPEWIRE_LATENCY=128/96000 pw-jack ardour

or create a custom.conf in ~/.config/pipewire/jack.conf.d

# ~/.config/pipewire/jack.conf.d/custom.conf
 
jack.rules = [
    {
        matches = [
            {
                # all keys must match the value. ! negates. ~ starts regex.
                application.process.binary = "ardour"
            }
        ]
        actions = {
            update-props = {
                node.latency = 128/96000
            }
        }
    }
    {
        matches = [
            {
                client.name = "ARDOUR"
            }
        ]
        actions = {
            update-props = {
                jack.show-monitor = true
                jack.merge-monitor = false
            }
        }
    }
]

Side-note: pw-jack is a utility that really only has a purpose on systems where someone has decided not to make the pipewire implementation of JACK the default. If you’re using pipewire as your JACK server, the config file is the only current way to approach this.

As for the future, hard to say. The problem arises because if pipewire is being used, then from the POV of a JACK client, JACK is already running, and the JACK API does not allow changing sample rates (intentionally). You can only set the SR when starting JACK, but with pipewire running, it has already been (effectively) started for you.

It would be necessary to add some pipewire-specific code to set the SR, and we’re rather reluctant to do that.

That is counter to the way JACK is designed to work, so there may be issues to watch out for.
Although the examples you gave are not actually native JACK clients, so a browser would likely be using the Pulse API, not JACK, so would not have assumptions about JACK behavior inherent in the design like Ardour would. In that case extra buffering performed by the pipewire server to bridge between JACK and Pulse APIs would not cause any problem.

For applications which intentionally do use the JACK API you can set the quantum advertised by the JACK server using this utility:
pw metadata UI

That link is to a differnt post in the Ardour forums. The utility was originally developed by Glenn for MX Linux, but someone else broke it out separately and modified it slightly.