I've set up a Mint 21 (Jammy 22.04) laptop for general purpose use & music production and decided to try out pipewire.
A 5.19 Low Latency Kernel was installed. You probably need to be on at least a 5.14 Kernel. I probably need to move to a 6.x kernel myself.
An additional motivator for using pipewire was that there is a PPA available which provides bluetooth AAC codecs and boy, does that improve the sound in a set of compatible headphones that supports AAC, but I digress.....
The system has been set up to allow switching to pulse & jack from pipewire, if required. Disabling pipewire loses the nice bluetooth audio but that gets me back to pure Jack & ALSA, when required.
The challenge was trying to get soundcards work well under pipewire with low-ish latency. Pipewire configs don't appear to deliver low-latency operation straight out of the box, at least not for me.
An ultimate low-latency setup runs on ALSA without pulse, jack & pipewire but a person loses some flexibility with regards to consumer audio & routing options. I get the feeling that latency is not as good with pipewire as it is with Jack on ALSA, or with ALSA only. At least not for me, but what do I know. And I know next to nothing about Pipewire and trying to make sense of how it works has been a real struggle.
Here's what seems to work for me to tune soundcards to run at somewhat lower latencies without the dreaded xruns.
Please note, this is not a comprehensive sound system installation & configuration & tuning guide. I'm focusing on "pipewire tuning" only in this post.
Setup & installation & configuration & tuning of a Linux audio system isn't covered here. You'll have to take care of that yourselves.
System: Thinkpad
OS: Mint 21, similar to Jammy 22.04 (I wouldn't install Ubuntu, personally. Who needs snap in their life.)
Audio: Pipewire with Wireplumber.
Soundcards tested: Edirol UA-25, Edirol UA-101, MOTU Traveler, Intel internal PCI audio.
I'm assuming a fresh Pipewire / Wireplumber setup, if not "fresh", you may need to re-install or re-initialise it somehow if you haven't kept track of changes you may have made.
Needless to say, perform everything below at your own risk, if your system breaks for whatever reason that's on you.
A reminder, this is for a Mint 21 / Jammy 22.04 environment. Other distributions may function differently.
Wireplumber Configuration files:
ALSA:
sudo cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/
JACK:
sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/
sudo ldconfig -v
Pipewire config, as your local user:
mkdir -p ~/.config/pipewire/
cp /usr/share/pipewire/*.conf ~/.config/pipewire/
In Mint 21 (and Ubuntu 22?) you'll need to create a pipewire group and add your user as a member.
sudo groupadd -g 200 pipewire
usermod -a -G pipewire <your user>
Then set pw parameters in /etc/security/limits.conf
Code: Select all
@pipewire - rtprio 95
@pipewire - memlock 4194304
@pipewire - priority -19
Edit the following files under ~/.config/pipewire/
minimal.conf
pipewire.conf
jack.conf
Uncomment and change values for ~/.config/pipewire/ node.quantum & default.clock.quantum to 256
node.quantum = 256/48000
default.clock.quantum = 256
The magic appears to happen in the /usr/share/wireplumber/main.lua.d/ folder where you can add customised lua configurations for your soundcard.
The magic pipewire values - which usually seemed to work best for my situation - appeared to be as follows:
["api.alsa.period-size"] = 256,
["api.alsa.period-num"] = 3,
On to the soundcard configurations. Create new lua config files and paste the values below for the following soundcards.
You'll have to check the node.name values for your particular devices and modify if required.
Motu Traveler
sudo vi /usr/share/wireplumber/main.lua.d/51-fw-traveler-config.lua
Code: Select all
rule = {
matches = {
{
-- Matches all sources.
{ "node.name", "matches", "alsa_input.firewire-0x0001f20000020b81.*" },
},
{
-- Matches all sinks.
{ "node.name", "matches", "alsa_output.firewire-0x0001f20000020b81.*" },
},
},
apply_properties = {
["api.alsa.period-size"] = 256,
["api.alsa.period-num"] = 3,
},
}
table.insert(alsa_monitor.rules, rule)
Edirol UA-25
sudo vi /usr/share/wireplumber/main.lua.d/52-usb-ua25-config.lua
Code: Select all
rule = {
matches = {
{
-- Matches all sources.
{ "node.name", "matches", "alsa_input.usb-Roland_EDIROL_UA-25-00.*" },
},
{
-- Matches all sinks.
{ "node.name", "matches", "alsa_output.usb-Roland_EDIROL_UA-25-00.*" },
},
},
apply_properties = {
["api.alsa.period-size"] = 256,
["api.alsa.period-num"] = 3,
},
}
table.insert(alsa_monitor.rules, rule)
Intel Internal PCI Soundcard
sudo vi /usr/share/wireplumber/main.lua.d/53-pci-intel-config.lua
Code: Select all
rule = {
matches = {
{
-- Matches all sources.
{ "node.name", "matches", "alsa_input.pci-0000_00_1f.3.*" },
},
{
-- Matches all sinks.
{ "node.name", "matches", "alsa_output.pci-0000_00_1f.3.*" },
},
},
apply_properties = {
["api.alsa.period-size"] = 256,
["api.alsa.period-num"] = 3,
},
}
table.insert(alsa_monitor.rules, rule)
EDIROL UA-101
Note that the period number for the UA-101 was set to 5 because lower values produced xruns.
sudo vi /usr/share/wireplumber/main.lua.d/54-usb-ua101-config.lua
Code: Select all
rule = {
matches = {
{
-- Matches all sources.
{ "node.name", "matches", "alsa_input.usb-EDIROL_UA-101_*.*" },
},
{
-- Matches all sinks.
{ "node.name", "matches", "alsa_output.usb-EDIROL_UA-101_*.*" },
},
},
apply_properties = {
["api.alsa.period-size"] = 256,
["api.alsa.period-num"] = 5,
},
}
table.insert(alsa_monitor.rules, rule)
Please add any additional useful tips, suggestions, configuration tricks for pipewire that you may know about below.