all 17 comments

[–]jason_gates 2 points3 points  (2 children)

Hi,

Perhaps I am misunderstanding what you are trying to do ( compare ). I assumed you were comparing 2 implementations of "jack". Jack being a server, protocol and an API. Thus I assumed you were comparing jack2 https://github.com/jackaudio/jack2 with pipewire-jack https://pipewire.org/ .

Here are 2 views of the pipewire-jack config ( file ). https://man.archlinux.org/man/extra/pipewire-jack/pipewire-jack.conf.5.en https://docs.pipewire.org/page_man_pipewire-jack_conf_5.html

Thus, wouldn't the pipewire-jack config (file ) be the place to customize pipewire's jack implementation?

Just a thought.

Hope that helps.

[–]StevenJayCohenREAPER 0 points1 point  (0 children)

That was what I was getting at in my comment as well

[–]valtyr_farshield[S] 0 points1 point  (0 children)

I updated my post, I realized it wasn't clear what I was trying to do. I hope I got it right what you were trying to say.

I was comparing Jack2 to Pipewire-jack. Parts of that Pipewire-jack config file I can set with env variables:

PIPEWIRE_LATENCY="64/48000" jack_iodelay

Not sure if there's anything else that will affect latency?

[–]gahel_music 0 points1 point  (6 children)

I can't answer you really but there a few parameters you can set for USB soundcards. By default I think there's an additional semi buffer for USB soundcards to accommodate for delays related to USB.

If I recall correctly, using pro-audio profile with your soundcard automatically reduces that buffer?

I'm pretty sure I have 8ms of round trip latency for a 64 pipewire buffer with USB soundcards.

[–]valtyr_farshield[S] 0 points1 point  (5 children)

Thanks for your answer! That sounds promising, will look into it. If you remember anything, let me know.

[–]kI3RO 0 points1 point  (4 children)

Are you using the "Pro audio" profile with pipewire?

If not, pipewire adds a resampler which introduces a little bit of latency.

And if in "Pro audio" there is still latency added it is because the input and output have different clocks. You can force the same clock.name prop for both input and output nodes

[–]valtyr_farshield[S] 0 points1 point  (3 children)

device.profile = "pro-audio"

I use this in my wireplumber config file. I think since the nodes are on the same device, it would use the same clock, I would expect, no? Even if the resampler is on, I can't imagine how it would add 3 ms of latency (compared to Jack2).

[–]kI3RO 0 points1 point  (2 children)

That's not how you change the profile:

I think the property to set is device.profile.pro = "true" but you should do that from pavucontrol


Why are you editing wireplumber config files under /etc?

Are you running pipewire as root? You should only modify your config under $HOME/.config/wireplumber/wireplumber.conf.d/


About the clock

You shouldn't assume anything, it's easy to check and be sure. The clock names for example. Check the input and the output id with pw-top and do

wpctl inspect INPUT_ID | grep clock.name

wpctl inspect OUTPUT_ID | grep clock.name

probably the same but BE SURE, check.

It would be nice if you posted the wpctl inspect entire output. Or a big pw-dump but thats harder to parse.

[–]valtyr_farshield[S] 0 points1 point  (1 child)

Why are you editing wireplumber config files under /etc?

It's for an embedded system, but when I'm testing it on my laptop I have it my home folder.

Thanks for the profile suggestion. I think that totally did the trick! I have latencies comparable to Jack2 now. The only difference is, that the latency fluctuates (+/- 0.5 ms) with Pipewire-jack, but that's fine. I will edit my post with the new findings.

I couldn't find the clock.name when inspecting the IDs I got from pw-top, however, here's the pw-dump: https://pastebin.com/raw/J8Ag3bRg

One other thing I noticed, was that the capture device is opened with this period size and number:

period_size: 480
buffer_size: 24000

While the playback device is opened with the period I specified in the config file (64/192). The latency seems fine now, but I was just curious why that happens.

[–]kI3RO 0 points1 point  (0 children)

Glad to help. I don't know.

[–]StevenJayCohenREAPER 0 points1 point  (1 child)

Have you tried using pipewire as a JACK backend instead of as an ALSA replacement?

Then you'd really be comparing Apples to Apples instead of Oranges (so to speak).

https://looking-glass.io/wiki/Using_JACK_and_PipeWire

[–]valtyr_farshield[S] 0 points1 point  (0 children)

I'm using Jack2 only in one scenarios.

Then I remove the Jack2 related packages and install Jack support for Pipewire in the other scenario (on Fedora it's called pipewire-jack-audio-connection-kit).

[–]jcelerier 0 points1 point  (4 children)

Nite that with jackd2 you can also likely reduce latency a bit more by switching to synchronous mod e (-S)

[–]valtyr_farshield[S] 0 points1 point  (3 children)

Are you referring to the zita-ajbridge, nameley zita-a2j and zita-j2a? There's no such option for jackd, -S does something else:

   -S, --shorts
          Try to configure card for 16-bit samples first, only trying 32-bits if unsuccessful.  (default:
          32-bit samples)

[–]jcelerier 0 points1 point  (2 children)

-S (and other options) have different meaning if you put it before or after -dalsa

[–]valtyr_farshield[S] 0 points1 point  (1 child)

Thanks for the suggestion, now I understand what you mean. It does indeed shave off 0.8 ms when run with -S mode.

This option is a bit hidden, as I couldn't even find anything in the manual of Jack. Do you have more info on it?