Hello all,

I've been scratching my head over this for a few hours, looking
through forums, docs, and finally the alsa-lib git repository's C code
to try to find the answer to my question, but, alas, I feel that I may
need to ask for your help.

Will any sample rate conversions occur with this .asoundrc config?

pcm_slave.force_24_bit_no_rate_convert {
        pcm "hw:0,0"
        format S24_3LE # Or other 24-bit format
        rate "unchanged" # Necessary?
}

pcm.my_new_default {
        type plug
        slave force_24_bit_no_rate_convert
}

(apologies if formatting got garbled)

Specifically, does sample rate conversion still occur anywhere in the
signal chain even though I provided the "unchanged" string for rate?

I would like to create a configuration to force digital audio output
from my PC (Arch Linux - ALSA only, no Pulseaudio) to remain at or be
converted to 24-bit format without any sample rate conversion. I
understand that the word, "lossless," in the title may be a bit of a
misnomer, since quantization noise from quantization errors during bit
depth conversion will raise the noise floor of the signal by a small
(and probably inaudible) amount, but my primary concern is avoiding
any sample rate conversions in the entirety of the signal path. And to
be clear, here, I only ever use one sound source on my PC at a time,
so I will never mix any sound sources together. Currently, my setup
involves exclusive hardware access any time I want to use my sound
card (external USB DAC), resulting in no format or rate conversion at
all (i.e. a "bit-perfect" signal). My rationale for desiring format
conversion - and only format conversion - is at the bottom of this
email.

The only thing I can find online is people wanting to either reduce
their bit depth or change their sampling rate; I haven't been able to
find a post/thread describing my situation. And the most I could
gather from the docs was that ALSA handles conversion "automagically",
but I couldn't get more details past that. Finally, looking at the
code and trying to grep directory trees recursively for the string,
"unchanged", to see if I can get any leads, I got lost in the behemoth
of a code base (which is not a bad thing! I'm just trying to convey a
sense of being overwhelmed).

Rationale:
Many of the world's most well-known label's mastering engineers aim to
produce a final product with the sample peaks not above 0dB in order
to attempt to avoid clipping. In theory (particularly, according to
the Nyquist theorem), the original bandwidth-limited analogue signal
can be perfectly and losslessly reconstructed from this digital signal
(assuming negligible quantization noise). However, the "true" peaks in
the original analogue signal between samples may actually be above 0dB
(which is why, in these cases, if you change the sample rate, you will
very likely - and in the case of upsampling, are guaranteed to - clip
the signal). Nevertheless, with a well-designed DAC that has
sufficient headroom above 0dB to account for these >0dB intersample
peaks, the original signal can still be perfectly reconstructed. The
only thing is, it seems that the only DACs that have the headroom for
this are extremely expensive $1600+ dedicated DACs. Most DACs would
fail to be able to upsample above 0dB or be able to produce an
analogue signal above 0dB, resulting in clipping of the signal. For a
16-bit, 44.1kHz signal, the worst-case frequency is 11kHz, and,
quoting from a paper on this, "... a low-level burst of noise
splatters across the audio spectrum with the bulk of the energy
concentrated in the higher frequencies. These short transient bursts
occur at every inter-sample over, and they can become audible if the
recording has enough of these overs. These bursts tend to create a
false percussive brightness in the high end." The reason any of this
happened in the first place is probably because of a disconnect
between DAC designers and mastering engineers, as well as the
"loudness wars", pushing most record labels ever closer to 0dB.

Since I don't currently have the budget for one of these $1600+ DACs,
I would like to mitigate the issue through software. The idea goes
like this: Take any signal on my PC (e.g. 16-bit, 44.1 kHz), convert
it to a 24-bit format without sample rate conversion, attenuate the
signal by 3.5-5dB to bring the intersample peaks to or below 0dB
(a.k.a. turn down the volume), and then finally send the signal to the
DAC. It is important to follow these steps in order. The conversion to
24-bit format is to mitigate dynamic range loss when changing the
digital volume.

TL;DR: Want to avoid clipping.

Thanks,
Vincent

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to