• Welcome to ASR. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Bit-Perfect Audio on Linux with PipeWire

And none of it audible unless you want to kill your speakers and shred your eardrums when the real music starts playing. :p
It certainly is inaudible, but so is a bit(im)perfect chain (digital volume control for 24bit signal, quality resampling). So the question of bitperfection is mostly technical, not practical for listening purposes. Then it either is or is not bitperfect, for a given I/O format.
 
So the lowest bits still generate some signal but not much linearity is left.

JCally JM20 seems to actually truncate to 24 bits because starting from -138.46 dBFS there is no more output.
I had one more point to investigate, which changes conclusions a bit, but I forgot. The thing is that when you simply truncate (instead of round) a small signal, it doesn't become 0, but rather a square switching between 0 and -1. Take for example -139 dBFS:
Code:
-139 dBFS, peak ±242: 0x000000f2 - 0xffffff0e
When you truncate this to 24-bits you get:
Code:
0x000000 - 0xffffff
All positive values become 0 and all negative values become -1 (in int24 range).

Here is the input signal from earlier:

Input signal

And manually truncated to 24-bits:

Input signal manually truncated

And the recorded signals from earlier:

RME Adi-2 Pro
FiiO K3 (ESS)
Tanchjim Space

So looks like only FiiO K3 maybe has some kind of processing of the lowest bits and Adi-2 and Tanchjim Space seem to truncate.

JCallys on the other hand don't truncate but have some detection mechanism and simply ignore too small signals.

And none of it audible unless you want to kill your speakers and shred your eardrums when the real music starts playing. :p
Yes, it is "perceptually lossless" (as certain codec boasted in the past ;) )
 
Last edited:
The thing is that when you simply truncate (instead of round) a small signal, it doesn't become 0, but rather a square switching between 0 and -1.
So that's 1 LSB error with negative numbers rounding vs. truncation s32 -> s24 , absolutely inaudible.
 
So that's 1 LSB error with negative numbers rounding vs. truncation s32 -> s24 , absolutely inaudible.
Sure, but it shows that a mere presence of the signal on the output is not a sufficient condition to claim whether truncation happened or not.
 
very thorough interesting guide! this actually pushed me to start using Pipewire on Fedora instead of Pulseaudio (yes I know, it's old) .
this is my current wireplumber conf file with Pipewire, and I get sample rate switching according to the file played on mpv
monitor.alsa.rules = [
{
matches = [ { node.name = "alsa_output.usb-SMSL_SMSL_USB_AUDIO-00.iec958-stereo" } ]
actions = {
update-props = {
audio.allowed-rates = [ 44100 48000 88200 96000 192000 ]
api.alsa.rate = 0
}
}
}
]
I also played a FLAC file I downloaded from Tidal, which is in "MQA encoding (BS)" that normally lights up the blue led on my SMSL PO100 DDC to indicate "Studio MQA quality" (only when the output volume is set to 100%) - and it indeed light up, so I believe i currently getting bit perfect as it is - but i'm going to try making new conf file according to your guide anyway
 
That is cool! Which music player do you use?
Feishin , that uses mpv

EDIT: interesting - when playing files with VLC, I see sample rate changes (according to the file) - but not the MQA led turning on when I play that specific FLAC file downloaded from Tidal
EDIT2: i had "audio resampler" turned on in VLC as "automatic" . I guess it's turned on by default. once disabled, MQA led is turning on with VLC playing on the PO100
 
Last edited:
and i thought pw is simpler than pa… i'm staying away from extra layers and having player streaming directly to ALSA, and ALSA directly to dac ;). no volume control for me too, since dac is doing that already. cat stream0 to verify current samp frequency and then verify on dacs display (not needed). on my config pipewire runs only for browser (firefox ditched direct alsa support, but it's precompiled in some specific configs, like appimage). never using soft mixers for simultaneous playback – cause what is it for other than notifications interrupting music/movie?
 
Last edited:
Thank you for this guide. Does the "resample.quality" value set in PipeWire config files also apply to Bluetooth audio?
Firefox: Resamples internally. Check about:config → media.cubeb.output_rate and media.resampling.rate. By default, Firefox outputs at the system rate set by PipeWire.
That's not the case for me (with Firefox version 150.0.2). Firefox outputs exactly the sampling rate of audio tracks from Qobuz. The only time this would not be the case is if there was an audio stream open in another tab (even if paused). I don't even see "media.cubeb.output_rate" or "media.resampling.rate" in about:config. I have the setting "media.resampling.enabled" set to false, so maybe that's the reason, but it was like that by default.

So my recommendation would be that if you want to stream via web browser, choose Firefox over a Chromium-based one.
 
A GUI for this would be a dream, but even without, great work, great thanks
Not really a GUI, but I have created a shell script that does most of the work mentioned in the OP.
You will still need to change the default sample rate if you don't want it to be 48Khz. I chose it since most of my audio is at that rate.
Also, it doesn't deal with the no longer used pipewire sink, I might deal with that later.
Bit perfect script link
 
Last edited:
There may be a brief click or silence during rate switches. This is normal — the USB Audio Class endpoint is being reconfigured.
Thanks for the guide. Very helpful.

I would quibble with the above - if this is happening you don't have bit perfection. Same with any brief silence from the cold start of a track. It's actually un-debatably audible, unlike resampling and other things we take great lengths to avoid.

Not all DACs display this behavior, so it's a problem that can be solved. I wish we wouldn't have people repeating that it's normal. It provides an excuse for manufacturers to do nothing about it.
 
if this is happening you don't have bit perfection.
I personally would not consider a short and ramped-up muting at samplerate change a bit imperfection.
I wish we wouldn't have people repeating that it's normal. It provides an excuse for manufacturers to do nothing about it.
If the USB controller receives samplerate change USB message, immediately followed by new audio samples, it's hard to avoid an audible click without a controlled mute of the initial samples.
SPDIF receivers face a similar situation, and mute their output for several millisecs upon samplerate change.
 
I personally would not consider a short and ramped-up muting at samplerate change a bit imperfection.

If the USB controller receives samplerate change USB message, immediately followed by new audio samples, it's hard to avoid an audible click without a controlled mute of the initial samples.
SPDIF receivers face a similar situation, and mute their output for several millisecs upon samplerate change.
I have had DACs that don't do this. The Metrum Octave MkII did not do this, for example, so it is possible to address.

Also, some DACs will cut off a few milliseconds of audio when starting a track from standby. And the suggested "fix" is use a workaround that results in resampling like keeping a silent bitstream open. That's defective in my view.

EDIT: I don't want to clutter up this nice thread further - so that's my say done and apologies for the diversion.
 
Last edited:
Yes it is a flaw that should be fixed by muting, not all DACs do it.

And yes, nothing to do with bit-perfect or not, which IMO is not an important goal in and of itself.
 
Last edited:
Thanks for the guide. Very helpful.

I would quibble with the above - if this is happening you don't have bit perfection. Same with any brief silence from the cold start of a track. It's actually un-debatably audible, unlike resampling and other things we take great lengths to avoid.

Not all DACs display this behavior, so it's a problem that can be solved. I wish we wouldn't have people repeating that it's normal. It provides an excuse for manufacturers to do nothing about it.

You're describing a real and audible thing, but it's a different property from bit-perfection — and the distinction matters.

Bit-perfection is about the sample values delivered to the DAC: are they identical to the source, with no resampling, volume scaling, or truncation? A gap during a rate switch doesn't alter a single sample. The audio that plays is still bit-identical to the source.

Gapless / continuous playback is a separate property — whether the transport has discontinuities. The two are orthogonal:
  • Bit-perfect but with a rate-switch gap (this guide's setup)
  • Gapless but resampled to a fixed rate (continuous, not bit-perfect)

In my case the gap is the DAC, not PipeWire. The Bifrost 2 uses a muting relay — Schiit's manual says it outright: "Many computer sources turn off the digital audio output between songs and when changing sampling rates. We went with a muting relay because it's the best way to ensure there are no clicks or pops when the input is unlocked. But it does click a bit." That relay physically mutes the output for a moment on every rate change. It's an intentional hardware design choice, and it's audible — a click, then a brief silence.

So you're right on two counts: it's audible, and not all DACs do it. Some handle rate changes seamlessly; the Bifrost 2 (and most Schiit multibit DACs) click their relay every time. Where I'd push back is the framing — it isn't a loss of bit-perfection, and it isn't PipeWire resampling or truncating. It's the DAC muting itself during reconfiguration.
 
If you want this for multiple usb devices you can so long as you give a unique identifier for "node.name" "node.description" and put this in a separate config file.

Very cool and thanks for posting this!
 
Last edited:
What does "this" here refer to?
Well what do you think it refers to? Because from my pov it's clear that it's about the bit-perfect setup described in the first post. Maybe i should clarify that by usb devices i meant audio devices. But ah well.
 
Well what do you think it refers to?

It is useful on any thread (unless yours is the second post) to quote the post you are replying to (or even a small snippet of it like I have here - just select the text you want to quote and hit "reply" next to the selected text) - even when it is the first one. Otherwise we can only guess that is what you meant - you might be replying to any of the previous 55+ posts.
 
Back
Top Bottom