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: Benefits of merging volume adjustment and upsampling in one step (Read 4206 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Benefits of merging volume adjustment and upsampling in one step

I hope we can at least agree that a rigorous sound comparision with well-executed implementations of the two approaches would be very informative.

Only recently I've learned from this forum that any contemporary ADCs and DACs do DSP anyway by up-sampling in the digital domain in order improve antalias and reconstruction filters, respectively (cf. http://www.hydrogenaudio.org/forums/index....showtopic=84373).

You may also have a look at "The Scientist and Engineer's Guide to Digital Signal Processing" (http://www.dspguide.com/ch3.htm):

Quote
Second, the future of DSP is to replace hardware with software. For example, the multirate techniques presented later in this chapter reduce the need for antialias and reconstruction filters by fancy software tricks.

Quote
There is a strong trend in electronics to replace analog circuitry with digital algorithms.

There you may also find a statement regarding the precision of analog components compared to software components:

Quote
Multirate data conversion is valuable for two reasons: (1) it replaces analog components with software, a clear economic advantage in massproduced products, and (2) it can achieve higher levels of performance in critical applications. For example, compact disc audio systems use techniques of this type to achieve the best possible sound quality. This increased performance is a result of replacing analog components (1% precision), with digital algorithms (0.0001% precision from round-off error). As discussed in upcoming chapters, digital filters outperform analog filters by hundreds of times in key areas.

DISCLAIMER: I'm developing playback software with the goal of minimizing round-off erros. Unfortunately
  • I'm forbidden to link you directly because of potential violation of TOS #14, and
  • in this forum it is inappropriate to discuss the results because of potential violation of TOS #8.
Cf. this forum's recycle bin (http://www.hydrogenaudio.org/forums/index.php?showforum=41).

Benefits of merging volume adjustment and upsampling in one step

Reply #1
Only recently I've learned from this forum that any contemporary ADCs and DACs do DSP anyway by up-sampling in the digital domain in order improve antalias and reconstruction filters, respectively (cf. http://www.hydrogenaudio.org/forums/index....showtopic=84373).


I think you might be mixing up two separate topics. The only issue regarding digital vs. analog in the current thread is volume control. You have referenced the unrelated topic of digital filtering, especially relocating a part of the reconstruction filter chain into software, where resources are cheap. This is totally unrelated to Replay Gain.

DISCLAIMER: I'm developing playback software with the goal of minimizing round-off erros. Unfortunately


You might spare your time. Most music players, including Foobar and Winamp, already use 32 bit float volume control components. When this is sent to a DAC this gives you 24 bit of integer precision. I don't know any DAC, which could make use of more than that.

An analog volume control, when done properly, can serve an even larger dynamic range than what's possible with 24 bit in the digital domain alone. A semi digital/analog solution transforms a digital gain value to a resistance of a variable resistor (or more) in the analog output path.

And if you want to help your DAC's reconstruction filter, as described in your referenced thread, just plug a high quality sample rate conversion plugin into the output chain. Both Foobar and Winamp, and many others, support this already.

Benefits of merging volume adjustment and upsampling in one step

Reply #2
I think you might be mixing up two separate topics. The only issue regarding digital vs. analog in the current thread is volume control. You have referenced the unrelated topic of digital filtering, especially relocating a part of the reconstruction filter chain into software, where resources are cheap. This is totally unrelated to Replay Gain.

Volume control may be seen as digital filter with a trivial kernel. I can't see why a filter with a trivial kernel (i.e. just one multiplication) should be more worse then a filter withe a more complex kernel (i.e. the DAC's reconstruction filter). Moreover, I expect the combination of the (trivial) RG filter and the reconstruction filter will simply give the reconstruction filter with modified coefficients.

My argument is that contemporary DACs do DSP anyway (complex reconstruction filter) and I can't see any reason for putting the (trivial) RG filter into the analog domain.

You might spare your time.

I don't think that I'm wasting my time. Unfortunately this forum is not the place to discuss the full range of arguments. For details see my disclaimer above.

Most music players, including Foobar and Winamp, already use 32 bit float volume control components. When this is sent to a DAC this gives you 24 bit of integer precision. I don't know any DAC, which could make use of more than that.

And if you want to help your DAC's reconstruction filter, as described in your referenced thread, just plug a high quality sample rate conversion plugin into the output chain. Both Foobar and Winamp, and many others, support this already.

In theory up-sampling and RG (and any other DSP) is commutative (see above). In practice it is not. Put into other words, up-sampling in front of RG (and other DSP) using full bit-depth (32 or 64) all the time is preferable because random errors may better cancel out among more available samples.

An analog volume control, when done properly, can serve an even larger dynamic range than what's possible with 24 bit in the digital domain alone. A semi digital/analog solution transforms a digital gain value to a resistance of a variable resistor (or more) in the analog output path.

A very interesting statement in this forum's context.

Benefits of merging volume adjustment and upsampling in one step

Reply #3
Volume control may be seen as digital filter with a trivial kernel. I can't see why a filter with a trivial kernel (i.e. just one multiplication) should be more worse then a filter withe a more complex kernel (i.e. the DAC's reconstruction filter).


It doesn't have any artifacts besides quantization noise, e. g. ringing, phase modulation, etc. which is not true for any other digital or analog filter. Wether you have n total steps or n + one floating point volume adjustment is irrelevant. The difference is so far below the noise floor of any real world DAC, even caring about this is a waste of time. At least as long as we are talking about the added quantization error of one or a few adjustments (probably 1000s) within the floating point domain.

DACs usually only take integer samples. Here any volume adjustment costs one bit or more. At 24 bit this shouldn't be a problem in practice, but you can certainly build analog controls with a higher SNR for low volume signals than digitally possible.

Moreover, I expect the combination of the (trivial) RG filter and the reconstruction filter will simply give the reconstruction filter with modified coefficients.

My argument is that contemporary DACs do DSP anyway (complex reconstruction filter) and I can't see any reason for putting the (trivial) RG filter into the analog domain.


Just imagine an attenuation large enough so that all MSBs except for the LSB are zeroed. Amplify the resulting signal, there won't be much left. Do the same with resistors, thermal noise at room temperature is about -164 dB for 30 kHz bandwidth, and you will find much more is left. That's why people speculating about applying RG gain in the analog domain have a point, while you don't. There is no benefit of digital attenuation (besides costs).

In practice both approaches won't differ at all. At the intended SPL of Replay Gain playback the artifacts of both approaches will be below any threshold of perception.

This really doesn't belong into this else excellently focused thread. Maybe it could be split as "Benefits of merging volume adjustment and upsampling in one step".

Benefits of merging volume adjustment and upsampling in one step

Reply #4
In practice both approaches won't differ at all.

That's exactly my point, short and precisely summarized. Why bother?

This really doesn't belong into this else excellently focused thread. Maybe it could be split as "Benefits of merging volume adjustment and upsampling in one step".

I agree.

Benefits of merging volume adjustment and upsampling in one step

Reply #5
DACs usually only take integer samples. Here any volume adjustment costs one bit or more. At 24 bit this shouldn't be a problem in practice, but you can certainly build analog controls with a higher SNR for low volume signals than digitally possible.


I don't think that is true in general.  At least not in actual commercial audio practice.

In the digital domain, it is possible to simply add bits or use floating point and have SNRs that are completely unrealizable in the analog world.  Plain old 32 bit floating point sets a bar that is completely unrealizable in the analog domain.

My recollection of the widest SNR analog audio production tool that I ever tested is that its noise floor was about 96 dB below 0 dB, and there was about 22 dB of headroom before it clipped. That's 118 dB dynamic range which has been eclipsed by some modern converters.

I also note that a new generation of buffer amplifier chips were announced more-or-less concurrently with the introduction of the last new generation of  high performance converters.  It appears to me that they needed the new buffers to prove the performance of the new converters.

If we just had transducers that would effectively avoid messing with analog signals in the electrical domain, we could dispense with this converter-limited stage of our lives!  But as things stand, converters are among the most highly perfected of all audio components.

We already are looking at a generation of audio components that net out to be basically computer(s) with converters, displays, and controls ringing them in a  very thin layer. This ranges from portable digital players like the Clip+ to any number of common home and studio components such as mixing consoles, and A/V receivers.  Even AM & FM radio reception are now commonly handled almost completely in the digital domain.

Benefits of merging volume adjustment and upsampling in one step

Reply #6
In the digital domain, it is possible to simply add bits or use floating point and have SNRs that are completely unrealizable in the analog world.  Plain old 32 bit floating point sets a bar that is completely unrealizable in the analog domain.


I haven't said anything which would contradict that. I can program a digital system with 1000 dB SNR, if you need that. But tell me a DAC (in commercial practice) that consumes anything higher than 24 bit integer and can actually make use of the additional bits.

Benefits of merging volume adjustment and upsampling in one step

Reply #7
pbelkner, while TOS8 forbids talking about audible differences without blind test data, there is no prohibition against discussing objective improvements (albeit they may be inaudible).

In theory up-sampling and RG (and any other DSP) is commutative (see above). In practice it is not. Put into other words, up-sampling in front of RG (and other DSP) using full bit-depth (32 or 64) all the time is preferable because random errors may better cancel out among more available samples.
Kind of.

Running the whole lot at "full bit-depth" is preferable to applying ReplayGain at 16-bits, and then converting to 24-bits for upsampling - but that's kind of "straw man argument" territory - fb2k will do RG at 24-bits with a 16-bit source and 24-bit capable sound card, and has done it this way for years.

It's also true that, for a given bitdepth (16, 24, whatever), a higher sample rate yields a lower quantisation noise floor within a specific range of frequencies (e.g. the 20kHz audible band).


However, you have hit the dreaded "a little knowledge is a dangerous thing" stage IMO.

Trying to integrate the ReplayGain scale factor / gain change into the DAC reconstruction filter coefficients is a bad idea. Depending on the choice of filter (e.g. especially IIR filters), the quantisation of the filter coefficients can be critical. If you're going to take the existing coefficients, scale them by the RG value, and (of course) re-quantise the coefficients to use them in the existing filter topology, the result could be worse than scaling the audio then filtering it with the original coefficients - and with an IIR filter the result could be unpredictable, or even unstable. With an FIR filter, it's not going to be unstable, and I don't think it's unpredictable, but it could quite easily be worse.

Processing it all in separate stages at 24-bits is objectively good enough no matter which way you look at it. You can use 32-bit floats and not even bother to get the levels correct at each stage if you want to be careless.


An analog volume control, when done properly, can serve an even larger dynamic range than what's possible with 24 bit in the digital domain alone. A semi digital/analog solution transforms a digital gain value to a resistance of a variable resistor (or more) in the analog output path.
I think you might need to split the analogue gain adjustment into several stages to make that statement true these days - and it might not be that useful for audio, or completely linear over the whole gain adjustment range. It might end up looking rather "digital" if you have a series of switch-able analogue gain stages which simply halve the gain (=binary!).

Cheers,
David.

Benefits of merging volume adjustment and upsampling in one step

Reply #8
Trying to integrate the ReplayGain scale factor / gain change into the DAC reconstruction filter coefficients is a bad idea.

This was not meant literally. It was just to challenge the claim that putting RG into the analog domain would have any advantage.

Depending on the choice of filter (e.g. especially IIR filters), the quantisation of the filter coefficients can be critical.

I was assuming a FIR. If I'm not mistaken only rescaled coefficients will do the job.

It was just in order to illustrate my argument that I can't see any advantage in putting RG into the analog domain because RG + re-sampling (as done in the DAC anyway) is (except of rescaled coefficients) equivalent to re-sampling.

a higher sample rate yields a lower quantisation noise floor within a specific range of frequencies (e.g. the 20kHz audible band).

Not only lower quantization noise but also an according higher Nyquist frequency. This should help to implement other RG related filters as e.g. a limiter or a compressor for clipping prevention (I expect a limiter or compressor to be low-pass filtered according to Nyquist frequency).

Benefits of merging volume adjustment and upsampling in one step

Reply #9
I think you might need to split the analogue gain adjustment into several stages to make that statement true these days - and it might not be that useful for audio, or completely linear over the whole gain adjustment range. It might end up looking rather "digital" if you have a series of switch-able analogue gain stages which simply halve the gain (=binary!).


It's all a question of effort. At no point I have advocated any practical usefulness. I'm totally satisfied with the digital volume control of the Windows mixer. I just had the impression that pbelkner, in addition to the claim that analog controls have no practical benefit, claimed a theoretical superiority of digital volume control. An analog volume control of sufficient effort is only limited by the physical bounds of thermal noise. A digital control is limited by the DAC it feeds into, which is necessarily inferior.

Benefits of merging volume adjustment and upsampling in one step

Reply #10
In the digital domain, it is possible to simply add bits or use floating point and have SNRs that are completely unrealizable in the analog world.  Plain old 32 bit floating point sets a bar that is completely unrealizable in the analog domain.


I haven't said anything which would contradict that. I can program a digital system with 1000 dB SNR, if you need that. But tell me a DAC (in commercial practice) that consumes anything higher than 24 bit integer and can actually make use of the additional bits.


That is not a problem as long as analog equipment doesn't perform any better.  As I said before, IME analog equipment usually tops out with less than 120 dB dynamic range. Many kinds of analog equipment perform far worse than that.

 

Benefits of merging volume adjustment and upsampling in one step

Reply #11
An analog volume control of sufficient effort is only limited by the physical bounds of thermal noise. A digital control is limited by the DAC it feeds into, which is necessarily inferior.


Where is it written on stone that DACs and ADCs must perform more poorly than all analog equipment?

It isn't.

While very simple analog circuits such as a single stage buffer with low gain and operating at  relatively high signal voltages may be tough to beat, just about all useful analog equipment is far more complex than that, and performs considerably more poorly.  This is particularly true of consumer audio gear, where the signal levels are quite a bit lower than good audio production gear. 


I was reminded of this while thinking about the performance of the Sansa Clip. Compared to a good CD player it can come up a few dB short. but  that is a false comparison. The Clip compares with a CD player driving a stereo receiver, and the receiver generally adds quite a bit of noise of its own.