Working with JACK Audio server in Pipewire KLV's

Moderator: Forum moderators

Clarity
Posts: 3270
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1347 times
Been thanked: 438 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by Clarity »

Hello @geo_c, @rockedge and @Sofiya

I made a post on the forum that applies to the efforts, here in KLs. The forum post is here.

Enjoy

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

Clarity wrote: Thu Jan 18, 2024 3:54 am

Hello @geo_c, @rockedge and @Sofiya

I made a post on the forum that applies to the efforts, here in KLs. The forum post is here.

Enjoy

@rockedge, this is what we're trying to do right here:

this guy is totally unscripted, installs and use pipewire with jack apps, cameras, instruments, basically improvising the install on his arch system that has jack installed. He uninstalled pulseaudio, left jack installed, rebooted and started Carla rack, and all his audio devices showed up, camera inputs, hdmi outs. You can see what he's doing in the terminal, and it's 30minutes, but totally worth the watch.

I think you'll enjoy.

It looks like you just need pipewire and pw-jack pipewire pulse to run all the jack applications. This video came out two years ago. I'm going to try a fresh install and see if I can emulate these results.

But I have to figure out what KLV-airedale-RT15 has installed already, whether pulseaudio is actually present, or just pipewire-pulse. How that's setup.

He did not uninstall jack that I noticed, but there was no need to start it. When I use jack I'm only getting whatever audio device I choose as default in qjackctrl. Which I shouldn't be using at all -- see below. He's using pipewire-top command to check what's showing up in pipewire.

Anyway check this out. You too @Clarity It might make you smile.

Last edited by geo_c on Thu Jan 18, 2024 6:56 am, edited 1 time in total.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

Okay, making some fantastic headway here.

I'm using my JackPipe system, and ran Carla from the terminal, like the guy in the above video, using the command pw-jack Carla and BAM, Carla is showing everything, Pulse audio volume control, both of my attached audio cards, Librewolf browser.

So that's incredible. Carla thinks she's using jack as a server, but she's getting all the audio from pipewire.

When Carla first opened, I had my headphones plugged into Presonus USB interface, and I heard the mic input coming from my laptop mic, because being the pulseaudio default input device, it was routed to the hardware outputs, and I didn't have pavucontrol running yet. And that was instantly cool when I realized what was going on. But for that reason pulseaudio might be problematic. For example I routed Librewolfs audio to Presonus USB, but after stopping the playback and minimizing the browser, then restarting, pulse routed it automatically back to my laptop output until I changed the default output in pavucontrol to Presonus.

I also ran pw-top in the terminal which is displaying all the devices.

All of this is shown below, and the only thing still missing is midi devices unfortunately. My LPK25 keyboard is not showing in pw-top, Carla, or Helvum. Either are the midi in/out ports from the Presonus USB. I suspect that might be a pipewire config, because I can get midi devices using jack set to raw driver. UNLESS, there's a pipewire command for that too. It's getting late, but I will eventually get around to booting up a pristine Airedale-RT15 and see if midi shows up, and if I just somehow broke it with all these other packages.

Image

I do think if pulseaudio is actually installed in Airedale it might not need to be included. And jack probably doesn't need to be installed either. But regardless, they can both coexist. As I mentioned in the above post, in the video he uninstalled pulseaudio and rebooted.

Then I opened up Ardour, and I had to do it using the pw-jack Ardour8 command in the terminal, but that command could simply be put in the desktop file to open it from the menu. Again since I still had my pavucontrol opened the laptop mic was routed to Ardour inputs and immediately created a feedback loop. I muted that card in pavucontrol and rerouted all audio outs to Presonus output using the Carla jackgraph. Then I set the buffer rate to 512 (pretty low for this machine!) and played some projects, and audio is working well.

Then I routed the output of LibreWolf to the inputs of Ardour8 and played the video through Ardour, so effectively I could record that audio (Hey I could pirate some music like that, if I were a -ahem- a dishonest type)

Here's Carla jackgraph showing Librewolf routed into Ardour. This is getting crazy fun:

(and shutting off pavucontrol makes the graph a lot easier to deal with)
Image

Last edited by geo_c on Thu Jan 18, 2024 2:38 pm, edited 2 times in total.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

I went ahead and booted up a fresh Airedale, then installed pipewire-jack, helvum, qpwgraph, and a few jack apps. But I didn't boot those. Instead I ran the pw-top command and then opend helvum and qpwgraph to see if the midi devices showed up. But they weren't there.

My thought is wireplumber needs to be configured to find those. I'm able to access them on JackPipe using jack proper, and so they are available in alsa of course, but pipewire isn't seeing them, so when I open Ardour and Carla using pw-jack instead of jack proper, they don't show up.

Both helvum and qpwgraph say they display midi devices, so they should be showing there too.

I'm gonna look into the lua scripts included in the wireplumber directory. My feeling is that the basic void wireplumber config isn't including midi devices.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

looking at this now: https://docs.pipewire.org/page_midi.html

which links to this, and I think these are the names to search for in the config and scripts: https://docs.pipewire.org/group__spa__n ... 26a6f6daea

#define SPA_NAME_API_ALSA_SEQ_BRIDGE "api.alsa.seq.bridge"

geo_c
Old School Hipster, and Such

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

I am going to build a fresh KLV from build script without any pulseaudio components. It won't be quite a full Airedale but close enough to start without most audio packages installed. ALSA pieces maybe....will see how it goes.

This will determine hopefully what needs to go in and how to configure it to reach the goals we're reaching for. :thumbup2:

Also will continue with a KLV-Airedale-RT in it's current form to experiment with.

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

@geo_c research has brought me here -> https://www.kernel.org/doc/html/v4.15/s ... r-api.html

More with the a2jmidi MIDI bridge.

Use JACK MIDI when you sequence, use ALSA MIDI when you play hardware.

Use JACK without a MIDI driver and in combination with a2jmidi -e. If you start JACK from qjackctl, select 'none' as MIDI driver. If you start it from CLI, omit the -X (seq|raw). My JACK line looks like this:

/usr/bin/jackd -R -M256 -u -dalsa -dhw:UA25 -r48000 -p256 -n3

Seems though we are still really close to a victory here.

I did add a lot of sound card support to the RT kernels after 6.1.38-rt13....maybe something there. I will have to look closely at a kernel config file from one of them.

The Session Manager

The session manager needs to create the MIDI nodes/ports for the available devices.

This can either be done as a single node with ports per device/stream or as separate nodes created by a MIDI device monitor.

The session manager needs to be aware of the various MIDI sinks and sources in order to route MIDI streams to them from applications that want this.
Implementation
PipeWire Media Session

PipeWire media session uses the SPA_NAME_API_ALSA_SEQ_BRIDGE plugin for the MIDI features. This creates a single SPA Node with ports per MIDI client/stream.

The media session will check the permissions on /dev/snd/seq before attempting to create this node. It will also use inotify to wait until the sequencer device node is accessible.

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Thu Jan 18, 2024 4:15 pm

@geo_c research has brought me here -> https://www.kernel.org/doc/html/v4.15/s ... r-api.html

More with the a2jmidi MIDI bridge.

Use JACK MIDI when you sequence, use ALSA MIDI when you play hardware.

Use JACK without a MIDI driver and in combination with a2jmidi -e. If you start JACK from qjackctl, select 'none' as MIDI driver. If you start it from CLI, omit the -X (seq|raw). My JACK line looks like this:

/usr/bin/jackd -R -M256 -u -dalsa -dhw:UA25 -r48000 -p256 -n3

Seems though we are still really close to a victory here.

I did add a lot of sound card support to the RT kernels after 6.1.38-rt13....maybe something there. I will have to look closely at a kernel config file from one of them.

The Session Manager

The session manager needs to create the MIDI nodes/ports for the available devices.

This can either be done as a single node with ports per device/stream or as separate nodes created by a MIDI device monitor.

The session manager needs to be aware of the various MIDI sinks and sources in order to route MIDI streams to them from applications that want this.
Implementation
PipeWire Media Session

PipeWire media session uses the SPA_NAME_API_ALSA_SEQ_BRIDGE plugin for the MIDI features. This creates a single SPA Node with ports per MIDI client/stream.

The media session will check the permissions on /dev/snd/seq before attempting to create this node. It will also use inotify to wait until the sequencer device node is accessible.

@rockedge at this point in time I'm not starting jack at all. It doesn't need to be started or even installed the way I understand. If you haven't done it already, I'd take a look at that video because it's very informative watching him wing it on camera. When using pw-jack, a2jmidid shouldn't come into play at all, unless I'm missing something. I ran the test last night on a fresh airedale without jack installed, and jack apps worked fine, but without midi. So I think the node creation probably has most to do with it.

What I just did this morning is make a few attempts at un-installing pulseaudio, and not due to the midi issue. I'm seeing if I could add pipewire-pulse into the mix, and eliminate pulseaudio, which is what he did in the video, because the desktop environment was looking for pulseaudio, and instead he uninstalled pulse and used the pipewire-pulse to handle it, and it worked, but I don't see anything like that in the void repos, and I'm wondering if we should buiild a KLA instead to get a handle on it.

So to sum up jack apps will work completely, even Ardour, without jack installed on the system at all, as long as pipewire (and pipewire pulse) are set up correctly. The desktop environment comes into play because it's looking for pulse to control volume from the tray,etc, but pipewire appears to be a working replacement for both, as it handles both api's.

Last edited by geo_c on Thu Jan 18, 2024 6:01 pm, edited 2 times in total.

geo_c
Old School Hipster, and Such

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

@geo_c

I found the pipewire-pulse is already installed!!

open a terminal and try:

Code: Select all

pipewire-pulse --help

What I am reading ->

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Thu Jan 18, 2024 5:52 pm

@geo_c

I found the pipewire-pulse is already installed!!

open a terminal and try:

Code: Select all

pipewire-pulse --help

What I am reading ->

Interesting! I'm going to give that a try. It doesn't address midi per se, but it could make pipewire run better. I have been getting policy-kit notifications on bootup, and then no audio. A simple log-out and log-in fixes it everytime.

geo_c
Old School Hipster, and Such

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

@geo_c I revamped the audio start up to follow the guide for pipewire-pulse....and it's playing sound!

No Policy Kit warnings......

So I am using it super basic....just playback on Parole but it's going and pactl info reports pipewire :geek:

Removed ( I think...) the pulseaudio startup mechanisms and replaced it with the pipewire-pulse except I do not see /etc/sv/pipewire or /etc/sv/pipewire-pulse

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

Suddenly Audacity is automatically connected for recording what you hear directly from Easy Effect Sink output.

It never did that before automatically

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Thu Jan 18, 2024 6:12 pm

@geo_c I revamped the audio start up to follow the guide for pipewire-pulse....and it's playing sound!

No Policy Kit warnings......

So I am using it super basic....just playback on Parole but it's going and pactl info reports pipewire :geek:

Removed ( I think...) the pulseaudio startup mechanisms and replaced it with the pipewire-pulse except I do not see /etc/sv/pipewire or /etc/sv/pipewire-pulse

As you reconfigure the audio, if you want to test jack apps, it's pretty easy. Just do an xbps-install carla helvum qpwgraph and if you want something to generate sound in jack and appear in carla, xbps-install yoshimi (which is a soft synth with a virtual keyboard.) Then in a terminal run: pw-jack carla

Then in carla go to the engine menu and stop the audio engine, then go to the configure carla menu and choose "engine" screen and choose jack as the audio driver then restart the engine. After that add plugin yoshimi which boots with a synth sound pre-loaded and has virtual keyboard button so you can test it. (you have to click a button on the left of the plugin rack to get the gui) Then go to the carla patchbay and route the output of carla wherever you want. You can also see if midi devices show up in the carla graph.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Thu Jan 18, 2024 6:12 pm

@geo_c I revamped the audio start up to follow the guide for pipewire-pulse....and it's playing sound!
Removed ( I think...) the pulseaudio startup mechanisms and replaced it with the pipewire-pulse except I do not see /etc/sv/pipewire or /etc/sv/pipewire-pulse

Yes I noticed that also.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Thu Jan 18, 2024 6:26 pm

@geo_c

Headed in this direction -> https://docs.voidlinux.org/config/media/pipewire.html

That's the scary dbus stuff I mentioned not knowing anything about earlier in this topic.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Thu Jan 18, 2024 6:26 pm

@geo_c

Headed in this direction -> https://docs.voidlinux.org/config/media/pipewire.html

I've been reading through this, and I'm really curious now how Airedale-RT15 is working. It does have pulseaudio installed, and pipewire is running.

For instance the wpctl and pactl command output looks like this:

Code: Select all

root# wpctl status
PipeWire 'pipewire-0' [1.0.1, spot@void-live, cookie:3638588622]
 └─ Clients:
        33. pipewire                            [1.0.1, spot@void-live, pid:1755]
        35. WirePlumber                         [1.0.1, spot@void-live, pid:1754]
        36. WirePlumber [export]                [1.0.1, spot@void-live, pid:1754]
        58. xfce4-pulseaudio-plugin             [1.0.1, root@void-live, pid:1918]
        59. wpctl                               [1.0.1, root@void-live, pid:3642]

Audio
 ├─ Devices:
 │      40. GF106 High Definition Audio Controller [alsa]
 │      41. Built-in Audio                      [alsa]
 │      42. Studio 24c                          [alsa]
 │  
├─ Sinks: │ 34. Studio 24c Analog Stereo [vol: 0.40] │ * 47. Built-in Audio Analog Stereo [vol: 0.40] │
├─ Sink endpoints: │
├─ Sources: │ 46. Studio 24c Analog Stereo [vol: 1.00] │ * 48. Built-in Audio Analog Stereo [vol: 1.00] │
├─ Source endpoints: │
└─ Streams: Video ├─ Devices: │
├─ Sinks: │
├─ Sink endpoints: │
├─ Sources: │
├─ Source endpoints: │
└─ Streams: Settings └─ Default Configured Node Names: root# pactl info Server String: unix:/tmp/runtime-spot/pulse/native Library Protocol Version: 35 Server Protocol Version: 35 Is Local: yes Client Index: 68 Tile Size: 65472 User Name: spot Host Name: void-live Server Name: PulseAudio (on PipeWire 1.0.1) Server Version: 15.0.0 Default Sample Specification: float32le 2ch 48000Hz Default Channel Map: front-left,front-right Default Sink: alsa_output.pci-0000_00_1b.0.analog-stereo Default Source: alsa_input.pci-0000_00_1b.0.analog-stereo Cookie: d8e0:74ce root#

but is that pipewire-pulse emulating pulseaudio? I would say not because there is no:
/etc/pipewire/pipewire.conf.d
and no link like this:
ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf /etc/pipewire/pipewire.conf.d/
and no pipwire.conf.d in /root/.config either

--though I suppose if pulseaudio proper is actually running it would be reported by pactl also.

--Or does this output mean it's really pipewire-pulse that's running: Server Name: PulseAudio (on PipeWire 1.0.1)

And from the wpctl output, wireplumber appears to be running, even though there is no:
/etc/pipewirepipewire.conf.d
and nothing linked like this: ln -s /usr/share/examples/wireplumber/10-wireplumber.conf /etc/pipewire/pipewire.conf.d/
and no /wireplumber in /root/.config either.

I'm still keen to uninstall pulse audio and try to config pipewire-pulse. But I'm confused as to what's doing what.

Last edited by geo_c on Fri Jan 19, 2024 5:30 am, edited 3 times in total.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

I've also been looking through the /usr/share/wireplumber lua script folders and since I don't know how that all fits togeher, and don't know the first thing about lua, I'm not prone to touch any of it. Here are some of the scripts, and I suppose they are all being included, and...

Image

...this:Image

is found here:Image

Image

All that looks llike it should be working. But are they all enabled? I'm not sure. Do they have to be specifically named in the enable-all-lua script located in each lua directory?

geo_c
Old School Hipster, and Such

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

@geo_c Good question. I have now broken my test KLV-Airedale-RT-6.6.0-rt13 versions audio abilities at least 6 times and I can also question, how does the sound work at all?

If I remember the first issue is we are running as root and it seems pipewire, wireplumber and the applications maybe even JACK is all designed to run as another user. In our case spot. If I remember there were some issues having the audio work in both cases, logged in as root or as spot

I will have to go to a script and construct a KLV that is close to Airedale but has no sound components at all installed during the build. Then start with that again. @fredx181 helped out with setting up the original audio configuration and there is some major differences on how we got audio started up to work when logged in as the root user and be able to use sound when logged in as spot, or any other user created for the system.

Going back to a clean start we'll get to the bottom of what we designed and why. Most of our issues might be user related.

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

@geo_c First discovery is we are starting pipewire in the /home/spot/.xinitrc with:

Code: Select all

 
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

.  /usr/local/bin/pipewire-user.sh
exec xfce4-session

And in /root/.xinitrc:

Code: Select all

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then

xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then

xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi
. /usr/local/bin/pipewire-root.sh
/usr/local/bin/start-up &
exec xfce4-session
geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Fri Jan 19, 2024 1:37 pm

@geo_c Good question. I have now broken my test KLV-Airedale-RT-6.6.0-rt13 versions audio abilities at least 6 times and I can also question, how does the sound work at all?

If I remember the first issue is we are running as root and it seems pipewire, wireplumber and the applications maybe even JACK is all designed to run as another user. In our case spot. If I remember there were some issues having the audio work in both cases, logged in as root or as spot

I will have to go to a script and construct a KLV that is close to Airedale but has no sound components at all installed during the build. Then start with that again. @fredx181 helped out with setting up the original audio configuration and there is some major differences on how we got audio started up to work when logged in as the root user and be able to use sound when logged in as spot, or any other user created for the system.

Going back to a clean start we'll get to the bottom of what we designed and why. Most of our issues might be user related.

What if we build a Kennel-Void system that God forbid! runs as normal user with no auto login? I know nothing about sudo though since I've been working with puppies my entire linux life.

geo_c
Old School Hipster, and Such

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

@geo_c

No fear! I think we might be able to get the audio up for both root and spot, but actually using more or less the official methods.

I was going top speed producing the KLV-Airedale's and some craziness did ensue during construction of the audio systems

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

This is what the start scripts look like:

/usr/bin/pipewire_root.sh

Code: Select all

#!/bin/sh

xhost +local: 2>/dev/null
# start PipeWire/PulseAudio over the session bus and use it for both root and user, so they see the same output devices
XUSER=spot
#rm -f /home/${XUSER}/.config/pulse/cookie
# start a D-Bus session bus for both root and spot, for PulseAudio and applications that don't work without it
eval `dbus-launch --exit-with-x11 --sh-syntax`
run-as-$XUSER dbus-launch --exit-with-x11 > /tmp/.${XUSER}-session-bus

if [ -e /usr/bin/wireplumber ] || [ -e /usr/bin/pipewire-media-session ]; then
    rm -f /tmp/runtime-${XUSER}/pipewire-0 /tmp/runtime-${XUSER}/pipewire-0.lock /run/pipewire/pipewire-0
    mkdir -p /run/pipewire
    ln -s /tmp/runtime-${XUSER}/pipewire-0 /run/pipewire/pipewire-0
    run-as-$XUSER pipewire &
    (
        while [ ! -e /tmp/runtime-${XUSER}/pipewire-0 ]; do sleep 0.1; done
	
    run-as-$XUSER pipewire-pulse &

if [ -e /usr/bin/wireplumber ]; then
     run-as-$XUSER wireplumber &
else
 run-as-$XUSER pipewire-media-session &
fi

) &
export PULSE_SERVER=unix:/tmp/runtime-${XUSER}/pulse/native
export PULSE_COOKIE=/home/${XUSER}/.config/pulse/cookie
fi

Notice that it is using depreciated pipewire-media-session

This is /usr/bin/pipewire-user.sh

Code: Select all

#!/bin/bash

XUSER=`whoami`
ID_U=$(id -u $XUSER)

dbus-launch --exit-with-x11 > /tmp/.R_${XUSER}-session-bus
#	export XDG_RUNTIME_DIR=/tmp/runtime-R_${XUSER}
export XDG_RUNTIME_DIR=/run/user/$ID_U
#	if [ ! -d ${XDG_RUNTIME_DIR} ] ; then
#	mkdir -p ${XDG_RUNTIME_DIR}
#	chmod 0700 ${XDG_RUNTIME_DIR}
#	chown ${XUSER} ${XDG_RUNTIME_DIR}
#	fi

	. /tmp/.R_${XUSER}-session-bus
	export DBUS_SESSION_BUS_ADDRESS
	export DBUS_SESSION_BUS_PID
if [ -e /usr/bin/wireplumber ] || [ -e /usr/bin/pipewire-media-session ]; then
  #rm -f /tmp/runtime-R_${XUSER}/pipewire-0 /tmp/runtime-R_${XUSER}/pipewire-0.lock /run/pipewire/pipewire-0
  #mkdir -p /run/pipewire
  #ln -s /tmp/runtime-R_${XUSER}/pipewire-0 /run/pipewire/pipewire-0
    pipewire &
    (
        while [ ! -e /run/user/$ID_U/pipewire-0 ]; do sleep 0.1; done
	
    pipewire-pulse &

if [ -e /usr/bin/wireplumber ]; then
     wireplumber &
else
 pipewire-media-session &
fi

) &
export PULSE_SERVER=unix:/run/user/$ID_U/pulse/native
export PULSE_COOKIE=/home/${XUSER}/.config/cookie
fi

Notice in both scripts:

Code: Select all

export PULSE_SERVER=unix:/run/user/$ID_U/pulse/native
export PULSE_COOKIE=/home/${XUSER}/.config/cookie
User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

@geo_c No wonder there were problems! First need to remove these scripts and begin a fresh approach.

Explains why I was breaking the sound when adding in audio using the official Void Linux recommended startup of pipewire/wireplumber.

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Fri Jan 19, 2024 1:55 pm

This is what the start scripts look like:
Notice that it is using depreciated pipewire-media-session

Notice in both scripts:

Code: Select all

export PULSE_SERVER=unix:/run/user/$ID_U/pulse/native
export PULSE_COOKIE=/home/${XUSER}/.config/cookie

Wow, yes so, sometimes we're using native pulse audio and sometimes pipewire-pulse, and possibly pipewire-media-session rather than wireplumber. But stiil my wpctl output shows wireplumber running, so that's probably good.

The pipewire docs definitely say to uninstall pulseaudio and let pipwire-pulse//pipwire-jack/wireplumber/pipewire handle it all. I don't know much about all the permission issues running as root and spot, but I imagine it makes it a lot more complicated.

as a side note, what still baffles/amazes me, is that when I ran Reaper both using native jack or pulse chosen as servers, I got midi devices connected. Hats off to Reaper I guess. When I use native jack using the raw driver, I get them also. But pipewire doesn't see them. That part could still be the pipewire config and lua scripts.

geo_c
Old School Hipster, and Such

User avatar
rockedge
Site Admin
Posts: 5711
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1990 times
Been thanked: 2097 times
Contact:

Re: Working with JACK Audio server in Pipewire KLV's

Post by rockedge »

@geo_c what does this in a terminal output?

Code: Select all

pw-cli ls Node

And then:

Code: Select all

wpctl status
geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Fri Jan 19, 2024 3:43 pm

@geo_c what does this in a terminal output?

Code: Select all

pw-cli ls Node

Let me open some apps and so forth and see what it says.

Okay with pavucontrol set to "built-in" and with LibreWolf playing a video and Carla started with pw-jack carla, this is the output of pw-cli ls Node:

(and it's all there, except midi)

Code: Select all

oot# pw-cli ls Node
	id 30, type PipeWire:Interface:Node/3
 		object.serial = "30"
 		factory.id = "10"
 		priority.driver = "20000"
 		node.name = "Dummy-Driver"
	id 31, type PipeWire:Interface:Node/3
 		object.serial = "31"
 		factory.id = "10"
 		priority.driver = "19000"
 		node.name = "Freewheel-Driver"
	id 34, type PipeWire:Interface:Node/3
 		object.serial = "49"
 		object.path = "alsa:pcm:1:front:1:playback"
 		factory.id = "18"
 		client.id = "36"
 		device.id = "42"
 		priority.session = "1009"
 		priority.driver = "1009"
 		node.description = "Studio 24c Analog Stereo"
 		node.name = "alsa_output.usb-PreSonus_Studio_24c_SC1M20010587-00.analog-stereo"
 		node.nick = "Studio 24c"
 		media.class = "Audio/Sink"
	id 46, type PipeWire:Interface:Node/3
 		object.serial = "50"
 		object.path = "alsa:pcm:1:front:1:capture"
 		factory.id = "18"
 		client.id = "36"
 		device.id = "42"
 		priority.session = "2009"
 		priority.driver = "2009"
 		node.description = "Studio 24c Analog Stereo"
 		node.name = "alsa_input.usb-PreSonus_Studio_24c_SC1M20010587-00.analog-stereo"
 		node.nick = "Studio 24c"
 		media.class = "Audio/Source"
	id 47, type PipeWire:Interface:Node/3
 		object.serial = "47"
 		object.path = "alsa:pcm:2:front:2:playback"
 		factory.id = "18"
 		client.id = "36"
 		device.id = "41"
 		priority.session = "1009"
 		priority.driver = "1009"
 		node.description = "Built-in Audio Analog Stereo"
 		node.name = "alsa_output.pci-0000_00_1b.0.analog-stereo"
 		node.nick = "92HD90BXX Analog"
 		media.class = "Audio/Sink"
	id 48, type PipeWire:Interface:Node/3
 		object.serial = "48"
 		object.path = "alsa:pcm:2:front:2:capture"
 		factory.id = "18"
 		client.id = "36"
 		device.id = "41"
 		priority.session = "2009"
 		priority.driver = "2009"
 		node.description = "Built-in Audio Analog Stereo"
 		node.name = "alsa_input.pci-0000_00_1b.0.analog-stereo"
 		node.nick = "92HD90BXX Analog"
 		media.class = "Audio/Source"
	id 60, type PipeWire:Interface:Node/3
 		object.serial = "66"
 		client.id = "59"
 		client.api = "jack"
 		node.description = "Carla"
 		node.name = "Carla"
 		media.type = "Audio"
 		media.category = "Duplex"
 		media.role = "DSP"
	id 62, type PipeWire:Interface:Node/3
 		object.serial = "68"
 		factory.id = "6"
 		client.id = "61"
 		client.api = "pipewire-pulse"
 		application.name = "LibreWolf"
 		node.name = "LibreWolf"
 		media.class = "Stream/Output/Audio"
root# 

Last edited by geo_c on Fri Jan 19, 2024 4:31 pm, edited 1 time in total.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

rockedge wrote: Fri Jan 19, 2024 3:43 pm

@geo_c what does this in a terminal output?

Code: Select all

wpctl status

and wpctrl showing this, and it appears that carla started with pw-jack carla doesn't show in this output, though it does in pw-cli Node.

Code: Select all

root# wpctl status
PipeWire 'pipewire-0' [1.0.1, spot@void-live, cookie:517297354]
 └─ Clients:
        33. pipewire                            [1.0.1, spot@void-live, pid:20600]
        35. WirePlumber                         [1.0.1, spot@void-live, pid:20599]
        36. WirePlumber [export]                [1.0.1, spot@void-live, pid:20599]
        58. xfce4-pulseaudio-plugin             [1.0.1, root@void-live, pid:20764]
        59. python3.12                          [1.0.1, root@void-live, pid:21732]
        61. LibreWolf                           [1.0.1, root@void-live, pid:21222]
        67. wpctl                               [1.0.1, root@void-live, pid:22208]

Audio
 ├─ Devices:
 │      40. GF106 High Definition Audio Controller [alsa]
 │      41. Built-in Audio                      [alsa]
 │      42. Studio 24c                          [alsa]
 │  
├─ Sinks: │ 34. Studio 24c Analog Stereo [vol: 0.40] │ * 47. Built-in Audio Analog Stereo [vol: 0.40] │
├─ Sink endpoints: │
├─ Sources: │ 46. Studio 24c Analog Stereo [vol: 1.00] │ * 48. Built-in Audio Analog Stereo [vol: 1.00] │
├─ Source endpoints: │
└─ Streams: 62. LibreWolf
65. output_FR > 92HD90BXX Analog:playback_FR [active] 66. output_FL > 92HD90BXX Analog:playback_FL [active] Video ├─ Devices: │
├─ Sinks: │
├─ Sink endpoints: │
├─ Sources: │
├─ Source endpoints: │
└─ Streams: Settings └─ Default Configured Node Names: root#
Last edited by geo_c on Fri Jan 19, 2024 4:58 pm, edited 1 time in total.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

Now I'm analyzing, I see it lists the api being used, and LibreWolf is using pipewire-pulse. LibreWolf is an appimage.
And Carla shows the api being "Jack" but I don't have native jack running and started it with pw-jack.

Let me start a run-as-spot app like Ungoogled Chromium......

Chromium plays and shows pipwire-pulse also, so maybe this airedale isn't as broken as we think:

Code: Select all

id 69, type PipeWire:Interface:Node/3
 		object.serial = "87"
 		factory.id = "6"
 		client.id = "68"
 		client.api = "pipewire-pulse"
 		application.name = "Chromium"
 		node.name = "Chromium"
 		media.class = "Stream/Output/Audio"
Last edited by geo_c on Fri Jan 19, 2024 5:05 pm, edited 1 time in total.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: Working with JACK Audio server in Pipewire KLV's

Post by geo_c »

@rockedge let me sum up the above. By the looks of these two outputs everything is running off the appropriate api, even though Carla api is just listed as "Jack" and not pipewire-jack Carla is showing both sound devices and both browsers, Chromium is running as spot. Librewolf I don't know. It would be however Airedale runs appimages, as I use no special startup commands.

Here's the setup graph in Carla
Image

geo_c
Old School Hipster, and Such

Post Reply

Return to “KL-Dev_Work”