Wireplumber realtme problem and Realtime tweaks for Pro Audio

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by merlyn »

To load threadirqs edit etc/default/grub and add threadirqs to the line

GRUB_CMDLINE_LINUX_DEFAULT=

Then update grub with

Code: Select all

$ sudo grub-mkconfig -o /boot/grub/grub.cfg
User avatar
Audiojunkie
Established Member
Posts: 403
Joined: Thu Feb 21, 2019 4:27 pm
Has thanked: 392 times
Been thanked: 157 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by Audiojunkie »

bluzee wrote: Thu Jul 27, 2023 4:17 pm

I'm now running the latest Pipewire on my Ham Radio computer and I can run the SDR software which is Pulse as well as Carla which is Jack to add multi band compressor for microphone. Latency is acceptable and qpwgraph makes routing easy. I can not get the latency low enough to play live with guitarix so my guitarix computer remains on Jack with Pipewire and Pulseaudio disabled. Perhaps one day Pipewire will do low enough latency, but it's not there yet.

@wtay has stated that it has been determined that the current pipewire scheduler is not adequate for the low latency xrun free audio that pro audio requires. His plan is to change the scheduler to behave like the JACK scheduler does, and use IRQ based scheduling. This will involve a fundamental change in the way Pipewire is currently working, and will take time to implement. Until that happens, Pipewire will not function as well except for a lucky few with specific hardware configurations. It will take time, but many of us are waiting "patiently" for this fix. :)

User avatar
Audiojunkie
Established Member
Posts: 403
Joined: Thu Feb 21, 2019 4:27 pm
Has thanked: 392 times
Been thanked: 157 times

Re: Wireplumber is not installed correctly

Post by Audiojunkie »

Impostor wrote: Wed Jul 26, 2023 12:36 pm
gabtram wrote: Wed Jul 26, 2023 11:40 am

Kernel 6.4.4-arch1-1 without 'threadirqs' parameter or real-time capabilities found. See also https://wiki.linuxaudio.org/wiki/system … ime_kernel
I followed the guidem can't find kernel file in boot and trying to unzip the kernel file and change the configuration maybe can't understand something

From my notes (always take notes when tweaking your system!):

-Open /etc/default/grub. Look for GRUB_CMDLINE_LINUX_DEFAULT and add threadirqs to the list of options:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash threadirqs"

Save the file and update the grub configuration:

sudo update-grub

Now reboot and you should have threaded IRQs.

Don't forget to make sure the preemption is changed from "Voluntary" to "Full". It is the combination of the two kernel parameters that make the generic kernel act like a realtime kernel. :)

User avatar
Impostor
Established Member
Posts: 1392
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 148 times
Been thanked: 366 times

Re: Wireplumber is not installed correctly

Post by Impostor »

Audiojunkie wrote: Tue Sep 12, 2023 4:00 pm

Don't forget to make sure the preemption is changed from "Voluntary" to "Full". It is the combination of the two kernel parameters that make the generic kernel act like a realtime kernel. :)

Isn't that only possible when compiling your own kernel?

User avatar
sunrat
Established Member
Posts: 925
Joined: Wed Jul 22, 2020 2:08 pm
Has thanked: 152 times
Been thanked: 247 times

Re: Wireplumber is not installed correctly

Post by sunrat »

Impostor wrote: Tue Sep 12, 2023 7:40 pm
Audiojunkie wrote: Tue Sep 12, 2023 4:00 pm

Don't forget to make sure the preemption is changed from "Voluntary" to "Full". It is the combination of the two kernel parameters that make the generic kernel act like a realtime kernel. :)

Isn't that only possible when compiling your own kernel?

Dynamic preemption was introduced in Linux 5.12 kernels - https://www.phoronix.com/news/Linux-5.1 ... ic-Preempt
You can grep your kernel config to see it is included, eg.:

Code: Select all

$ grep PREEMPT_DYNAMIC /boot/config-6.0.0-0.deb11.6-amd64 
CONFIG_PREEMPT_DYNAMIC=y
CONFIG_HAVE_PREEMPT_DYNAMIC=y
CONFIG_HAVE_PREEMPT_DYNAMIC_CALL=y

Preemption options are none, voluntary, and full. The default, in Debian kernels at least, is voluntary. To set full preemption, add to kernel options

Code: Select all

preempt=full

I use Liquorix kernel in which full preemption is default, so dynamic is not set and the kernel option is pointless.

tavasti
Established Member
Posts: 2059
Joined: Tue Feb 16, 2016 6:56 am
Location: Kangasala, Finland
Has thanked: 375 times
Been thanked: 209 times
Contact:

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by tavasti »

Audiojunkie wrote: Tue Sep 12, 2023 3:56 pm

@wtay has stated that it has been determined that the current pipewire scheduler is not adequate for the low latency xrun free audio that pro audio requires. His plan is to change the scheduler to behave like the JACK scheduler does, and use IRQ based scheduling. This will involve a fundamental change in the way Pipewire is currently working, and will take time to implement. Until that happens, Pipewire will not function as well except for a lucky few with specific hardware configurations. It will take time, but many of us are waiting "patiently" for this fix. :)

Is there link for this statement, would like to link that on some discussions.

Linux veteran & Novice musician

Latest track: https://www.youtube.com/watch?v=ycVrgGtrBmM

User avatar
Audiojunkie
Established Member
Posts: 403
Joined: Thu Feb 21, 2019 4:27 pm
Has thanked: 392 times
Been thanked: 157 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by Audiojunkie »

tavasti wrote: Wed Sep 13, 2023 7:08 am
Audiojunkie wrote: Tue Sep 12, 2023 3:56 pm

@wtay has stated that it has been determined that the current pipewire scheduler is not adequate for the low latency xrun free audio that pro audio requires. His plan is to change the scheduler to behave like the JACK scheduler does, and use IRQ based scheduling. This will involve a fundamental change in the way Pipewire is currently working, and will take time to implement. Until that happens, Pipewire will not function as well except for a lucky few with specific hardware configurations. It will take time, but many of us are waiting "patiently" for this fix. :)

Is there link for this statement, would like to link that on some discussions.

Yes, on page 2 of this discussion:

viewtopic.php?t=25804

In fact, the whole thread is very informative, and may be the best discussion of the issue in all the internet—it is, at least, to my current knowledge. 🙂

matyas
Established Member
Posts: 66
Joined: Mon Jul 02, 2018 9:11 pm
Has thanked: 6 times
Been thanked: 21 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by matyas »

I do believe that with the current version of Pipewire and a current kernel, it is indeed possible to get excellent performance with Pipewire. As I have mentioned elsewhere, I'm getting performance at least as good as what I was able to do under JACK (<5 ms/32 samples) and I'm not even running a low-latency kernel, although I am using System76's custom scheduler. This is on a rather beefy, brand-new machine, but even my old Thinkpad was giving decent performance when I was testing it a few months back.
I do think that it's probably best to start from scratch, though - fresh install on a distro that has never had JACK or PulseAudio installed, and a proper configuration (i.e., one that the distro has configured out of the box, rather than a manual install.)

User avatar
GMaq
Established Member
Posts: 2828
Joined: Fri Sep 25, 2009 1:42 pm
Has thanked: 530 times
Been thanked: 573 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by GMaq »

matyas wrote: Thu Sep 14, 2023 10:36 pm

I do believe that with the current version of Pipewire and a current kernel, it is indeed possible to get excellent performance with Pipewire. As I have mentioned elsewhere, I'm getting performance at least as good as what I was able to do under JACK (<5 ms/32 samples) and I'm not even running a low-latency kernel, although I am using System76's custom scheduler. This is on a rather beefy, brand-new machine, but even my old Thinkpad was giving decent performance when I was testing it a few months back.
I do think that it's probably best to start from scratch, though - fresh install on a distro that has never had JACK or PulseAudio installed, and a proper configuration (i.e., one that the distro has configured out of the box, rather than a manual install.)

Are you using special or custom configs for PipeWire? If so, care to share?

User avatar
bluzee
Established Member
Posts: 340
Joined: Mon Nov 30, 2020 11:43 pm
Has thanked: 18 times
Been thanked: 88 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by bluzee »

The configuration files for all these are independent so having other sound servers installed should matter not. The default configuration for Pipewire could vary by distro but will be the same if installed initially or later on.

matyas
Established Member
Posts: 66
Joined: Mon Jul 02, 2018 9:11 pm
Has thanked: 6 times
Been thanked: 21 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by matyas »

GMaq wrote: Fri Sep 15, 2023 5:35 pm

Are you using special or custom configs for PipeWire? If so, care to share?

I'm not actually doing anything special at all. I've tested two different machines, an older Thinkpad i5 with integrated graphics and 16 GB, and a much more powerful machine, a brand-new System76 Serval with a current i9, 32 GB RAM, and nVidia graphics. Both machines are running current PopOS. On the Thinkpad, I followed the steps outlined here: viewtopic.php?p=158807#p158807. There was some manual tweaking involved, but not much.
On the Serval, I just set the Pipewire quantum to 32 with a period of 3, and chose "Pro Audio" mode in pavucontrol. I'm using qpwgraph for routing. That's it. No disabling services, no esoteric boot options, no secret configurations.
On both machines, consumer apps play as the should, serious music apps work as expected, JACK emulation works fine, I can hotplug USB devices and switch back to the onboard sound, etc.

Now, all of this comes with the caveat that PopOS is a pretty heavily optimized distro. There are probably some settings made out of the box that make all of this easier in this distribution. I know that it employs a special scheduler that assigns real-time priority to audio apps; this is how they get around needing a low-latency kernel (although the stock kernel does have pre-empt patches installed.) I did need to add my audio apps to the file that tracks what apps get real-time permission; some of the common ones are already on the list, though.

matyas
Established Member
Posts: 66
Joined: Mon Jul 02, 2018 9:11 pm
Has thanked: 6 times
Been thanked: 21 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by matyas »

Quick edit: I'm actually using a quantum of 64, but latency is negligible nonetheless. I did bump it up to 128 because the system seemed a little sluggish, but that turned out not to be the problem. (Issue was actually due to trying to drive a large external display in portrait mode with motherboard graphics.) I'm going to go back 64 now that I know the cause of the issue.

As I've said before, in 2023, Linux audio does not need to be an esoteric art.

gabtram
Established Member
Posts: 38
Joined: Wed Nov 23, 2022 12:01 pm
Been thanked: 1 time

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by gabtram »

Hi to all,

and thanks for your response.
This community is great!
So we will patiently wait for pipewires updates bu in the meantime we can work to find good way to low the latency.
Unfortunately i don0t find the time until now to update my OS so now here i am.
I made some test and i can confirm my interal soundcard latency (the usb keyboard attached directly to my pc) have 1s and my mic and guitard on focusrite have almost 450-500ms.

So i think best solution in my case is to follow https://wiki.archlinux.org/title/Professional_audio and trying to set realtime kernel patch set.
The only thing i can't understand is: after installing the kernel patchset how can i configure the boot priority to respect this statement? "Note: Do not forget to add the newly installed kernel to your boot loader!"

Other thing: i use qpwgraph for routing. Is awesome but there is no configuration to set sample rate and buffer size like i remember in qjackctl. Now i find pipewire have a command to set all of this and you can find thans to this post bye @Audiojunkie viewtopic.php?t=25768. But is there a gui to do so? It's the same but in some case you can be fast with a gui.

I passed six month to configure this machine. After resolving latency issues and install some DAWS and other software i'd like to share my results to the community. I don't want to distruibute yet another os for music (even if YAOM is a good name for a distro :) but create a base for someone who want to play music and don't lose six month of time. Yeah there many good distros for music around but i think the best you can find it's what you can update always.

Bye!

runiq
Established Member
Posts: 47
Joined: Fri Jun 09, 2023 9:55 am
Has thanked: 61 times
Been thanked: 14 times
Contact:

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by runiq »

gabtram wrote: Tue Oct 17, 2023 9:10 am

So i think best solution in my case is to follow https://wiki.archlinux.org/title/Professional_audio and trying to set realtime kernel patch set.
The only thing i can't understand is: after installing the kernel patchset how can i configure the boot priority to respect this statement? "Note: Do not forget to add the newly installed kernel to your boot loader!"

Usually you run something like `update-grub` or `grub-mkconfig -o /boot/grub/grub.cfg`, but that depends on your distro.

Other thing: i use qpwgraph for routing. Is awesome but there is no configuration to set sample rate and buffer size like i remember in qjackctl. Now i find pipewire have a command to set all of this and you can find thans to this post bye @Audiojunkie viewtopic.php?t=25768. But is there a gui to do so? It's the same but in some case you can be fast with a gui.

Pipewire works a little different here: Processes may request a latency target, and Pipewire applies the lowest requested target to the underlying device. For example, in Ardour you can set the latency target in the preferences and Pipewire(-JACK) will use that.

User avatar
Audiojunkie
Established Member
Posts: 403
Joined: Thu Feb 21, 2019 4:27 pm
Has thanked: 392 times
Been thanked: 157 times

Re: Wireplumber realtme problem and Realtime tweaks for Pro Audio

Post by Audiojunkie »

gabtram wrote: Tue Oct 17, 2023 9:10 am

Hi to all,

and thanks for your response.
This community is great!
So we will patiently wait for pipewires updates bu in the meantime we can work to find good way to low the latency.
Unfortunately i don0t find the time until now to update my OS so now here i am.
I made some test and i can confirm my interal soundcard latency (the usb keyboard attached directly to my pc) have 1s and my mic and guitard on focusrite have almost 450-500ms.

So i think best solution in my case is to follow https://wiki.archlinux.org/title/Professional_audio and trying to set realtime kernel patch set.
The only thing i can't understand is: after installing the kernel patchset how can i configure the boot priority to respect this statement? "Note: Do not forget to add the newly installed kernel to your boot loader!"

Other thing: i use qpwgraph for routing. Is awesome but there is no configuration to set sample rate and buffer size like i remember in qjackctl. Now i find pipewire have a command to set all of this and you can find thans to this post bye @Audiojunkie viewtopic.php?t=25768. But is there a gui to do so? It's the same but in some case you can be fast with a gui.

I passed six month to configure this machine. After resolving latency issues and install some DAWS and other software i'd like to share my results to the community. I don't want to distruibute yet another os for music (even if YAOM is a good name for a distro :) but create a base for someone who want to play music and don't lose six month of time. Yeah there many good distros for music around but i think the best you can find it's what you can update always.

Bye!

There are several GUI front ends for Pipewire nowadays. The following thread just lists a few:

https://forum.cockos.com/showthread.php?t=280235

Do a search for Pipewire GUI and you should be able to find more. I've seen at least 6-8 GUIs so far, with different levels of functionality. They DO exist. :)

EDIT: I saw a really powerful one recently. I can't remember its name. There's also one with a name like "copper wire" or something like that. I can't find it at the moment though. There really are a lot of them though.

EDIT#2: I found some more, including the "Copper Wire" one that I couldn't remember the last name for:

https://github.com/dyegoaurelio/simple-wireplumber-gui

https://github.com/dimtpap/coppwr

https://github.com/cyber-sushi/pipewire ... ate-config

https://github.com/pkunk/pwrate

Post Reply