pipewire SHAKEDOWN TEST on KLV-airedale-RT

Kennel Linux Void-based


Moderator: Forum moderators

Post Reply
geo_c
Posts: 2881
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 2205 times
Been thanked: 878 times

pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by geo_c »

As @rockedge, @Clarity, and @fredx181 helped me fine tune my understanding of pipewire audio in KLV and add a necessary terminal command to get midi working, I thought I should post some results.

Pipewire allows linux audio users to run jack audio applications without installing jack, but it's so MUCH MORE. Not only can one run jack applications, but all applications, whether using jack api or pulseaudio api are able to route audio to the inputs and outputs of each other. It also takes audio input from cameras and built-in microphones and other devices. Every recognized audio device on the system is available to route from one applicaton to another.

So I decided to open up Ardour Digittal Workstation to do a shakedown. This test is concerned with audio, and not video streams. I'm running a fairly ancient Dell Precision with an intel i7 and 8gb of ram. The cpu scheduling is 'schedutil' and max cpu clock is 3.1GHz.

Carla reports the buffer at 256 which seems to be set automatically by pipewire. Native jack was running at 1024 on this machine, which is significantly higher latency. Sample rate is 48K.

THE TEST:
LibreWolf browser playing a youtube video
Parole playing an mp4 video
Musescore4 playing one of my original scores of music
Musikcube playing an mp3
Carla rack playing a soft synthesizer triggered through midi by an attached Akai USB midi keyboard

All audio outs of these applications were routed to stereo inputs in Ardour, so that's a total of 10 tracks being recorded simultaneously.

Helvum, a pipewire patchbay graph, shows the setup below:
Image

AUDIO RESULTS:
10 captured 48K sampled tracks in ardour for 5 minutes with a buffer of 256
no x runs or pops or drops in the audio
almost imperceptble latency using midi keyboard to virtual instrument
to sum up: pretty stellar performance

Other RESULTS
-certain applications, like the browser and parole, reset connections after pausing, very annoying, which I will be looking at.
-the actual audio recording produced no xruns or pops, but everytime a new application was opened, a pop could be heard, and Carla reported an xrun, 10 of these occurred as I was setting up the test.

-I could upload and share the audio mix, but it's an awful cacaphony of sound that might cause nausea and heart palpitations.

geo_c
Old School Hipster, and Such

geo_c
Posts: 2881
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 2205 times
Been thanked: 878 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by geo_c »

I ran Ardour and Carla playing virtual instruments, multi-sample sfz instruments using the sfizz plugin. That's a pretty heavy load. But I set the buffer in Ardour to 32. That's extremely low latency. No Xruns at all playing that way. Very impressive. The timing playing fast virtual drum parts on a keyboard was far above anything I've ever experienced on my underpowered machines. The processors on my machine were running around 50% according to Carla.

I will say that Ardour is being a bit buggy using pipewire. The internal metronome does not work, I'll have to look into it diligently, because that right there is an important tool. Also Ardour tends to bomb out often with a segmentation fault when switching projects. It could be running it with pipewire, or it could be other settings I'm using. But to be fair I have found Ardour to be prone to having difficulty opening it's own project files. Granted I move them from machine to machine, and perhaps this has something to do with it. I'll have to check out the Ardour forum. They recently moved from version 7 to version 8, and it seems like only a year or so since version 7 came out, probably less.

Pipewire seems to be set to open new applications with ouputs automatically routed to the pulse fallback device. This is a distraction when doing pro-audio. It might be that there are options in the pw-jack command for telling pipewire which device to use.

Even though external connections from other applications and devices can and often need to be done using a graph connection like Helvum, qpwgraph, or Carla, I'm finding the most consistent way is to use the internal routing features in Ardour. The external graphs reflect the change immediately.

geo_c
Old School Hipster, and Such

User avatar
Jasper
Posts: 2067
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 854 times
Been thanked: 480 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by Jasper »

I have no idea what I am doing :lol:

Playback of an online video via the browser and an audio track in mpv

Just wanted to try coppwr-1.5.1

Image

geo_c
Posts: 2881
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 2205 times
Been thanked: 878 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by geo_c »

Jasper wrote: Sat Jan 20, 2024 8:10 pm

Just wanted to try coppwr-1.5.1

Oh that looks like a good tool. But it doesn't seem to be in the Void repo. Are you on bookworm or something?

Last edited by rockedge on Fri Aug 02, 2024 11:42 pm, edited 1 time in total.
Reason: removed broken image link

geo_c
Old School Hipster, and Such

User avatar
Jasper
Posts: 2067
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 854 times
Been thanked: 480 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by Jasper »

Binary available here:

https://github.com/dimtpap/coppwr

geo_c
Posts: 2881
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 2205 times
Been thanked: 878 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by geo_c »

Running a lot more tests using pipewire, pipewire-jack, pipewire-pulse and various applications that run under each api. And the possibliliies are endless.

Void repos contain the LSP plugin suite. When installed all the plugins can run standalone, appear in the multimedia category of the Xfce start menu, but need to be started with the command pw-jack [plugin-name] I found it easiest to right click on the Xfce menu entries and choose "edit application" which gives you a command line that will edit the desktop.file found in /usr/share/applications. Just insert pw-jack in front of the application name and save. Choosing from the start menu will then run the plugin standalone using pw-jack, and then it will show up in Helvum, qpwgraph, Carla.

I installed all the jack applications available in Void and have been testing. Muse, Hydrogen, Ardour, Carla, Calf, Guitarx, Yoshimi Soft Synth, and all the lv2 plugin collections. I tried Qtractor, which is an audio midi recording application that I like, but which didn't seem to run well on pipewire. It just sort of hangs and becomes hard to kill.

Tonight I used an LSP latency measuring tool and the Jack Mixer, The jack mixer is a fantastic tool to use under pipewire. It starts out with no channels, and you can simply add input and output channels. It gives you vu meters on every signal you route in and out of it.

Here's the configuration using the latency meter:

I used Hydrogen for the source audio:
Image

THE TEST
Hydrogen routed to the jack mixer to the Audio interface output, but also to the input of the Alsa mixer which was started by Precord (built in KLV-ariedale-RT) Precord is visible along the top right, and it's vu meter is top left. The latency meter is attached to the input of the jack mixer and the monitor out of the alsa mixer. I'm testing the latency from audio input to the jack mixer to monitor out of the Alsa monitor, which measured 21 miliseconds running pw-jack at a buffer of 1024. I now need to learn how to set the pipewire, or pipewire-jack buffer from the command line. I can do it from Ardour, but I don't want to have to fire up Ardour just to set the buffer.

The second half of the test was trying to capture audio with a smaller tool than a DAW, I captured the Hydrogen audio using Precord, which I found the interface a little clunky to get around, so the captured file came out at the default mp3 quality, really low, but that's okay, because I was just testing. I set it max quality, but somehow it reverted in the process. I looked at the captured file details with a tool from the Void repo called mediainfo :
Image

I will now be looking for some info about using pipewire and pipewire jack in combination with pulse apps, because every time a pulse app is started, a lot of connections and disconnections are made automatically, which doesn't happen with the jack applications. Makes sense, jack is designed for pro audio stability, pulse for plug and play.

Image

geo_c
Old School Hipster, and Such

User avatar
trawglodyte
Posts: 257
Joined: Mon Dec 11, 2023 11:32 am
Location: my cave
Has thanked: 234 times
Been thanked: 77 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by trawglodyte »

I'm not sure about setting paramaters from command line. But you can set sytem defaults. On BookwormPup64 here, they are in folder /usr/share/pipewire. But there's a little trick. You have to copy the folder "pipewire" to /etc I dunno why it defaults like that? It was the same way on Debian 12. For me, pipewire only truly comes alive after I move the configs.

Check on your machine. Is there a "pipewire" folder in /etc/ ? If not, is there a "pipewire" folder in /usr/share/ ? You have to copy it from /usr/share to /etc to take effect.

Apps can over-ride settings, but sometimes don't. For me, getting clock rates, video resolution, audio format/rate, specifying 2 channel (no surround), format (S24LE, not F32 or S16LE for me) and so forth on a system level makes everything work a lot better.

Latency isn't an issue for me, but the pipewire-pulse.conf file, under "pulse.properties" is where you have the settings which give you some control and tweaking ability for that.

There's a few ways to approach setting system defaults. If you want to tweak around these .conf files it may be wise to make a backup first. You can also create your own config. In other Linux distros I did it with an .asoundrc in my home folder, I don't know if .asoundrc in root folder on Puppy would do the same thing. IIRC, you can also make an /etc/asound.conf file. That might be the best way because those settings over-ride all the configs, and between pipewire, alsa and so forth there's a lot of them. Not gonna lie, I just change all the pipewire and alsa configs manually, which is probably the way you aren't supposed to do it. But I know the values that work best for my setup.

low-bar learner

geo_c
Posts: 2881
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 2205 times
Been thanked: 878 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by geo_c »

trawglodyte wrote: Mon Jan 22, 2024 7:50 pm

Not gonna lie, I just change all the pipewire and alsa configs manually, which is probably the way you aren't supposed to do it. But I know the values that work best for my setup.

Thanks trawg. Do you mind if I call you that? That's helpful. I'm gonna poke around the configs and command line options tonight when I get home.

I might be setting buffers on the fly for various operations. If I'm laying a virtual instrument track I want a really low buffer. But if I'm mixing down with a load of resource heavy plugins, I'll want it higher or it will chug and sputter.

The other night I was playing virtual instruments with the buffer at 32, and that was fantastic. Instant response.

I loaded some more good applications from the void repo this morning.

I'm going to thoroughly test all these apps and put together a compressed 08-KLV-audio.sfs layer that can be added to a KLV just by copying the file into the install directory and booting. KLV's are versatile that way. Then I'll upload it for sharing.

geo_c
Old School Hipster, and Such

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

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by rockedge »

You have to copy the folder "pipewire" to /etc

I forgot to mention there is a pipewire.conf directory placement hierarchy :shock:

More on the placement of pipewire.conf and what takes precedence in the Void Linux Handbook -> https://docs.voidlinux.org/config/media/pipewire.html

From the Arch Linux Wiki:

NAME

pipewire.conf - pipewire.conf
DESCRIPTION

The PipeWire server configuration file
SYNOPSIS

$XDG_CONFIG_HOME/pipewire/pipewire.conf

/etc/pipewire/pipewire.conf

/usr/share/pipewire/pipewire.conf

/usr/share/pipewire/pipewire.conf.d/

/etc/pipewire/pipewire.conf.d/

$XDG_CONFIG_HOME/pipewire/pipewire.conf.d/
DESCRIPTION

PipeWire is a service that facilitates sharing of multimedia content between devices and applications.

On startup, the daemon reads a main configuration file to configure itself. It executes a series of commands listed in the config file.

The config files are loaded in the order listed in the SYNOPSIS. The environment variables PIPEWIRE_CONFIG_DIR, PIPEWIRE_CONFIG_PREFIX and PIPEWIRE_CONFIG_NAME can be used to specify an alternative config directory, subdirectory and file respectively.

Next to the configuration file can be a directory with the same name as the file with a .d/ suffix. All directories in the SYNOPSIS directory search paths are traversed in the listed order and the contents of the *.conf files inside them are appended to the main configuration file as overrides. Object sections are merged and array sections are appended.
CONFIGURATION FILE FORMAT

The configuration file format is grouped into sections. A section is either a dictionary, {}, or an array, []. Dictionary and array entries are separated by whitespace and may be simple value assignment, an array or a dictionary. For example:

name = value # simple assignment
name = { key1 = value1 key2 = value2 } # a dictionary with two entries
name = [ value1 value2 ] # an array with two entries
name = [ { k = v1 } { k = v2 } ] # an array of dictionaries

The configuration files can be expressed in full JSON syntax but for ease of use, a relaxed format may be used where:

Code: Select all

: to delimit keys and values can be substuted by = or a space.
" around keys and string can be omitted as long as no special characters are used in the strings.
, to separate objects can be replaced with a whitespace character.
# can be used to start a comment until the line end

CONFIGURATION FILE SECTIONS

context.properties
Dictionary. These properties configure the PipeWire instance.

context.spa-libs
Dictionary. Maps plugin features with globs to a spa library.

context.modules
Array of dictionaries. Each entry in the array is a dictionary with the name of the module to load, including optional args and flags. Most modules support being loaded multiple times.

context.objects
Array of dictionaries. Each entry in the array is a dictionary containing the factory to create an object from and optional extra arguments specific to that factory.

context.exec
Array of dictionaries. Each entry in the array is dictionary containing the path of a program to execute on startup and optional args.

This array used to contain an entry to start the session manager but this mode of operation has since been demoted to development aid. Avoid starting a session manager in this way in production environment.

User avatar
trawglodyte
Posts: 257
Joined: Mon Dec 11, 2023 11:32 am
Location: my cave
Has thanked: 234 times
Been thanked: 77 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by trawglodyte »

EDIT, I should have read the link from @rockedge first. (the post above this one) Some of this is redundant and I think his link is more current info.

I did stumble across this last week. A couple keys IMO are uninstalling pulseaudio if you have it, getting pipewire-pulse pipewire-jack pipewire-alsa wireplumber if you don't already have. I dunno if this is specific to Debian or general linux advice from pipewire.

Code: Select all

Using pipewire for audio

pipewire in Debian was initially used for video (screen sharing and remote
desktop, particularly in GNOME and KDE Wayland sessions). However, it has
matured enough to also be used for audio.


Using pipewire as a substitute for PulseAudio

Install the pipewire-pulse package and log back in.
And potentially install the new recommended session manager
wireplumber instead of the deprecated pipewire-media-session.

PipeWire project recommends [1] to remove the pulseaudio package to prevent
conflicts in some cases [2] even if both pulseaudio and pipewire-pulse
services are not running at the same time.
pipewire-pulse doesn't conflict with pulseaudio at the package level to allow
users to switch from one to the other just by disabling/enabling services.

[1] https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#should-i-uninstall-everything-pulseaudio
[2] https://bugs.debian.org/1013276


Using pipewire with Bluetooth

Install the libspa-0.2-bluetooth package to add Bluetooth support to pipewire.

Please note that AAC codec support is currently disabled due to license issue.
See https://bugs.debian.org/981285

Pipewire (nor any other package) does not depend or recommend libspa-0.2-bluetooth
as not all users are interested in Bluetooth support.
The same apply to pulseaudio and pulseaudio-module-bluetooth:
pulseaudio does not depend or recommend pulseaudio-module-bluetooth.

However, pulseaudio-module-bluetooth and libspa-0.2-bluetooth are installed on
a system through the dependency of a Desktop Environment. For example,
with GNOME, the bluetooth plugin is pulled by the meta package gnome-core.

Moreover, both pipewire-pulse and wireplumber packages already suggest
to install the libspa-0.2-bluetooth package.


Using pipewire as the default ALSA output device

Install the pipewire-alsa package.

ALSA clients will output via pipewire instead of PulseAudio or directly to
ALSA.

pipewire-alsa conflicts with pulseaudio because both try to take control of
all ALSA devices and redirect all audio streams to them. But, because of their
respective configs files name:
- PipeWire:	/etc/alsa/conf.d/99-pipewire-default.conf
- PulseAudio:	/etc/alsa/conf.d/99-pulse.conf
which make PulseAudio ordered after PipeWire. PulseAudio will take the
final control of ALSA clients even when pipewire-alsa is installed. Thus,
to allow ALSA clients redirecting output to pipewire, pulseaudio package
needs to be removed.

To check where streams are redirected, run the following command:
$ aplay -L | grep -A 1 default


Using pipewire as a substitute for JACK

Install the pipewire-jack package.

JACK clients can be configured to output via pipewire instead of JACK.

To enable this:

* either run JACK clients using the pw-jack(1) wrapper, or copy
  /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf
  into /etc/ld.so.conf.d/ and run ldconfig as root.


Setting pipewire real-time priority limits

!!!  WARNING  !!!
Your system has real-time priority limits for a good reason. This allows it
to remain stable in case a process goes crazy. RTKit allows limited use of
real-time priority without the risk of locking up the system if a real-time
task starts spinning.
Some upstream recommendations for real-time are to increase these limits to
bypass RTKit or to disable most of its safeguards. By following them, your
system could be blocked if a process goes wrong.
These performance tweaks are not needed for a normal use of pipewire, instead
modifying pipewire configuration is enough.
!!!  WARNING  !!!

The "pipewire" package creates a system group called "pipewire".
The upstream recommended priority limits for this group are defined in:

* /etc/security/limits.d/95-pipewire.conf

To enable these limits for your user, add it to the "pipewire" group.

* sudo adduser yourusername pipewire

low-bar learner

geo_c
Posts: 2881
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 2205 times
Been thanked: 878 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by geo_c »

trawglodyte wrote: Tue Jan 23, 2024 1:43 am

I did stumble across this last week. A couple keys IMO are uninstalling pulseaudio if you have it, getting pipewire-pulse pipewire-jack pipewire-alsa wireplumber if you don't already have. I dunno if this is specific to Debian or general linux advice from pipewire.

Code: Select all

Using pipewire for audio

pipewire in Debian was initially used for video (screen sharing and remote
desktop, particularly in GNOME and KDE Wayland sessions). However, it has
matured enough to also be used for audio.


Using pipewire as a substitute for PulseAudio

Install the pipewire-pulse package and log back in.
And potentially install the new recommended session manager
wireplumber instead of the deprecated pipewire-media-session.

PipeWire project recommends [1] to remove the pulseaudio package to prevent
conflicts in some cases [2] even if both pulseaudio and pipewire-pulse
services are not running at the same time.
pipewire-pulse doesn't conflict with pulseaudio at the package level to allow
users to switch from one to the other just by disabling/enabling services.

[1] https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#should-i-uninstall-everything-pulseaudio
[2] https://bugs.debian.org/1013276


Using pipewire with Bluetooth

Install the libspa-0.2-bluetooth package to add Bluetooth support to pipewire.

Please note that AAC codec support is currently disabled due to license issue.
See https://bugs.debian.org/981285

Pipewire (nor any other package) does not depend or recommend libspa-0.2-bluetooth
as not all users are interested in Bluetooth support.
The same apply to pulseaudio and pulseaudio-module-bluetooth:
pulseaudio does not depend or recommend pulseaudio-module-bluetooth.

However, pulseaudio-module-bluetooth and libspa-0.2-bluetooth are installed on
a system through the dependency of a Desktop Environment. For example,
with GNOME, the bluetooth plugin is pulled by the meta package gnome-core.

Moreover, both pipewire-pulse and wireplumber packages already suggest
to install the libspa-0.2-bluetooth package.


Using pipewire as the default ALSA output device

Install the pipewire-alsa package.

ALSA clients will output via pipewire instead of PulseAudio or directly to
ALSA.

pipewire-alsa conflicts with pulseaudio because both try to take control of
all ALSA devices and redirect all audio streams to them. But, because of their
respective configs files name:
- PipeWire:	/etc/alsa/conf.d/99-pipewire-default.conf
- PulseAudio:	/etc/alsa/conf.d/99-pulse.conf
which make PulseAudio ordered after PipeWire. PulseAudio will take the
final control of ALSA clients even when pipewire-alsa is installed. Thus,
to allow ALSA clients redirecting output to pipewire, pulseaudio package
needs to be removed.

To check where streams are redirected, run the following command:
$ aplay -L | grep -A 1 default


Using pipewire as a substitute for JACK

Install the pipewire-jack package.

JACK clients can be configured to output via pipewire instead of JACK.

To enable this:

* either run JACK clients using the pw-jack(1) wrapper, or copy
  /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf
  into /etc/ld.so.conf.d/ and run ldconfig as root.


Setting pipewire real-time priority limits

!!!  WARNING  !!!
Your system has real-time priority limits for a good reason. This allows it
to remain stable in case a process goes crazy. RTKit allows limited use of
real-time priority without the risk of locking up the system if a real-time
task starts spinning.
Some upstream recommendations for real-time are to increase these limits to
bypass RTKit or to disable most of its safeguards. By following them, your
system could be blocked if a process goes wrong.
These performance tweaks are not needed for a normal use of pipewire, instead
modifying pipewire configuration is enough.
!!!  WARNING  !!!

The "pipewire" package creates a system group called "pipewire".
The upstream recommended priority limits for this group are defined in:

* /etc/security/limits.d/95-pipewire.conf

To enable these limits for your user, add it to the "pipewire" group.

* sudo adduser yourusername pipewire

Yes thanks for these links. I have perused those pipewire pages recently. The way this KLV is operating, pulse is not being used, it's all pipewire-pulse and pipewire-jack. I actually came to this knowledge by installing jack proper on the KLV-airedale-RT and using it, and then finally through exploring info, realizing that it didn't need to be installed at all. That whole discovery process (discovery of the bleeding obvious, though to be fair, there's a lot of confusing info out there about pipewire, jack, and alsa) can be found here: viewtopic.php?t=10343

HOWEVER, the system I'm running now has got both pipewire-jack and native jack.. I can still start up native Jack audio and it runs fine. Or I can quit jack and run jack apps with pw-jack [appname] and it works even better than native jack. But at the moment it doesn't look like there's a reason to uninstall native jack.

At this point you might be grasping that we puppy-forum regulars tend to have many many OSs, or many versions of the same OS. And so right now I have this KLV-airedale-RT built with an extra squashed read-only layer, called KLV-airedale-JackPipe. But after all the experimentation and testing is done, I'll be building a fresh version, probably without native jack installed. Though I will miss it, nostalgically.

geo_c
Old School Hipster, and Such

Clarity
Posts: 3842
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1632 times
Been thanked: 526 times

Re: pipewire SHAKEDOWN TEST on KLV-airedale-RT

Post by Clarity »

@rockedge, @geo_c, @fredx181, @Sofiya, and @trawglodyte

You will probably benefit in this demo of qpwgraph of streams in Pipewire and ALSO cameras-video streaming.

Consistent info with the work going on here in the forum.

Post Reply

Return to “KLV-Airedale”