pw-jack

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

User avatar
GMaq
Established Member
Posts: 2951
Joined: Fri Sep 25, 2009 1:42 pm
Has thanked: 564 times
Been thanked: 637 times

Re: pw-jack

Post by GMaq »

@Impostor or anyone else using a Debian-based Distro...

Are you interested in trying the PipeWire tools from AV Linux, where you can set the quantum and sample rate per session from metadata commands. It's a Deb and should work in Mint, it will also install/require yad for the dialogs. Of course this would globally set the Q and S/R and not run 2 separate S/R's so maybe it doesn't help you..?

They are here if you want to try:
https://bandshed.net/packages/AVL-MXe-2 ... -1_all.deb

*Note this does not install or configure PipeWire if it doesn't exist on the system, it simply works with what is already installed..

Last edited by GMaq on Thu Sep 26, 2024 10:40 pm, edited 2 times in total.
User avatar
Impostor
Established Member
Posts: 1574
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 157 times
Been thanked: 431 times

Re: pw-jack

Post by Impostor »

GMaq wrote: Thu Sep 26, 2024 9:56 pm

@Impostor

Are you interested in trying the PipeWire tools from AV Linux, where you can set the quantum and sample rate per session from metadata commands. It's a Deb and should work in Mint, it will also require yad for the dialogs. Of course this would globally set the Q and S/R and not run 2 separate S/R's so maybe it doesn't help you..?

They are here if you want to try:
https://bandshed.net/packages/AVL-MXe-2 ... -1_all.deb

Thanks, but I may be one of the few who actually prefer editing config files :)

User avatar
Largos
Established Member
Posts: 717
Joined: Mon Oct 05, 2020 12:21 pm
Has thanked: 83 times
Been thanked: 227 times

Re: pw-jack

Post by Largos »

Impostor wrote: Thu Sep 26, 2024 8:41 pm
sysrqer wrote: Thu Sep 26, 2024 8:14 pm

I haven't come across that before. Does it only happen with Muse? What about Carla or something else?
I've just tried with the same settings as you with carla, zynaddsubfx, cardinal and all of them run fine at 48000 when pipewire is set to default at 44100.

Well, hydrogen also reports the wrong default (from pipewire.conf) values in its audio tab, although its sound doesn't get pitched up. And Pianoteq reports the correct values and sounds fine too.

This is from my pipewire.conf:
default.clock.rate = 44100
default.clock.allowed-rates = [ 44100 48000 ]
default.clock.quantum = 1024

In jack.conf I had these values:

Code: Select all

  node.force-rate    = 48000
  node.lock-quantum  = true
  node.force-quantum = 128

If I also add this one to jack.conf

Code: Select all

 node.latency       = 128/48000

I can start MusE, unpreceded by PIPEWIRE_LATENCY=128/48000, without getting the samplerate warning, and it plays correctly. Hydrogen now also reports the correct buffer and samplerate values. *)

*)EDIT: but if I now comment out node.force-rate = 48000, the device rate remains at the default 44100, but now MusE thinks incorrectly that the device rate is 48000 so all audio is now pitched down.

You should comment out node.latency as well. In fact, there's no point in changing the jack.conf from default or editing pipewire.conf.

Better to follow the instructions here for multiple sample rates: https://gitlab.freedesktop.org/pipewire ... iple-rates

Then the "PIPEWIRE_LATENCY=128/48000" prefix will work.

User avatar
Impostor
Established Member
Posts: 1574
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 157 times
Been thanked: 431 times

Re: pw-jack

Post by Impostor »

Largos wrote: Thu Sep 26, 2024 11:09 pm

You should comment out node.latency as well. In fact, there's no point in changing the jack.conf from default or editing pipewire.conf.

Better to follow the instructions here for multiple sample rates: https://gitlab.freedesktop.org/pipewire ... iple-rates

Then the "PIPEWIRE_LATENCY=128/48000" prefix will work.

I've deleted my user config files, added a file 10-rates.conf to ~/.config/pipewire/pipewire.conf.d as per instructions, with contents

Code: Select all

# Adds more common rates
context.properties = {
    default.clock.allowed-rates = [ 44100 48000 ]
}

And rebooted.

But no luck. The device runs at its default 48000 while running audacious at 44100:

FORMAT
The format used by the driver node or the stream. This is the hardware format negotiated with the device or stream. If the stream of driver has a different rate than the graph, resampling will be done.

(https://man.archlinux.org/man/pw-top.1.en)

Attachments
confdrates.png
confdrates.png (108.03 KiB) Viewed 637 times
User avatar
Impostor
Established Member
Posts: 1574
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 157 times
Been thanked: 431 times

Re: pw-jack

Post by Impostor »

About that samplerate when running Audacious:

That 48000 graph/device rate is apparently a result of choosing the "pipewire output" audio output for Audacious.
Really weird, since pw-top gives both a suggested rate and actual format of 44100 for the Audacious node.

If I choose "pulseaudio output" then the graph will be run at 44100 Hz.

Edit: this bug has been fixed in a newer Audacious version than is shipped with Mint 22.

Last edited by Impostor on Sat Sep 28, 2024 10:59 pm, edited 1 time in total.
User avatar
Impostor
Established Member
Posts: 1574
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 157 times
Been thanked: 431 times

Re: pw-jack

Post by Impostor »

Now I've encountered a new problem:

pulseaudio apps (firefox/audacious-with-pulse-output) don't work when running jack apps at all!

Edit: false alarm. This time it was my qpwgraph patchbay settings :)
Had exclusivity set, while audacious' node name apparently changed with choosing another output plugin. And firefox, who knows?

By the way, you may want to turn down the volume of any playing audio when starting MusE. Your speakers (and eardrums) will probably last a bit longer then.

Nuther Edit: To solve the eardrilling experience when starting MusE while "pulseaudio" is playing, I needed to comment out

#node.latency = 128/48000
#node.lock-quantum = true

and leave active:

node.force-rate = 48000
node.force-quantum = 128

in my custom jack.conf (yep, need it after all apparently).
So, tldr:
-pipewire.conf custom setting:

Code: Select all

default.clock.allowed-rates = [ 44100 48000 ]

-jack.conf custom setting:

Code: Select all

node.force-rate    = 48000
node.force-quantum = 128

-Do not use Audacious' pipewire output plugin.

Gives a working configuration. No need for PIPEWIRE_LATENCY prefixes either for Jack apps afaicd. Hydrogen still misreports buffer size, but one cannot have it all.

User avatar
RyanH
Established Member
Posts: 248
Joined: Fri Jul 08, 2022 7:58 am
Has thanked: 169 times
Been thanked: 45 times

Re: pw-jack

Post by RyanH »

Impostor wrote: Thu Sep 26, 2024 12:29 pm
RyanH wrote: Thu Sep 26, 2024 1:20 am

Even graph is frustrating to me, with the spaghetti and the lack of clear distinction between MIDI and audio.

?

I tried using graph, briefly, a year or two ago. I don't remember which application or plugin I was using, but - let's say it was a plugin - there was an entry for that plugin's midi, and a separate one for the audio. I had to focus a bit to figure out which was which, which I didn't have to do with QjackCtl's separate audio and midi tabs in the Connections window. (I don't think midi and audio were delineated by colour like in your pic - but I could be wrong). And when I would start a session, the app/plugin entries were all piled on top of each other and I had to manually spread them out.

I can't say I gave it much of a chance, but it was chaotic compared to the well-ordered tabs in QjackCtl.

User avatar
RyanH
Established Member
Posts: 248
Joined: Fri Jul 08, 2022 7:58 am
Has thanked: 169 times
Been thanked: 45 times

Re: pw-jack

Post by RyanH »

Impostor wrote: Thu Sep 26, 2024 12:15 pm

To be fair, it turns out that this issue is not exclusive to pipewire-jack. If you ever used Qtractor with Hydrogen under Jack you wouldn't even have time-based transport control, which is where the issue lies. It's fixed with MusE+H2+Jack, but not with Qtractor+H2+Jack.

Actually, now that you mention it, I think I did once experience that with the Qtractor/Hydrogen/Jack combo. It wasn't integral to what I was doing at the time, but I noticed it.

User avatar
Impostor
Established Member
Posts: 1574
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 157 times
Been thanked: 431 times

Re: pw-jack

Post by Impostor »

RyanH wrote: Sat Sep 28, 2024 6:36 am
Impostor wrote: Thu Sep 26, 2024 12:15 pm

To be fair, it turns out that this issue is not exclusive to pipewire-jack. If you ever used Qtractor with Hydrogen under Jack you wouldn't even have time-based transport control, which is where the issue lies. It's fixed with MusE+H2+Jack, but not with Qtractor+H2+Jack.

Actually, now that you mention it, I think I did once experience that with the Qtractor/Hydrogen/Jack combo. It wasn't integral to what I was doing at the time, but I noticed it.

It's fixed now with both H2 and Qtractor on Jack. You can add rncbc's PPA to install the latest master of Qtractor, but probably need to build H2 from source. What troubles remain is strictly a pipewire-jack issue.

User avatar
RyanH
Established Member
Posts: 248
Joined: Fri Jul 08, 2022 7:58 am
Has thanked: 169 times
Been thanked: 45 times

Re: pw-jack

Post by RyanH »

Impostor wrote: Sun Sep 29, 2024 7:59 pm

It's fixed now with both H2 and Qtractor on Jack. You can add rncbc's PPA to install the latest master of Qtractor, but probably need to build H2 from source. What troubles remain is strictly a pipewire-jack issue.

Thanks for the info. My distro is still supported for a few more months, so I think I'll ride it out and then, hopefully, Hydrogen will be up to date.

User avatar
Impostor
Established Member
Posts: 1574
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 157 times
Been thanked: 431 times

Re: pw-jack

Post by Impostor »

Update on my pipewire adventure:

Thanks in no small part to @rncbc for qpwgraph making life much easier than it would have been otherwise, I now have my pipewire system set up in exactly the way I want it. With qpwgraph autostarting with my patchbay, jack_mixer autostarting with it, the necessary pw-jack and pipewire conf file adjustments, and a pw-link script to toggle some connections on-the-fly, the day-to-day user experience almost exactly mirrors the tried-and-true jack+pulse experience.

Now pipewire only needs to fix their jack-transport implementation, and then I can say goodbye to Jack and Pulseaudio for good.

Post Reply