Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: ADC: Capturing at 50% of fullscale and gaining up in digital... (Read 2392 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ADC: Capturing at 50% of fullscale and gaining up in digital...

I'm capturing from records at 32bit float in Audacity from a Steinberg UR22 DAC.

As different records are pressed at varying loudness levels, I want to set one input level on the ADC to avoid clipping on the loudest ones.

This means some lower volume LPs hit a peak of about 50% of full scale in Audacity. After capturing I then normalize these to close to 100% of fullscale. I know the general advice is "this should be fine, don't worry about it". Or "your vinyl input is terrible quality to begin with, so it won't matter".

But "format wars" aside, my technical/scientific question is this:
What exactly am I losing when I gain something up by a factor of 2 in digital? (instead of just setting the ADC analog input level higher from the start)
Am I losing one bit of resolution? (Like capturing at 31bit instead of 32bit, because I'm basically not using the MSB when capturing?)
Or is it 6dB of SNR I'm losing? (6dB number coming from the 2x)
Or is it like gaining up the (negligible) quantization noise by a factor 2 along with the signal?

Been wondering this for a while, but could never figure it out with my basic DSP knowledge.

Re: ADC: Capturing at 50% of fullscale and gaining up in digital...

Reply #1
Am I losing one bit of resolution? (Like capturing at 31bit instead of 32bit, because I'm basically not using the MSB when capturing?)
Or is it 6dB of SNR I'm losing? (6dB number coming from the 2x)
Or is it like gaining up the (negligible) quantization noise by a factor 2 along with the signal?
All of the above, except you're counting the bits wrong. Your ADC is 24-bit, so you have up to 23 bits of resolution. I say "up to" because it's very unlikely your ADC has a high enough SNR to actually provide useful data in all 23 of those bits.

(Incidentally, 32-bit floating point also has only 24 bits of resolution, but it has 24 bits no matter how you change the volume.)

Re: ADC: Capturing at 50% of fullscale and gaining up in digital...

Reply #2
Your ADC is actually probably about 18 bit, maybe 20 bit if expensive enough. This is because internal noise fills the lower level bits -- unless you are using liquid helium cooling on the ADC. So, the ADC signal to noise ratio is highest at the highest input level. Recording at a lower level input means your signal is closer to the noise floor. I don't know about today's common professional standards but with analogue equipment the goal was frequently to capture loudest peaks at -20dB.

The ADC is not the only factor. How are you controlling the input level? Preamps generally also have higher noise at higher amplification. The proper way to determine your best practice is to record the same thing with different settings and discover what you like best.

If you are reducing the signal level post ADC, do not!

Re: ADC: Capturing at 50% of fullscale and gaining up in digital...

Reply #3
The formula of 2x amplification to dB is:
https://www.google.com/search?q=20*log10%282%29

It is an infinitely long fractional number, but for 32-bit float and below, you still need a value of 6.0206. Audacity's "Amplify" dialog only allows up to 4 digits of input, so it is not possible to perform an exact 2x scaling, at least for the version of Audacity I use.

It is possible via Nyquist command though. Select the audio track you want to amplify, then click Tools > Nyquist Prompt, enter the following then click OK:
Code: [Select]
return *track* * 2

It will perform an exact 2x scale. In order to prove this you can export the scaled file as 32-bit float, then re-import to Audacity, then use this command:
Code: [Select]
return *track* * .5

This will revert the file by using 0.5x scaling. You can use foo_bitcompare to check if the reverted file is identical to the original file or not. I've attached some files:

[original]: original file
double: double of [original]
half: half of [double]
+6dB: [original] + 6dB
-6dB: [+6dB] - 6dB

original vs half:
Code: [Select]
Comparing:
"E:\download\original.wav"
"E:\download\half.wav"
Compared 240000 samples.
No differences in decoded data found.
Channel peaks: 0.400000 (-7.96 dBTP)

original vs -6dB:
Code: [Select]
Comparing:
"E:\download\original.wav"
"E:\download\-6dB.wav"
Compared 240000 samples.
Differences found: 645 values, 0:00.011625 - 0:04.993813, peak: 0.000000 (-150.51 dBTP) at 0:00.030771, 1ch
Channel difference peaks: 0.000000 (-150.51 dBTP)
File #1 peaks: 0.400000 (-7.96 dBTP)
File #2 peaks: 0.400000 (-7.96 dBTP)
Detected offset as 0 samples.

In digital domain, an exact 2x scaling is lossless. For analog, depends on how your interface performs, it may have higher distortion when the signal is near maximum, or loses SNR when the signal is too weak, these analog noise and distortion will then converted to digital. So if there are measurable or even audible differences, the differences are not necessarily related to digital "resolution" at all.

 

Re: ADC: Capturing at 50% of fullscale and gaining up in digital...

Reply #4
Am I losing one bit of resolution? (Like capturing at 31bit instead of 32bit, because I'm basically not using the MSB when capturing?)
Or is it 6dB of SNR I'm losing? (6dB number coming from the 2x)
Or is it like gaining up the (negligible) quantization noise by a factor 2 along with the signal?

If this was an 8 bit ADC, then yes all of those things.  However at 24 bit (which is what you're probably using), the dynamic range of the ADC will far exceed your source material, so in practice you aren't losing anything.

For a reasonably high quality ADC, it is actually better to do what you're doing, since it ensures that you will never inadvertently clip, even if theres a loud click or other glitch you want to remove in postprocessing.