sone icon indicating copy to clipboard operation
sone copied to clipboard

[Feature] Do not mark S16 / S24 -> S32 conversion as lossy if sampling rates match

Open Arouraios opened this issue 6 months ago • 2 comments

First of all, I love the display that appears when clicking on the sampling rate, it's a very nice way to verify pipeline integrity.

However, it was devastating to see "not pristine - 1 lossy stage", caused by the PipeWire conversion to the "internal mix format". That's why I spent the last hour looking into the PCM formats and from what I've read, especially about bit depth, this is a "false positive".

After adjusting the default.clock.allowed-rates in pipewire.conf, pipewire properly adjusts both its internal mix as well as the DAC sampling rate to whatever the decode provides. Now, both MIX and my DAC run at S32LE (signed 32 bit little endian, as I've learned) while DECODE is usually something like S16LE, S24LE or S24_32LE. But, afaik, 16 or 24 bit to 32 bit conversion is lossless, it's simply padding the samples with 0's. If I understand correctly that should also count for the s24_32 to s32 conversion.

I realize this might be nitpicking, but I think the "lossy" classification of decode to mix is incorrect if sampling rates match. I suppose it should still be classified as a modification, but not a lossy one.

One last thing

  • [X] I had a quick look through existing issues and didn't see this one already suggested.

Arouraios avatar May 29 '26 15:05 Arouraios

Okay, attempt number three of writing this comment, as I've found yet another naming scheme. Probably been around four hours of just looking up audio bit depths. My findings are:

Sone uses the GStreamer audio format names. These are a weird mixture between the ALSA codes and the PulseAudio names.

ALSA PulseAudio GStreamer description
SND_PCM_FORMAT_S24 s24(ne) S24 24bit native endian
SND_PCM_FORMAT_S24_LE s24-32le S24_32LE 24bit padded into 32bit words
SND_PCM_FORMAT_S24_3LE s24le S24LE actual 24bit (3 byte)

After taking a look at #81 and #90 it seems prudent to clarify nomenclature, because it's way too easy to mix these three naming schemes up if you don't have the time to look up the differences.

I'd suggest either a wiki entry, or (/and) a small note wherever relevant, namely the decoding pipeline screen. Just a short paragraph clarifying the difference between S24, S24_32 and S32, and warning that ALSA uses a different naming scheme might go a long way to prevent confusion.

PS: my (unmodified) /usr/share/pipewire/client.conf contains alsa.format = [ FLOAT S32 S24 S24_3 S16 U8 ] which is a fun (not) inconsistency because ALSA knows no native endian S24_3 (see link above) while PW would otherwise use s24(ne).

Arouraios avatar May 29 '26 17:05 Arouraios

hey @Arouraios thanks for all the detailed info. Appreciate it. This should be fixed on v0.19.0 Feel free to reopen the issue or create a new one if you encounter something

lullabyX avatar Jun 07 '26 12:06 lullabyX