How does a digital volume control work?
Nov 6, 2002 at 10:39 PM Thread Starter Post #1 of 15

andrzejpw

May one day invent Bose-cancelling headphones.
Joined
Jun 25, 2001
Posts
6,636
Likes
10
Forgive my newbish question. The only way I can figure it out is that the signal runs through an AD converter, is changed, then goes through a DAC. I'm pretty sure that's wrong. If not, doesn't that have an affect on sound quality?
 
Nov 7, 2002 at 6:27 AM Post #2 of 15
The A/D converter is generally not used for volume control, it serves only to convert the digital signal to analogue that humans can understand. For digitally controlling the volume, the common method is to use a weighted resistor ladder (after the ADC and pre-amp, if any) and selectively switching in (or out) the resistors by the use of electronic switches, depending on whether the volume is being increased or decreased. The resistor values are so chosen that every increment (or decrement) is done in 1db steps, so that the person hearing the music will feel the same kind of volume variation as with an analogue volume control.
 
Nov 7, 2002 at 8:12 PM Post #3 of 15
There are two methods I can think off the top of my head. This is my take on how they work.

One- use a digital potentiometer, it's digital in the sense that it varies it's resistance according to pulses generated by button presses or data sent my a microcontroller. These signals change the pots internal registers which intern causes its resitance to change in steps corresponding to the number of pulses received or the value of the data sent to it by a microcontroller.

Two- use a digital attentuator circuit when working with digital signals. These are often built into digital to analog converter ICs (especially cheaper ones) as well as digital filter ICs. They also rely on a microcontroller for their register settings. What I believe happens is that attenuation is achieved by truncating the bits one by one, thereby decreasing the volume output. Perhaps someone can reinforce/dispute this claim.

Hope this helps,

Stu
 
Nov 8, 2002 at 1:07 AM Post #4 of 15
Quote:

What I believe happens is that attenuation is achieved by truncating the bits one by one, thereby decreasing the volume output. Perhaps someone can reinforce/dispute this claim.


*Budda-budda-budda* .... *eeeeeoooooooooooooBOOOOM*

One hypothesis shot down in flames, because it's not practical and even if it were the math doesn't work anyway.

The lingua franca of digital audio is linear PCM. It's used for CD audio, WAV, some DVDs, and I'd bet that most compressed audio decoder chips use it as the output format. Since LPCM has a linear relationship between the sample value and output amplitude, and a bit shift on a positive integer is equivalent to division by 2, shifting all samples to the right by one bit is a -6dB drop. That's too coarse to be helpful.

The real problem is negative numbers, used for the "bottom half" of the waveform: in two's complement arithmetic, (which LPCM uses), a bit shift on a negative number makes it a positive number. Worse, a small negative number will become a large positive number and vice versa. Basically you'd trash the data if you did a simple bit-shift.

You could fix this by taking the absolute value of negative samples before shifting them and then negating them afterwards. Or, there may be other arithmetic types where a bit shift is equal to division by 2 for positive and negative numbers. Either way you still havel the -6dB per step weakness.
 
Nov 8, 2002 at 1:35 AM Post #5 of 15
ugh
eek.gif


Do you guys know the supermini v3? The author says he has a digital volume control. How does this work?
 
Nov 8, 2002 at 2:40 AM Post #6 of 15
Fixup uses a Dallas/Maxim DS1802 in his new design. If I read the datasheet correctly, the resistive element is 64 or so separate resistors in series. The control unit drives a 1:64 muxer which routes the input signal to the point between one of these resistors. This action is analogous to the movement of a wiper in a mechanical pot. To change the volume level, it accepts either pulses (as from a momentary pushbutton) or 3-wire serial control, which affect how the muxer routes the signal to the resistor array.
 
Nov 8, 2002 at 3:36 AM Post #8 of 15
AH, ok. So with that volume control, the sound isn't really changed digitally? Meaning, pressing the button to increase volume would be the same as rotating a pot?
 
Nov 8, 2002 at 5:13 AM Post #9 of 15
Ref. my earlier post, a digital volume control in it's simplest form can be made as a resistive divider with the o/p taken from the lowest resistor and selectively switching every other resistor to the i/p with an analogue electronic switch (these are TTL controlled). Each TTL pin of the switch can be connected to the o/p pins of a n-bit up/down ring counter (n = no. of volume levels). The ring counter's clock pin and up/down mode pin are connected to two double-pole push button switches. The counter starts counting when either switch is pressed and the up/down mode is determined by which switch is pressed...
 
Nov 8, 2002 at 5:31 AM Post #10 of 15
rohitbd's got it: a momentary button press changes the volume up or down by 1 dB each time.

The DS1802 allows for much more complex interactions than this, but I imagine Fixup will be using it in the simplest mode possible. For example, you can change the volume on each channel independently if you like, you can control the volume through a serial port, and you can read back the current volume position. The latter features are useful in microcontroller-based applications.
 
Nov 8, 2002 at 6:51 AM Post #11 of 15
Quote:

Originally posted by andrzejpw
AH, ok. So with that volume control, the sound isn't really changed digitally? Meaning, pressing the button to increase volume would be the same as rotating a pot?


It's more similar to turning a series stepped attuenator.. At least that's what I make of it..
 
Nov 8, 2002 at 7:21 PM Post #14 of 15
Quote:

The sound is never varied digitally as far as the actual signal goes


If you use a digital attenuation circuit (see my post above) the signal is modified digitally. The actual digital signal seen by the DAC will be different from the original one.

Also, it's not just push buttons that are used to control digital volume devices. There are also devices called encoders that have shafts tied to a series of switches that generate pulses as the shaft is turned. This is what I plan to use in my version of the PDAC once I get all the parts.

Stu
 
Nov 9, 2002 at 4:44 AM Post #15 of 15
maczrool, the digital volume I'm talking about is in it's simplest form...of course other methods are there, but varying the volume in the digital stage itself can make the overall system a bit more complex...but it can a lot more precise as compared to analogue, though....I guess which method to use depends upon each individual's expertise...
 

Users who are viewing this thread

Back
Top