How to set jackd -n option equivalent with pipewire?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
magill
Established Member
Posts: 27
Joined: Wed Apr 05, 2023 9:11 am
Has thanked: 12 times
Been thanked: 9 times

How to set jackd -n option equivalent with pipewire?

Post by magill »

I've been trying to set up ["api.alsa.period-num"] in 50-alsa-config.lua but I don't think it works. If I set it to 3 and buffer size to 64 at 48kHZ, reaper and qjackctl report 1.3ms and it should be 4ms. I wanted to be able to achieve latency at multiple of 1ms as it does helps with xruns tremendously.
(https://wiki.linuxaudio.org/wiki/list_o ... _interface)

magill
Established Member
Posts: 27
Joined: Wed Apr 05, 2023 9:11 am
Has thanked: 12 times
Been thanked: 9 times

Re: How to set jackd -n option equivalent with pipewire?

Post by magill »

I think I figured out a way around it. Because pipewire seems to be stuck at 2 periods/buffer, non standard period size values of 48 96 144 192 240 288 336 384 432 480 528 seem to work perfectly. As latency reported by reaper or qjackctl with those values are whole numbers now, xruns are very low on lower setting and non when buffer size is set bit higher. The improvement over standard buffer sizes is colossal. Before, to be sure there will be no xruns during tracking, I would need 1024, now 144 is sufficient. But for simple playing guitar 48 buffer only gives occasional xruns, and usually when reaper or plugins get loaded. And 48 buffer allows latency of just 6.2ms measured with jack_delay. That is quite amazing. And my reaper is loaded with guitar and drum plugins through yabridge (helix native, jamstix, ezdrummer) which probably is quite demanding too.

Maybe someone finds it helpful, as it should be an universal solution for any usb device.

User avatar
tkna
Established Member
Posts: 13
Joined: Mon Oct 16, 2023 7:29 pm
Location: Tokyo
Has thanked: 6 times
Been thanked: 3 times

Re: How to set jackd -n option equivalent with pipewire?

Post by tkna »

@magill I set the buffer size to 48 with qjackctl on pipewire-jack based on your post, and the Latency for qjackctl and REAPER is 1.0ms, and 8.515ms as measured with jack_delay via the physical mixer. It certainly seems to cause xruns occasionally, but it is useful for performance. You are right, if I set it to 144 during recording, it seems fine. This seems like a pretty reasonable setup. Thanks for letting me know.

20231017-051716_screenshot.png
20231017-051716_screenshot.png (100.92 KiB) Viewed 2936 times
Last edited by tkna on Mon Oct 16, 2023 8:42 pm, edited 3 times in total.
magill
Established Member
Posts: 27
Joined: Wed Apr 05, 2023 9:11 am
Has thanked: 12 times
Been thanked: 9 times

Re: How to set jackd -n option equivalent with pipewire?

Post by magill »

Glad it helped someone. I've been on a mission lately and mentioning it here and there, as I thought that I have to live with higher latency, if I want to use pipewire. I could go lower with plain jack but pipewire is so bloody convenient.

User avatar
tkna
Established Member
Posts: 13
Joined: Mon Oct 16, 2023 7:29 pm
Location: Tokyo
Has thanked: 6 times
Been thanked: 3 times

Re: How to set jackd -n option equivalent with pipewire?

Post by tkna »

What is the latency of jack_delay in your plain JACK environment?
I am using sway, which is a Wayland environment, and I am wondering if I should change to JACK as they describes.
https://github.com/chmaha/ArchProAudio#pipewire

Pipewire?
In short, no, don't do it if you are a pro audio user. I don't believe it is ready for primetime.

User avatar
sysrqer
Established Member
Posts: 2527
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 320 times
Been thanked: 153 times
Contact:

Re: How to set jackd -n option equivalent with pipewire?

Post by sysrqer »

tkna wrote: Thu Oct 19, 2023 2:57 am

In short, no, don't do it if you are a pro audio user. I don't believe it is ready for primetime.

I wish people would stop parroting this.

magill
Established Member
Posts: 27
Joined: Wed Apr 05, 2023 9:11 am
Has thanked: 12 times
Been thanked: 9 times

Re: How to set jackd -n option equivalent with pipewire?

Post by magill »

tkna wrote: Thu Oct 19, 2023 2:57 am

What is the latency of jack_delay in your plain JACK environment?
I am using sway, which is a Wayland environment, and I am wondering if I should change to JACK as they describes.
https://github.com/chmaha/ArchProAudio#pipewire

Pipewire?
In short, no, don't do it if you are a pro audio user. I don't believe it is ready for primetime.

Latency measured with jack_delay in jack and pipewire-jack is pretty much identical (6.2ms with 48 buffer). As well as overall performance. That statement from the link you posted is now 2 months old and there have been some good changes to pipewire since then, especially in the latest release.
Maybe there are some pro audio use cases where jack still has some advantages but I'm not aware of any.

User avatar
tkna
Established Member
Posts: 13
Joined: Mon Oct 16, 2023 7:29 pm
Location: Tokyo
Has thanked: 6 times
Been thanked: 3 times

Re: How to set jackd -n option equivalent with pipewire?

Post by tkna »

magill wrote: Thu Oct 19, 2023 9:33 am

Latency measured with jack_delay in jack and pipewire-jack is pretty much identical (6.2ms with 48 buffer).

Thanks, it seems that pipewire-jack is practical enough as it is.
I was depressed thinking I would have to switch to JACK and imagine the trouble ahead, but thanks to the pipewire update and you, I did not have to do those things.

In REAPER, I wonder if it is smarter (pipewire-native) to use this ALSA setting?
https://forum.cockos.com/showthread.php ... re+default

From a naive verification, it does not look much different from pipewire-jack as far as latency is concerned.

20231020-015236_screenshot.png
20231020-015236_screenshot.png (191.82 KiB) Viewed 2739 times

Correction: I think there was a mistake in the above. In my environment, if I leave Periods at 2, playback is disabled, and if I set it to 3, playback is enabled but the input/output latency is 1.0ms/2.0ms.

magill
Established Member
Posts: 27
Joined: Wed Apr 05, 2023 9:11 am
Has thanked: 12 times
Been thanked: 9 times

Re: How to set jackd -n option equivalent with pipewire?

Post by magill »

I don't have 'default' device option there in reaper and if I choose my audio interface it locks it for other program. Also for some reason my CPU gets very busy and my laptop hot with alsa.
And I'm not sure if xruns can be monitored in plain alsa, sort of important for recording.
To my understanding, latency should be the same-ish as jack/pipewire-jack work on top of alsa anyway and are meant to make it easier to route and make different programs work together nicely (among other things).
I'm happy with pipewire at the moment so I'll keep it simple and stick with it.

User avatar
tkna
Established Member
Posts: 13
Joined: Mon Oct 16, 2023 7:29 pm
Location: Tokyo
Has thanked: 6 times
Been thanked: 3 times

Re: How to set jackd -n option equivalent with pipewire?

Post by tkna »

magill wrote: Thu Oct 19, 2023 7:01 pm

I'm happy with pipewire at the moment so I'll keep it simple and stick with it.

It certainly looks like it would be more correct to unify the setup with pipewire-jack for now. Thanks kindly.

User avatar
tkna
Established Member
Posts: 13
Joined: Mon Oct 16, 2023 7:29 pm
Location: Tokyo
Has thanked: 6 times
Been thanked: 3 times

Re: How to set jackd -n option equivalent with pipewire?

Post by tkna »

#pipewire@oftc told me that I could set it up with the following.

~/.config/pipewire/jack.conf.d/override.conf

Code: Select all

jack.properties = {
           node.force-quantum = 144
    #      node.force-quantum = 96
    #      node.force-quantum = 48
}

To change to an arbitrary value

Code: Select all

pw-metadata -n settings 0 clock.force-quantum 144
pw-metadata -n settings 0 clock.force-quantum 96
pw-metadata -n settings 0 clock.force-quantum 48

# default
pw-metadata -n settings 0 clock.force-quantum 0

To specify for each application

Code: Select all

PIPEWIRE_QUANTUM=48/48000 reaper

Or create a rule in .conf above
https://gitlab.freedesktop.org/pipewire ... ings-rules

Post Reply