JACK buffer size unaffected by changes made in QJackCtl

Hello again!

I am trying to reduce audio latency in my system. Supposedly, the QJackCtl app lets me control JACK parameters via its GUI. (I’d be just as happy to use a config file but I can’t find one.) When I use QJackCtl to stop JACK, change the buffer size, and then restart JACK, the buffer size as revealed by the jack_bufsize shell command is still 1024.

And yet QJackCtl definitely has some effect – it affects the signal graph, and it warns me if I try to close it while my DAW (Reaper) is running.

I’ve looked around and can find nothing about configuring the JACK buffer size from my NixOS config. I thought maybe I should look instead at configuring pipewire, because I think pipewire is controlling JACK, because my config looks like this:

  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = false;
    jack.enable = true;
  };

But according to the wiki[1], pipewire’s default buffer sizes are already tiny – 32 out of 48000 samples per second.

[1] PipeWire - NixOS Wiki

If it helps, here are the avenues of investigation I have tried so far.

Does services.pipewire.extraConfig.jack allow one to configure JACK via PipeWire?

The option exists on search.nixos.org[1]. It says to refer to the PipeWire wiki page[2] for examples, but that page gives no examples for extraconfig.jack. I tried looking at the option’s declaration[3] but it is withcraft to me.

[1] NixOS Search

[2] PipeWire - NixOS Wiki

[3] nixpkgs/nixos/modules/services/desktops/pipewire/pipewire.nix at a73246e2eef4c6ed172979932bc80e1404ba2d56 · NixOS/nixpkgs · GitHub

Do I need to manually configure QJackCtl, in particular for DBus or JackDBus?

On the NixOS Wiki page for JACK[4], there’s a subsection titled “Configure QjackCtl”. It refers to things that don’t exist for me. For instance, the first image in that subsection says to choose jackdbus for the server path, but that’s not an option for me. The next image says to enable the DBus interface. It does not mention JackDBus. My version of QJackCtl offers both. Hunting around online suggests they are alternatives – that is, one cannot use both at once.

That Wiki page talks a lot about PulseAudio, and only mentions PipeWire (which I believe is lately the default interface for NixOS) in the context in which Pipewire was installed without Nix. That leads me to think maybe it is out of date. Be that true or false, I haven’t figured out how to act on what it says.

[4] JACK - NixOS Wiki

Solved, with the help of Reddit user LithiumFrost. In brief, the solution was to configures JACK declaratively via Nix, under Pipewire, and to not ask for a latency below what my computer can handle (128/48000).

Note that this config renders exactly some of QJackCtl’s controls useless. In particular, QJackCtl still can control the signal graph, but it cannot control the buffer size. (This can be verified by running jack_bufsize in the shell after supposedly changing it in QJackCtl.)

Here are the Reddit thread[1] and my config as of the commit that got it working[2].

[1] Reddit - Dive into anything

[2] nixos-experiments/config/configuration.nix at 27a5eef960229f095aa6c29f794d49bda0223d72 · JeffreyBenjaminBrown/nixos-experiments · GitHub

Also:

  1. Helpful when testing, you can run any jack program with the environment variable PIPEWIRE_QUANTUM to force a specific buffer size. For example:

    PIPEWIRE_QUANTUM=128/48000 carla
    
  2. For faster debugging of pipewire configs (e.g. jack.rules), edit the file ~/.config/pipewire/jack.conf.d/local.conf and start tweaking. Because this is client config, you don’t need to restart pipewire.service to see changes, just your jack client. Once you’re happy with the settings in local.conf, move them to your NixOS config at services.pipewire.extraConfig.jack.* and rebuild.

  3. Use pw-top to see requested quantum for each node in the graph. It will also show the number of xruns in the ERR column. With pipewire, the xrun counts reported by jack clients Carla and Ardour seem to be wrong - probably because they aren’t showing total xruns in the graph - only xruns for their own node.

  4. You can use environment variables to show more debug logging. For example:

    PIPEWIRE_LOG_SYSTEMD=false PIPEWIRE_DEBUG=4 jack_metro --bpm 60
    
  5. The pipewire documentation recently got much better. There are now man pages which supersede the janky gitlab wiki. You can type man pipewire-jack.conf, for example, or view it online.

1 Like