Mint 20.3 - Can't get bit-perfect audio with PipeWire @ 16bit or 24bit, but can with 32float and/or 16bit 192kHz?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
NM64
Level 4
Level 4
Posts: 245
Joined: Sat Feb 04, 2017 11:34 pm

Mint 20.3 - Can't get bit-perfect audio with PipeWire @ 16bit or 24bit, but can with 32float and/or 16bit 192kHz?

Post by NM64 »

UPDATE: After farther testing, the issue seems to occur with any 16bit or 24bit audio (except 16bit 192kHz interestingly enough) while 32float sources are always bit-perfect. Furthermore, the difference in waveforms is at -90dB for 16bit sources and -135dB for 24bit sources, implying that something is perhaps being handled improperly with the lowest bit of audio (rounding error?).


--------------------------------


I don't know if is a known bug or something, but a quick search provided nothing... I'm quite the Linux beginner but, at least on Windows, I'm very much not an audio beginner.


So I was poking around with how Linux handles audio playback and, at least with bone-stock Linux Mint 20.3 without PipeWire (whether after install or via a live USB), simply playing bog-standard 44.1kHz 16bit FLAC and 48kHz 16bit FLAC through Celluloid resulted in bit-perfect playback compared to the actual FLAC files.

The way I verify this this is I record PulseAudio via Audacity v2.1.2* with the project rate set to the according sampling rate and every volume slider I can find set to 100%, import the FLAC file as a secondary track, line up the two tracks so that they're exactly matched, invert one of the tracks, mix and render them into a new track, and then amplify the new track - if amplify says "-infinity" then it's 100% identical.

(playing a 192kHz 16bit FLAC through Celluloid gave results that implied that the audio is being resampled despite my hardware being capable of 192kHz 24bit and I have no idea if I can do anything about it other than installing PipeWire, but that's besides the point of this thread)


However, when installing PipeWire (something like version 0.3.4? I can't remember), I can no longer get bit-perfect playback of either 44.1kHz 16bit nor 48kHz 16bit unless the audio is being played through JACK (via Audacious). Interestingly however, 192kHz 16bit is bit-perfect in PipeWire regardless of whether the audio is played through PulseAudio (via Celluloid) or through JACK (via Audacious).

For reference, it's extremely close to bit-perfect in that the results look very similar to if you were taking a 24bit signal and dithering it down to 16bit... except that's clearly not quite what is happening since, after doing the waveform inversion and amplifying the waveform by a LOT (like 90dB), I'm not getting the white noise you'd expect from 24-to->16bit conversion - what I get instead after applying something like 90dB amplification is pretty much what sounds like the actual source audio in question (though perhaps degraded in fidelity?).

The fact so much information is retained even after a ~90dB amplification implies to me that it's clearly something going on in the floating point domain, almost as if PipeWire is changing the gain by the teeniest bit. Manually testing this hypothesis in Audacity, if I amplify one of two duplicated identical tracks by a mere 0.001dB and then invert it and mix the two tracks together, I get results that are extremely similar to what I'm getting with my PipeWire recordings (except that PipeWire, if anything, would be adjusting the gain by even less, like maybe 0.0003dB, but Audacity v2.1.2 won't let me amplify by less than 0.001dB so I can't test that).


And to clarify, before playing a given audio clip in Celluloid or Audacious via PipeWire, I made sure to run the following terminal command to set PireWire's output sampling rate to whatever sampling rate matched the according FLAC file (replacing "<samplerate>" with 44100 or 48000 or 192000):

Code: Select all

pw-metadata -n settings 0 clock.force-rate <samplerate>
(speaking of which, I can't seem to get it to read custom values from a "pipewire.conf" file but, being quite the Linux beginner, perhaps I'm just "doing it wrong"?)


*yes 2.1.2 is an old version of Audacity (it was the version that Mint 18.3 provided in its software manager), but it's the last version that lets you use the "Mute" and "Solo" buttons as a way to ABX audio (something I do quite frequently and have done for over a decade now).
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
CPU: Xeon E3-1246 v3 (4c/8t Haswell/Intel 4th gen) — core & cache @ 3.9GHz via multicore enhancement
GPU: Intel integrated HD Graphics P4600
RAM: 4x8GB Corsair Vengence @ DDR3-1600
OS: Linux Mint 20.3 Xfce + [VM] Win7 SP1 x64 
Locked

Return to “Sound”