Pipewire configuration for low latency
Moderators: MattKingUSA, khz
- ycollette
- Established Member
- Posts: 96
- Joined: Sun Jul 03, 2016 8:53 pm
- Has thanked: 15 times
- Been thanked: 20 times
- Contact:
Pipewire configuration for low latency
I am struggling to configure pipewire to use in real time.
I want to play a guitar throught guitarix with a ~10 ms latency (256 samples / 48000 Hz was the configuration I used with jack).
I copied the configuration files from /usr/share/pipewire to ~/.conf/pipewire.
I removed ~/.conf/pipewire/client.conf and renamed client-rt.conf to client.conf.
I replaced all the 44100 occurrences by 48000 and every 1024 occurrences by 256.
I added my user name to the pipewire group.
I restarted my PC (the systemctl --user restart pipewire.service doesn’t seem to work fine wrt configuration files).
After that. I start my guitarix session via raysession…
I clearly hear that the latency corresponds to a 1024 samples buffer, not a 256 samples one …
When I checked via pw-top the latency, there is still a 1024 buffer on the alsa side.
Does somebody succeed to configure pipewire to be useable in real time ?
Best regards,
Yann
Audinux Fedora repository: https://audinux.github.io/
Github: https://github.com/ycollet
LMMS Music: https://www.jamendo.com/artist/471813/j ... wen/albums
Modular Music: https://www.jamendo.com/artist/537917/u ... ing/albums
-
- Established Member
- Posts: 821
- Joined: Thu Mar 21, 2013 12:55 am
- Location: Vladivostok
- Has thanked: 65 times
- Been thanked: 124 times
Re: Pipewire configuration for low latency
I didn't pipewire yet, but i've read that you need to set
Code: Select all
PIPEWIRE_LATENCY
-
- Established Member
- Posts: 108
- Joined: Sun Sep 01, 2019 12:58 pm
- Has thanked: 21 times
- Been thanked: 11 times
Re: Pipewire configuration for low latency
I didnt do any other specific configuration for low latency.
Amp: Echolette M40 / NG51S Tape Echo
Strings: Martin D15M, Yamaha FG-180, Alhambra 5P, Yamaha Revstar
-
- Posts: 1
- Joined: Fri Aug 13, 2021 2:19 pm
Re: Pipewire configuration for low latency
I'm not an english native speaker
In manjaro, I look for the "jack.conf" file.
(...)
# global properties for all jack clients
jack.properties = {
#node.latency = 1024/48000
(...)
You must uncomment this "#node.latency" line and set 256/48000 or another you may want
Restart, open Carla and verify if the change was made.
Pipewire is running ok for me. Some things are more easy to do.
Look for the explanation about substituition of your audio system for pipewire on the arch wiki, even if you are not running an arch-based distribution, to understand how it works, then you can adapt to the yours
- ycollette
- Established Member
- Posts: 96
- Joined: Sun Jul 03, 2016 8:53 pm
- Has thanked: 15 times
- Been thanked: 20 times
- Contact:
Re: Pipewire configuration for low latency
I am still not able to get the same behavior as with jack. Still a lot of XRuns and the latency is still a problem.
Somebody pointed out that a patch related to alsa was submitted recently and maybe the next version will be a good candidate to test:
https://gitlab.freedesktop.org/pipewire ... 93699b125f
I cross my fingers ...
Audinux Fedora repository: https://audinux.github.io/
Github: https://github.com/ycollet
LMMS Music: https://www.jamendo.com/artist/471813/j ... wen/albums
Modular Music: https://www.jamendo.com/artist/537917/u ... ing/albums
-
- Established Member
- Posts: 564
- Joined: Thu Mar 12, 2015 8:41 am
- Has thanked: 44 times
- Been thanked: 8 times
Re: Pipewire configuration for low latency
But...I found two things:
1 - How to set the freq & fixed buffer size dynamically (no pw restart or conf file editing needed):
Code: Select all
pw-metadata -n settings 0 clock.force-rate 48000
pw-metadata -n settings 0 clock.force-quantum 64
2 - How to set the RT priority for the pipewire thread:
The rtkit method doesn't seem to work on my system, but there's an alternative way that can be set in pipewire.conf & jack.conf:
Code: Select all
..
# Uses RTKit to boost the data thread priority.
#{ name = libpipewire-module-rtkit
# args = {
# nice.level = -11
# rt.prio = 88
# rt.time.soft = 2000000
# rt.time.hard = 2000000
# }
# flags = [ ifexists nofail ]
#}
# Set thread priorities without using RTKit.
{ name = libpipewire-module-rt
args = {
nice.level = -11
rt.prio = 88
rt.time.soft = 2000000
rt.time.hard = 2000000
}
flags = [ ifexists nofail ]
}
...
Unfortunately the performance is still not adequate for Guitarix & co (possibly because of that alsa bug), but we're making progress
-
- Established Member
- Posts: 108
- Joined: Sun Sep 01, 2019 12:58 pm
- Has thanked: 21 times
- Been thanked: 11 times
Re: Pipewire configuration for low latency
Some of his results are here:
https://pad.gieszer.link/sheet/#/2/shee ... hxncBJBD0/
He seems to be getting as low as 5-6 ms on best case scenarios.
Edit: seems like the Liquorix Kernel is getting the lowest latency.
Amp: Echolette M40 / NG51S Tape Echo
Strings: Martin D15M, Yamaha FG-180, Alhambra 5P, Yamaha Revstar
-
- Established Member
- Posts: 564
- Joined: Thu Mar 12, 2015 8:41 am
- Has thanked: 44 times
- Been thanked: 8 times
Re: Pipewire configuration for low latency
Also it seems that we can have now different buffer sizes between input and output - this might open the door to further tweaking
-
- Established Member
- Posts: 118
- Joined: Thu Oct 24, 2019 4:32 pm
- Has thanked: 3 times
- Been thanked: 16 times
Re: Pipewire configuration for low latency
Do those "tuned" kernels have the new ALSA USB audio driver? I don't think it's going to be included in the main(line) kernel until 5.15.x (don't quote me on that, but that's the latest info I got from Phoronix).gimmeapill wrote: ↑Sun Oct 24, 2021 8:06 am Thanks, that is very interesting: none of the sub 10ms round trip latency figures were achieved with the stock Arch or RT kernel, but with RT-BFQ or LQX.
Also it seems that we can have now different buffer sizes between input and output - this might open the door to further tweaking
Kernel variations shouldn't have a notable effect on round trip latency values in general, right? The differences have mostly to do with how quickly you're going to have xruns when the CPU / DSP load increases.
- ycollette
- Established Member
- Posts: 96
- Joined: Sun Jul 03, 2016 8:53 pm
- Has thanked: 15 times
- Been thanked: 20 times
- Contact:
Re: Pipewire configuration for low latency
The tuning you must make for low latency:
https://gitlab.freedesktop.org/pipewire ... nce-tuning
And something about rtkit:
https://githubmate.com/repo/heftig/rtkit/issues/25
Audinux Fedora repository: https://audinux.github.io/
Github: https://github.com/ycollet
LMMS Music: https://www.jamendo.com/artist/471813/j ... wen/albums
Modular Music: https://www.jamendo.com/artist/537917/u ... ing/albums
-
- Established Member
- Posts: 219
- Joined: Mon Mar 01, 2021 10:56 pm
- Has thanked: 51 times
- Been thanked: 92 times
- Contact:
Re: Pipewire configuration for low latency
As mentioned there you may need to adjust the ALSA period size if everything sounds all garbled.
- ycollette
- Established Member
- Posts: 96
- Joined: Sun Jul 03, 2016 8:53 pm
- Has thanked: 15 times
- Been thanked: 20 times
- Contact:
Re: Pipewire configuration for low latency
Audinux Fedora repository: https://audinux.github.io/
Github: https://github.com/ycollet
LMMS Music: https://www.jamendo.com/artist/471813/j ... wen/albums
Modular Music: https://www.jamendo.com/artist/537917/u ... ing/albums
- sysrqer
- Established Member
- Posts: 2527
- Joined: Thu Nov 14, 2013 11:47 pm
- Has thanked: 320 times
- Been thanked: 153 times
- Contact:
Re: Pipewire configuration for low latency
What's the benefit or reason for using wireplumber instead of the session manager?robbert-vdh wrote: ↑Mon Jan 03, 2022 5:38 pm You may also want to give my configuration a try: https://github.com/robbert-vdh/dotfiles#pipewire
As mentioned there you may need to adjust the ALSA period size if everything sounds all garbled.
-
- Established Member
- Posts: 219
- Joined: Mon Mar 01, 2021 10:56 pm
- Has thanked: 51 times
- Been thanked: 92 times
- Contact:
Re: Pipewire configuration for low latency
- sysrqer
- Established Member
- Posts: 2527
- Joined: Thu Nov 14, 2013 11:47 pm
- Has thanked: 320 times
- Been thanked: 153 times
- Contact:
Re: Pipewire configuration for low latency
I just tried this and I'm a bit confused about the RLIMITs section. I've added the suggested file but I do not have a pipewire group. Is this necessary, or rather is this different than the settings in the pipewire config?ycollette wrote: ↑Mon Jan 03, 2022 10:54 am I found some interesting links about tuning for low latency. I will try this on Friday.
The tuning you must make for low latency:
https://gitlab.freedesktop.org/pipewire ... nce-tuning