The No.1 Website for Pro Audio
Technique behind any digital volume control
Old 1 week ago
  #1
Gear Maniac
 
darkalex's Avatar
 
Verified Member
Technique behind any digital volume control

What’s the principle of working behind any digital volume control knob, the simple ones found on mobile phones, laptops, Spotify etc.

I am wondering about the bit depth of the file we’re playing through these systems

Whenever we change the gain of a digital signal by even the slightest amount, the bit depth expands to infinity, which we tackle by using a dither.

Now that we’re going all over the place, be it with streaming normalisation, volume control from the phone etc, I wonder what happens to the signal there

Are these devices applying a dither on the output, like a standard 2bit dither running throughout irrespective of levels or is it simply truncation because the DAC’s are not floating point.. which causes distortion and reduced fidelity

I’m confused. I did read some previous threads but could not understand much from there, Can anyone throw some light on this?

Thanks!
Old 6 days ago
  #2
Gear Maniac
 
darkalex's Avatar
 
Verified Member
Bump!
Old 6 days ago
  #3
Gear Maniac
 
I would think that the implementation of dither, which bit depth the volume control calculates at and other factors will vary with each software. I think I saw a video once about whether to make MP3s from 32 bit float, 24 fixed or 16 bit fixed. It depended on the playback software or browser. Encoding from a dithered 16 bit was best for most compatibility. Not sure if that's still true. In my opinion though every digital volume control should add dither before converting back to fixed. My fear is most don't. Someone else may have software specific info on this though.
Old 6 days ago
  #4
Lives for gear
 
loujudson's Avatar
 
2 Reviews written
🎧 10 years
I'd love to hear Bob Ohlsson's take on this...
Old 5 days ago | Show parent
  #5
Lives for gear
 
loujudson's Avatar
 
2 Reviews written
🎧 10 years
Quote:
Originally Posted by dinococcus ➡️
Google!
Right, you're sure to get truth and lies that way!
Old 5 days ago
  #6
Motown legend
 
Bob Olhsson's Avatar
 
Verified Member
🎧 15 years
It's really a train wreck of varying situations. This is why dithering every single time we change bit depth is critical because truncation distortion accumulates and at some point, becomes audible. It's also a good idea to add 16 bit dither to audio intended for streaming.
Old 5 days ago | Show parent
  #7
Lives for gear
 
🎧 5 years
Quote:
Originally Posted by loujudson ➡️
Right, you're sure to get truth and lies that way!
I deleted my post if you were honest...
Old 5 days ago
  #9
Lives for gear
 
FabienTDR's Avatar
 
Verified Member
🎧 5 years
Quote:
Originally Posted by darkalex ➡️
I am wondering about the bit depth of the file we’re playing through these systems

Whenever we change the gain of a digital signal by even the slightest amount, the bit depth expands to infinity, which we tackle by using a dither.
Do you? I don't think so. Your compressor, sat or filter, does it dither before makeup? Of course not, it can't even know how much it would have to add before programme ends, it would probably reduce the SNR like crazy within just minutes.

The reality is that most developers will avoid integer math like the plague (i.e. only use it if there's no other choice), and use float (32bit float), more likely even double (64bit float) instead.

In this context, it simply doesn't matter. 32bit float or 64bit float is already crazy oversized, and tends to self dither sufficiently well. Every processor, even the smallest, can easily handle these numbers today. All you need is a proper interface from float to the hardware's integer. This is exactly what audio drivers are meant to cover: feed the hardware appropriately. Surprisingly, many do not dither (e.g. RME), but obviously for good reasons: It's just irrelevant. If the hardware's noise floor is greater than 2lsb, which is practically always the case (in fact done intentionally, by design). It simply doesn't matter, the DA's own errors will sufficiently dither the signal.


Truncation artefacts generally don't use to stack up very much. It's not intuitive. But integer truncation is basically a low level / zero crossing clipper. Everything below a certain level gets shaved of. Once truncated, the next truncation has less or probably nothing to truncate.

Like clipping, given there's no excessive processing in between, it cannot accumulate. If you clipped -2dB already, another -1dB clipping will have no effect. If you already clipped -1dB, and do another run at -2dB, you get exactly the same results as if you clipped directly to -2dB. This is because the "shave off" is perfect - leaving nothing behind that could accumulate into the next stage.

Last edited by FabienTDR; 5 days ago at 11:00 PM..
Old 5 days ago
  #10
Motown legend
 
Bob Olhsson's Avatar
 
Verified Member
🎧 15 years
The problem is that we aren't dealing with a universal floating-point environment such as inside a DAW.
Old 5 days ago
  #11
Gear Maniac
 
I think the reason RME drivers and probably all others don't dither to fixed point is to give people a choice. For me 24 bit dither retains more depth and is a little smoother. But perhaps some people prefer the more crusty sound. Most DAWs don't dither on the master bus either, but still have utility plugins for dithering to 24 bit. So I don't think all the dither plugins allowing dither to 24 bit should be written off and the process described as irrelevant. Is there a way to prove or disprove it's relevance? I always think the argument against dithering to 24 bit is that humans can't hear that low. And certainly not beneath noise. Has this been proved?
Old 5 days ago
  #12
Gear Maniac
 
Also in your analogy, Fabien, you assert that truncating to 24 bit and then to 16 bit is exactly the same as truncating to 16 bit. In fact these two methods only null to -90.4 dB.
Old 5 days ago | Show parent
  #13
Raising Jake Studios
 
Nonlinear's Avatar
 
🎧 5 years
Quote:
Originally Posted by darkalex ➡️
What’s the principle of working behind any digital volume control knob, the simple ones found on mobile phones, laptops, Spotify etc.

I am wondering about the bit depth of the file we’re playing through these systems

Whenever we change the gain of a digital signal by even the slightest amount, the bit depth expands to infinity, which we tackle by using a dither.

Now that we’re going all over the place, be it with streaming normalisation, volume control from the phone etc, I wonder what happens to the signal there

Are these devices applying a dither on the output, like a standard 2bit dither running throughout irrespective of levels or is it simply truncation because the DAC’s are not floating point.. which causes distortion and reduced fidelity

I’m confused. I did read some previous threads but could not understand much from there, Can anyone throw some light on this?

Thanks!
I suspect that nearly every digital audio device in use today uses floating point processing - especially things like cellphones, TVs, portable music players, etc., that process compressed files.

In that case "volume control" is simply a number (typically attenuation/less than 1.0) multiplied with the digital audio data pre-DAC. "Full Volume" is typically full bit scale (0dBFS, +/-1.0).

Volume control can also be applied post-DAC by analog means such as potentiometers, pulse width modulation and stepped attenuators. None of these means affect the digital data only the signal amplitude going to the output amp/headphones/etc.

In any case, the "Volume control" is typically applied BETWEEN the audio file and the device's output - it does not change/affect the audio file itself. It does not require, nor would it benefit from, more dither because as the Volume is turned down the signal is being pushed down toward the noise floor of the audio device itself.

This is not the same thing as changing the bit depth of audio files themselves.
Old 5 days ago
  #14
Gear Maniac
 
Even though the volume is being turned down, it should be dithered back to fixed point. For mastering a track, you add dither after the fade out, not before.
Old 4 days ago
  #15
Motown legend
 
Bob Olhsson's Avatar
 
Verified Member
🎧 15 years
It's an argument between using the proper math and what people think they can get away with. The whole idea of optional dithering is utter nonsense. Dithering is an integral part of engineering design and ought to just be handled but we are surrounded by incompetent, lazy design in this area. Floating point is wonderful but D to A converters have fixed point inputs.

A lot of common drivers in consumer electronics are apparently 16 bit. Lossy encoders are floating point but seem to preserve dither which means a properly dithered 16 bit source is likely to sound better than a floating point source in many consumer streaming signal paths. This is an area that would be well worth studying more.
Old 4 days ago | Show parent
  #16
Lives for gear
 
FabienTDR's Avatar
 
Verified Member
🎧 5 years
Quote:
Originally Posted by TomVY ➡️
Also in your analogy, Fabien, you assert that truncating to 24 bit and then to 16 bit is exactly the same as truncating to 16 bit. In fact these two methods only null to -90.4 dB.
The logic is straight forward. We have an arbitrary number, e.g.

1111 1111 1111 1111 1111 1111 1111 1111

we are removing some least significant bits away. e.g.

1111 1111 1111 1111 1111 1111 1111 1111

and then again:

1111 1111 1111 1111 1111 1111 1111 1111


This is exactly the same as doing it at once. The left side (the significant part) of it isn't affected at all, as you can see. There is no accumulation of anything, the left side is never even touched:

1111 1111 1111 1111 1111 1111 1111 1111

Try repeating this with any other number, or as many as you like. The truncation does not accumulate, as it would have to change the more significant bits - the left side of our number - to have it accumulate any effect on the result.

Put differently, in no event can the truncation of a lsb affect more significant bits (i.e. the left side). It's as logical as it can get.

Your two signals null perfectly within the range of the smallest precision number. This is to be excepted. The last lsb after truncation is always weak/wrong (we dither to transform it into noise). You're ending up with 15bit in both cases, thus something close to -90dB of dynamic range (the lsb will always be random or wrong after truncation). That's fine.

Last edited by FabienTDR; 4 days ago at 05:01 PM..
Old 4 days ago
  #17
Gear Maniac
 
OK, thanks for the explanation. So the lsb is different between the 2 methods of truncation. But then they sound different?
Old 1 day ago
  #18
Gear Maniac
 
I like doing these little tests. So here is a 1kHz sine tone at -96dB. I boosted it 80dB on the master track to see its spectrum in Pro-Q. Before hitting the master channel I tried 3 things. First was just 24 bit truncation. Second version was just 16 bit truncation. 3rd version was 24 bit truncation, followed by 16 bit truncation. They all look completely different. The 24 bit truncation, followed by 16 bit truncation shows lots of distortion. What I don't understand is how it can be argued this is the same. Surely it's not, and will not sound the same.
Attached Thumbnails
Technique behind any digital volume control-24-bit-truncation.png   Technique behind any digital volume control-16-bit-truncation.png   Technique behind any digital volume control-24-bit-16-bit-truncation.png  
Old 1 day ago
  #19
Gear Maniac
 
And this is what a -96dB 1kHz tone sounds like when truncated to 24 bit followed by 16 bit compared with just truncated to 16 bit. How can this be the same? Am I missing something?
Attached Files

24bit+16bit.mp3 (80.6 KB, 169 views)

Just16bit.mp3 (80.6 KB, 167 views)

Old 1 day ago | Show parent
  #20
Lives for gear
 
FabienTDR's Avatar
 
Verified Member
🎧 5 years
Quote:
Originally Posted by TomVY ➡️
I like doing these little tests. So here is a 1kHz sine tone at -96dB. I boosted it 80dB on the master track to see its spectrum in Pro-Q. Before hitting the master channel I tried 3 things. First was just 24 bit truncation. Second version was just 16 bit truncation. 3rd version was 24 bit truncation, followed by 16 bit truncation. They all look completely different. The 24 bit truncation, followed by 16 bit truncation shows lots of distortion. What I don't understand is how it can be argued this is the same. Surely it's not, and will not sound the same.
Here I reduce bit depth twice in this experiment. First to some arbitrary amount I'll modulate manually (to show if accumulation is happening or not), then running into 8bit truncation at the end, to make things really obvious.

Note how the spectrum doesn't change when manipulating the first truncation, as long it stays equal or above the other, lower, truncation (8bit in this case). Even if the first goes down to 8bit, no difference. It's clearly visible: Proper bit depth conversion is not accumulating badly. The opposite is true. Sure, the last lsb "moves" randomly, but that's the case after any proper truncation.





Here's the reaper project you can try on your own.

https://www.tokyodawn.net/labs/public/sine-truncate.zip

Last edited by FabienTDR; 1 day ago at 09:10 PM..
Old 23 hours ago
  #21
Gear Maniac
 
You are using dither though. With dither I realise it won't make any audible difference, since no distortion is created. Here I did it again with -12dB tone, 10 bit truncation (with dither), followed by 2 bit truncation without dither. The point is that digital volume controls might not use dither. Also many people don't dither to 24 bit. If dither is used, then there's no distortion. Also, note that you used gaussian dither, which as you can see doesn't remove all the distortion that triangle does.

EDIT: Sorry, couldn't work out for the moment how to show a gif on here.

https://gifyu.com/image/5jnS
📝 Reply

Similar Threads

Thread / Thread Starter Replies / Views Last Post
replies: 530 views: 73503
Avatar for joe_04_04
joe_04_04 12th August 2015
replies: 465 views: 77128
Avatar for cuzzinlouie
cuzzinlouie 21st March 2021
Topic:
Post Reply

Welcome to the Gearspace Pro Audio Community!

Registration benefits include:
  • The ability to reply to and create new discussions
  • Access to members-only giveaways & competitions
  • Interact with VIP industry experts in our guest Q&As
  • Access to members-only sub forum discussions
  • Access to members-only Chat Room
  • Get INSTANT ACCESS to the world's best private pro audio Classifieds for only USD $20/year
  • Promote your eBay auctions and Reverb.com listings for free
  • Remove this message!
You need an account to post a reply. Create a username and password below and an account will be created and your post entered.


 
 
Slide to join now Processing…

Forum Jump
Forum Jump