Home |
Search |
Today's Posts |
#1
|
|||
|
|||
The order of operations: normalize and resample
I need to resample 44.1kHz to 48kHz and normalize. The question is what should
I do first normalization or resampling? Does the order really matter? --Leonid |
#2
|
|||
|
|||
"Leonid Makarovsky" wrote in message
... I need to resample 44.1kHz to 48kHz and normalize. The question is what should I do first normalization or resampling? Does the order really matter? Ripple in the resampling filter can distort so if anything, it's desirable to reduce the level before resampling. I'm not a fan of normalizing because it buys you nothing but lost resolution in all but extreme cases where the D to A is really dirty. The whole concept is a leftover from the 8 bit sampling keyboard era when it could be useful. -- Bob Olhsson Audio Mastery, Nashville TN Mastering, Audio for Picture, Mix Evaluation and Quality Control Over 40 years making people sound better than they ever imagined! 615.385.8051 http://www.hyperback.com |
#3
|
|||
|
|||
"Leonid Makarovsky" wrote in message
... I need to resample 44.1kHz to 48kHz and normalize. The question is what should I do first normalization or resampling? Does the order really matter? Ripple in the resampling filter can distort so if anything, it's desirable to reduce the level before resampling. I'm not a fan of normalizing because it buys you nothing but lost resolution in all but extreme cases where the D to A is really dirty. The whole concept is a leftover from the 8 bit sampling keyboard era when it could be useful. -- Bob Olhsson Audio Mastery, Nashville TN Mastering, Audio for Picture, Mix Evaluation and Quality Control Over 40 years making people sound better than they ever imagined! 615.385.8051 http://www.hyperback.com |
#4
|
|||
|
|||
"Leonid Makarovsky" wrote in message
I need to resample 44.1kHz to 48kHz and normalize. You don't say what level you plan to normalize to. Here's some friendly advice: It is not a good idea to normalize to 0 dB. Instead normalize to a slightly lower level, -1 dB or at most -0.5 dB. The reason is that converters, particularly cheap ones, can lose a lot of linearity in that last dB before full scale. By normalizing to a slightly lower level than FS, you may avoid some nasty bursts of distortion that some equipment makes when it clips at slightly lower levels than you may naively expect. At worst, -1 dB is a barely audible increment lower than FS, but it can sound a lot better if you avoid problems with your listener's playback equipment. The question is what should I do first normalization or resampling? Resampling generally includes digital filtering, and digital filters are among those processing steps that can get dirty in that last dB before full scale. Resampling done poorly can also cause a loss of dynamic range. However, if you start out with reasonable levels, say within 10 dB of FS, the slight dynamic range loss in most resampling steps is a small nit. Does the order really matter? Under reasonable situations, no. Finally, normalizing is itself a potentially problematical process, as described in these references: http://www.cquest.utoronto.ca/psych/psy280f/ch10/ http://www.auditory.org/mhonarc/2004/msg00660.html If you are normalizing to equalize the perceived loudness of tracks on a collection of songs, you may not accomplish your goal. The human perception of loudness is based on a complex, interacting set of parameters. Your best bet may be to simply adjust levels so that you perceive that the loudness of the songs flows in an agreeable way, rather than blindly normalizing and hoping for the best. There are tools that attempt to correct for a number of the well-known psychoacoustic effects that affect our perception of loudness. They are better tools to use for this purpose than normalizing. Here is one such tool: http://homepage.ntlworld.com/jfe1205...GainManual.htm and an easier-to-use front end for it: http://members.home.nl/w.speek/wavegain.htm |
#5
|
|||
|
|||
"Leonid Makarovsky" wrote in message
I need to resample 44.1kHz to 48kHz and normalize. You don't say what level you plan to normalize to. Here's some friendly advice: It is not a good idea to normalize to 0 dB. Instead normalize to a slightly lower level, -1 dB or at most -0.5 dB. The reason is that converters, particularly cheap ones, can lose a lot of linearity in that last dB before full scale. By normalizing to a slightly lower level than FS, you may avoid some nasty bursts of distortion that some equipment makes when it clips at slightly lower levels than you may naively expect. At worst, -1 dB is a barely audible increment lower than FS, but it can sound a lot better if you avoid problems with your listener's playback equipment. The question is what should I do first normalization or resampling? Resampling generally includes digital filtering, and digital filters are among those processing steps that can get dirty in that last dB before full scale. Resampling done poorly can also cause a loss of dynamic range. However, if you start out with reasonable levels, say within 10 dB of FS, the slight dynamic range loss in most resampling steps is a small nit. Does the order really matter? Under reasonable situations, no. Finally, normalizing is itself a potentially problematical process, as described in these references: http://www.cquest.utoronto.ca/psych/psy280f/ch10/ http://www.auditory.org/mhonarc/2004/msg00660.html If you are normalizing to equalize the perceived loudness of tracks on a collection of songs, you may not accomplish your goal. The human perception of loudness is based on a complex, interacting set of parameters. Your best bet may be to simply adjust levels so that you perceive that the loudness of the songs flows in an agreeable way, rather than blindly normalizing and hoping for the best. There are tools that attempt to correct for a number of the well-known psychoacoustic effects that affect our perception of loudness. They are better tools to use for this purpose than normalizing. Here is one such tool: http://homepage.ntlworld.com/jfe1205...GainManual.htm and an easier-to-use front end for it: http://members.home.nl/w.speek/wavegain.htm |
#6
|
|||
|
|||
Arny Krueger wrote:
: I need to resample 44.1kHz to 48kHz and normalize. : You don't say what level you plan to normalize to. Here's some friendly : advice: It is not a good idea to normalize to 0 dB. Instead normalize to a : slightly lower level, -1 dB or at most -0.5 dB. The reason is that : converters, particularly cheap ones, can lose a lot of linearity in that : last dB before full scale. I was going to normalize it to actually 0db. I was going to put 44.1kHz on CD as an audio track and 48kHz to DVD video. (I recorded a footage from a LaserDisc transferring sound digitally at 44.1kHz). : By normalizing to a slightly lower level than FS, you may avoid some nasty : bursts of distortion that some equipment makes when it clips at slightly : lower levels than you may naively expect. At worst, -1 dB is a barely : audible increment lower than FS, but it can sound a lot better if you avoid : problems with your listener's playback equipment. I see. I wish I knew it in the past.... In the past I was normalizing up to 0db using Peak (NOT RMS). : Resampling generally includes digital filtering, and digital filters are : among those processing steps that can get dirty in that last dB before full : scale. Resampling done poorly can also cause a loss of dynamic range. : However, if you start out with reasonable levels, say within 10 dB of FS, : the slight dynamic range loss in most resampling steps is a small nit. I use SSRC tool for resampling. I always use 2 pass filtering. : If you are normalizing to equalize the perceived loudness of tracks on a : collection of songs, you may not accomplish your goal. The human perception : of loudness is based on a complex, interacting set of parameters. Your best : bet may be to simply adjust levels so that you perceive that the loudness of : the songs flows in an agreeable way, rather than blindly normalizing and : hoping for the best. I'll read the articles. I always thought normalization is just increasing the volume to a certain level. Thanks. --Leonid |
#7
|
|||
|
|||
Arny Krueger wrote:
: I need to resample 44.1kHz to 48kHz and normalize. : You don't say what level you plan to normalize to. Here's some friendly : advice: It is not a good idea to normalize to 0 dB. Instead normalize to a : slightly lower level, -1 dB or at most -0.5 dB. The reason is that : converters, particularly cheap ones, can lose a lot of linearity in that : last dB before full scale. I was going to normalize it to actually 0db. I was going to put 44.1kHz on CD as an audio track and 48kHz to DVD video. (I recorded a footage from a LaserDisc transferring sound digitally at 44.1kHz). : By normalizing to a slightly lower level than FS, you may avoid some nasty : bursts of distortion that some equipment makes when it clips at slightly : lower levels than you may naively expect. At worst, -1 dB is a barely : audible increment lower than FS, but it can sound a lot better if you avoid : problems with your listener's playback equipment. I see. I wish I knew it in the past.... In the past I was normalizing up to 0db using Peak (NOT RMS). : Resampling generally includes digital filtering, and digital filters are : among those processing steps that can get dirty in that last dB before full : scale. Resampling done poorly can also cause a loss of dynamic range. : However, if you start out with reasonable levels, say within 10 dB of FS, : the slight dynamic range loss in most resampling steps is a small nit. I use SSRC tool for resampling. I always use 2 pass filtering. : If you are normalizing to equalize the perceived loudness of tracks on a : collection of songs, you may not accomplish your goal. The human perception : of loudness is based on a complex, interacting set of parameters. Your best : bet may be to simply adjust levels so that you perceive that the loudness of : the songs flows in an agreeable way, rather than blindly normalizing and : hoping for the best. I'll read the articles. I always thought normalization is just increasing the volume to a certain level. Thanks. --Leonid |
#8
|
|||
|
|||
Leonid Makarovsky wrote:
I'll read the articles. I always thought normalization is just increasing the volume to a certain level. That's exactly what it is. But you can increase the _perceived_ level beyond what maximum (0dBFS or -1 dBFS or whatever) normalization sounds like by using compression to increase the average power while keeping the peak (what normalization adjusts) the same. |
#9
|
|||
|
|||
Leonid Makarovsky wrote:
I'll read the articles. I always thought normalization is just increasing the volume to a certain level. That's exactly what it is. But you can increase the _perceived_ level beyond what maximum (0dBFS or -1 dBFS or whatever) normalization sounds like by using compression to increase the average power while keeping the peak (what normalization adjusts) the same. |
#10
|
|||
|
|||
S O'Neill wrote:
: That's exactly what it is. But you can increase the _perceived_ level : beyond what maximum (0dBFS or -1 dBFS or whatever) normalization sounds : like by using compression to increase the average power while keeping : the peak (what normalization adjusts) the same. Ok suppose I just normalize up to 0db using peak leavel. Say my maximum peak was -6db and I normalized the whole thing from 6db to 0db. Wouldn't it have the same effect as if I did not normalize, but turned the volume handle of my amplifier 6db up? --Leonid |
#11
|
|||
|
|||
S O'Neill wrote:
: That's exactly what it is. But you can increase the _perceived_ level : beyond what maximum (0dBFS or -1 dBFS or whatever) normalization sounds : like by using compression to increase the average power while keeping : the peak (what normalization adjusts) the same. Ok suppose I just normalize up to 0db using peak leavel. Say my maximum peak was -6db and I normalized the whole thing from 6db to 0db. Wouldn't it have the same effect as if I did not normalize, but turned the volume handle of my amplifier 6db up? --Leonid |
#12
|
|||
|
|||
Leonid Makarovsky wrote:
S O'Neill wrote: : That's exactly what it is. But you can increase the _perceived_ level : beyond what maximum (0dBFS or -1 dBFS or whatever) normalization sounds : like by using compression to increase the average power while keeping : the peak (what normalization adjusts) the same. Ok suppose I just normalize up to 0db using peak leavel. Say my maximum peak was -6db and I normalized the whole thing from 6db to 0db. Wouldn't it have the same effect as if I did not normalize, but turned the volume handle of my amplifier 6db up? Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. But for any other level changes that are NOT powers of two, there will be some rounding error introduced with the multiplication, and that is what folks are trying to avoid. --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |
#13
|
|||
|
|||
Leonid Makarovsky wrote:
S O'Neill wrote: : That's exactly what it is. But you can increase the _perceived_ level : beyond what maximum (0dBFS or -1 dBFS or whatever) normalization sounds : like by using compression to increase the average power while keeping : the peak (what normalization adjusts) the same. Ok suppose I just normalize up to 0db using peak leavel. Say my maximum peak was -6db and I normalized the whole thing from 6db to 0db. Wouldn't it have the same effect as if I did not normalize, but turned the volume handle of my amplifier 6db up? Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. But for any other level changes that are NOT powers of two, there will be some rounding error introduced with the multiplication, and that is what folks are trying to avoid. --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |
#14
|
|||
|
|||
"Scott Dorsey" wrote in message
Leonid Makarovsky wrote: S O'Neill wrote: That's exactly what it is. But you can increase the _perceived_ level beyond what maximum (0dBFS or -1 dBFS or whatever) normalization sounds like by using compression to increase the average power while keeping the peak (what normalization adjusts) the same. Ok suppose I just normalize up to 0db using peak leavel. Say my maximum peak was -6db and I normalized the whole thing from 6db to 0db. Wouldn't it have the same effect as if I did not normalize, but turned the volume handle of my amplifier 6db up? Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. But for any other level changes that are NOT powers of two, there will be some rounding error introduced with the multiplication, and that is what folks are trying to avoid. I know not why someone would avoid having a properly-dithered waveform. |
#15
|
|||
|
|||
"Scott Dorsey" wrote in message
Leonid Makarovsky wrote: S O'Neill wrote: That's exactly what it is. But you can increase the _perceived_ level beyond what maximum (0dBFS or -1 dBFS or whatever) normalization sounds like by using compression to increase the average power while keeping the peak (what normalization adjusts) the same. Ok suppose I just normalize up to 0db using peak leavel. Say my maximum peak was -6db and I normalized the whole thing from 6db to 0db. Wouldn't it have the same effect as if I did not normalize, but turned the volume handle of my amplifier 6db up? Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. But for any other level changes that are NOT powers of two, there will be some rounding error introduced with the multiplication, and that is what folks are trying to avoid. I know not why someone would avoid having a properly-dithered waveform. |
#16
|
|||
|
|||
On Tue, 16 Nov 2004 15:10:53 -0500, "Arny Krueger"
wrote: Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. Is this literally true? Chris Hornbeck |
#17
|
|||
|
|||
On Tue, 16 Nov 2004 15:10:53 -0500, "Arny Krueger"
wrote: Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. Is this literally true? Chris Hornbeck |
#18
|
|||
|
|||
|
#19
|
|||
|
|||
|
#20
|
|||
|
|||
"Chris Hornbeck" wrote in message
On Tue, 16 Nov 2004 15:10:53 -0500, "Arny Krueger" wrote: Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. Is this literally true? Sure, the quantization error doubles. |
#21
|
|||
|
|||
"Chris Hornbeck" wrote in message
On Tue, 16 Nov 2004 15:10:53 -0500, "Arny Krueger" wrote: Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. Is this literally true? Sure, the quantization error doubles. |
#22
|
|||
|
|||
Arny Krueger wrote:
"Chris Hornbeck" wrote in message On Tue, 16 Nov 2004 15:10:53 -0500, "Arny Krueger" wrote: Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. Is this literally true? Sure, the quantization error doubles. Before this goes too far, a 6 dB increase would actually be a *left* shift; a new zero appears on the right (lsb). It may be advantageous to dither that; ie, sometimes shift in a 1 instead. |
#23
|
|||
|
|||
Arny Krueger wrote:
"Chris Hornbeck" wrote in message On Tue, 16 Nov 2004 15:10:53 -0500, "Arny Krueger" wrote: Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. Is this literally true? Sure, the quantization error doubles. Before this goes too far, a 6 dB increase would actually be a *left* shift; a new zero appears on the right (lsb). It may be advantageous to dither that; ie, sometimes shift in a 1 instead. |
#24
|
|||
|
|||
"S O'Neill" wrote in message
news Arny Krueger wrote: "Chris Hornbeck" wrote in message On Tue, 16 Nov 2004 15:10:53 -0500, "Arny Krueger" wrote: Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. Is this literally true? Sure, the quantization error doubles. Before this goes too far, a 6 dB increase would actually be a *left* shift; a new zero appears on the right (lsb). I guess I read what he meant, not what he wrote. It may be advantageous to dither that; ie, sometimes shift in a 1 instead. Exactly. The problem is that the binary represenation of an analog voltage is rarely exact. There is almost always quantization error. When you double the data by means of simple shifting, you also double the quantization error. |
#25
|
|||
|
|||
"S O'Neill" wrote in message
news Arny Krueger wrote: "Chris Hornbeck" wrote in message On Tue, 16 Nov 2004 15:10:53 -0500, "Arny Krueger" wrote: Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Trouble is, with a pure right shift there is also a loss of dithering of the LSB. Is this literally true? Sure, the quantization error doubles. Before this goes too far, a 6 dB increase would actually be a *left* shift; a new zero appears on the right (lsb). I guess I read what he meant, not what he wrote. It may be advantageous to dither that; ie, sometimes shift in a 1 instead. Exactly. The problem is that the binary represenation of an analog voltage is rarely exact. There is almost always quantization error. When you double the data by means of simple shifting, you also double the quantization error. |
#26
|
|||
|
|||
Scott Dorsey wrote:
: But for any other level changes that are NOT powers of two, there will be : some rounding error introduced with the multiplication, and that is what folks : are trying to avoid. Is 6 powers of 2? Did you mean the odd numbers would introduce rounding error? Say if I went from -5db to 0db, I would've had a problem? Well, I guess I was going from any negative # to 0db. I wish I knew better. --Leonid |
#27
|
|||
|
|||
Scott Dorsey wrote:
: But for any other level changes that are NOT powers of two, there will be : some rounding error introduced with the multiplication, and that is what folks : are trying to avoid. Is 6 powers of 2? Did you mean the odd numbers would introduce rounding error? Say if I went from -5db to 0db, I would've had a problem? Well, I guess I was going from any negative # to 0db. I wish I knew better. --Leonid |
#28
|
|||
|
|||
Leonid Makarovsky wrote:
Scott Dorsey wrote: : But for any other level changes that are NOT powers of two, there will be : some rounding error introduced with the multiplication, and that is what folks : are trying to avoid. Is 6 powers of 2? Did you mean the odd numbers would introduce rounding error? Say if I went from -5db to 0db, I would've had a problem? Well, I guess I was going from any negative # to 0db. I wish I knew better. No, he's translating 6 dB into "double the voltage", the same way that 12 dB is four times the voltage (two bits). |
#29
|
|||
|
|||
Leonid Makarovsky wrote:
Scott Dorsey wrote: : But for any other level changes that are NOT powers of two, there will be : some rounding error introduced with the multiplication, and that is what folks : are trying to avoid. Is 6 powers of 2? Did you mean the odd numbers would introduce rounding error? Say if I went from -5db to 0db, I would've had a problem? Well, I guess I was going from any negative # to 0db. I wish I knew better. No, he's translating 6 dB into "double the voltage", the same way that 12 dB is four times the voltage (two bits). |
#30
|
|||
|
|||
On 17 Nov 2004 04:02:46 GMT, Leonid Makarovsky
wrote: Scott Dorsey wrote: : But for any other level changes that are NOT powers of two, there will be : some rounding error introduced with the multiplication, and that is what folks : are trying to avoid. Is 6 powers of 2? Did you mean the odd numbers would introduce rounding error? Say if I went from -5db to 0db, I would've had a problem? Well, I guess I was going from any negative # to 0db. I wish I knew better. To make things even more convolutated, an exact doubling or halving of signal level caused by a 1-bit shift is actually 6.0206 dB (and that's only five significant figures), not quite 6dB. So basically, any gain change does "damage" and will need dither noise added before doing it to get it right (though your DAW software may already do that as part of changing gain). --Leonid ----- http://mindspring.com/~benbradley |
#31
|
|||
|
|||
On 17 Nov 2004 04:02:46 GMT, Leonid Makarovsky
wrote: Scott Dorsey wrote: : But for any other level changes that are NOT powers of two, there will be : some rounding error introduced with the multiplication, and that is what folks : are trying to avoid. Is 6 powers of 2? Did you mean the odd numbers would introduce rounding error? Say if I went from -5db to 0db, I would've had a problem? Well, I guess I was going from any negative # to 0db. I wish I knew better. To make things even more convolutated, an exact doubling or halving of signal level caused by a 1-bit shift is actually 6.0206 dB (and that's only five significant figures), not quite 6dB. So basically, any gain change does "damage" and will need dither noise added before doing it to get it right (though your DAW software may already do that as part of changing gain). --Leonid ----- http://mindspring.com/~benbradley |
#32
|
|||
|
|||
On Tue, 16 Nov 2004 22:09:24 -0500, "Arny Krueger"
wrote: It may be advantageous to dither that; ie, sometimes shift in a 1 instead. Exactly. The problem is that the binary represenation of an analog voltage is rarely exact. There is almost always quantization error. When you double the data by means of simple shifting, you also double the quantization error. OK, but how about in a theoretical, ideal case that's properly dithered and has no quantization error. Does a shift cause any quantization error? My line of thinking is that the same data bits are surrounded by infinite zeros in each direction, so the information hasn't changed in the shift. Of course, my limited math has gotten me into plenty of trouble plenty of times. Maybe Bob Cain could weigh in from a heavy math POV.... Thanks, Chris Hornbeck |
#33
|
|||
|
|||
On Tue, 16 Nov 2004 22:09:24 -0500, "Arny Krueger"
wrote: It may be advantageous to dither that; ie, sometimes shift in a 1 instead. Exactly. The problem is that the binary represenation of an analog voltage is rarely exact. There is almost always quantization error. When you double the data by means of simple shifting, you also double the quantization error. OK, but how about in a theoretical, ideal case that's properly dithered and has no quantization error. Does a shift cause any quantization error? My line of thinking is that the same data bits are surrounded by infinite zeros in each direction, so the information hasn't changed in the shift. Of course, my limited math has gotten me into plenty of trouble plenty of times. Maybe Bob Cain could weigh in from a heavy math POV.... Thanks, Chris Hornbeck |
#34
|
|||
|
|||
Scott Dorsey wrote
Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Well, as others have said cross-thread, it would actually be a left shift. (Unless you are recording in Hebrew.) But for any other level changes that are NOT powers of two, there will be some rounding error introduced with the multiplication, and that is what folks are trying to avoid. Well, Scott normally has things pretty well nailed down technically, but in this case I'm going to have to disagree. In reality, it's not necessary to multiply by a power of two. All that's necessary[1] for scaling without losing information (changing the sound) is to multiply by a positive integer that's small enough that you do not overflow[2]. For example, if you have 8-bit signed integers and your sample data ranges from -40 to +41, then you can multiply each sample by 3 and not lose data. If you did so, you'd translate the set of values { -40, -39, ..., 0, 1, 2, ... 41 } into the set { -120, -117, ..., 0, 3, 6, ... 123 }. No information will have been lost to round-off error in this process. However, in the real world, probably no software gives you the option of multiplying by an integer constant, and there would be limited utility in doing so anyway, unless the levels are really pretty darned low and you don't care about your final levels. The best thing to do, mathematically, is to either do dithering and gain adjustment as a single combined final step, or to do gain adjustment at some point before you dither down to a lower sample size. - Logan [1] For the general case, where you have no prior knowledge of what the samples look like, that is. If you happen to know all your samples' values are multiples of 3, then you could multiply by 5/3 and not lose information. Of course, this is EXCEEDINGLY unlikely to ever happen with real audio information. [2] This is, as someone else noted, dependent on the assumption that the D/A convertor is linear. But, even changing volume by left-shift is dependent on that! |
#35
|
|||
|
|||
Scott Dorsey wrote
Yes. And for a 6 dB increase all you need to do is a right shift, so there is no loss of precision. Well, as others have said cross-thread, it would actually be a left shift. (Unless you are recording in Hebrew.) But for any other level changes that are NOT powers of two, there will be some rounding error introduced with the multiplication, and that is what folks are trying to avoid. Well, Scott normally has things pretty well nailed down technically, but in this case I'm going to have to disagree. In reality, it's not necessary to multiply by a power of two. All that's necessary[1] for scaling without losing information (changing the sound) is to multiply by a positive integer that's small enough that you do not overflow[2]. For example, if you have 8-bit signed integers and your sample data ranges from -40 to +41, then you can multiply each sample by 3 and not lose data. If you did so, you'd translate the set of values { -40, -39, ..., 0, 1, 2, ... 41 } into the set { -120, -117, ..., 0, 3, 6, ... 123 }. No information will have been lost to round-off error in this process. However, in the real world, probably no software gives you the option of multiplying by an integer constant, and there would be limited utility in doing so anyway, unless the levels are really pretty darned low and you don't care about your final levels. The best thing to do, mathematically, is to either do dithering and gain adjustment as a single combined final step, or to do gain adjustment at some point before you dither down to a lower sample size. - Logan [1] For the general case, where you have no prior knowledge of what the samples look like, that is. If you happen to know all your samples' values are multiples of 3, then you could multiply by 5/3 and not lose information. Of course, this is EXCEEDINGLY unlikely to ever happen with real audio information. [2] This is, as someone else noted, dependent on the assumption that the D/A convertor is linear. But, even changing volume by left-shift is dependent on that! |
#36
|
|||
|
|||
Chris Hornbeck wrote: On Tue, 16 Nov 2004 22:09:24 -0500, "Arny Krueger" wrote: It may be advantageous to dither that; ie, sometimes shift in a 1 instead. Exactly. The problem is that the binary represenation of an analog voltage is rarely exact. There is almost always quantization error. When you double the data by means of simple shifting, you also double the quantization error. OK, but how about in a theoretical, ideal case that's properly dithered and has no quantization error. Does a shift cause any quantization error? A doubling by a left shift leaves the SNR unchanged. Both the signal and the quantization noise are doubled. Randomizing the low order bit rather than leaving it zero would seem to decrease the SNR. Too lazy to work out by how much, though. My line of thinking is that the same data bits are surrounded by infinite zeros in each direction, so the information hasn't changed in the shift. Correct. Of course, my limited math has gotten me into plenty of trouble plenty of times. Maybe Bob Cain could weigh in from a heavy math POV.... Heavy enough? :-) Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein |
#37
|
|||
|
|||
Chris Hornbeck wrote: On Tue, 16 Nov 2004 22:09:24 -0500, "Arny Krueger" wrote: It may be advantageous to dither that; ie, sometimes shift in a 1 instead. Exactly. The problem is that the binary represenation of an analog voltage is rarely exact. There is almost always quantization error. When you double the data by means of simple shifting, you also double the quantization error. OK, but how about in a theoretical, ideal case that's properly dithered and has no quantization error. Does a shift cause any quantization error? A doubling by a left shift leaves the SNR unchanged. Both the signal and the quantization noise are doubled. Randomizing the low order bit rather than leaving it zero would seem to decrease the SNR. Too lazy to work out by how much, though. My line of thinking is that the same data bits are surrounded by infinite zeros in each direction, so the information hasn't changed in the shift. Correct. Of course, my limited math has gotten me into plenty of trouble plenty of times. Maybe Bob Cain could weigh in from a heavy math POV.... Heavy enough? :-) Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein |
#38
|
|||
|
|||
"Chris Hornbeck" wrote in message
On Tue, 16 Nov 2004 22:09:24 -0500, "Arny Krueger" wrote: It may be advantageous to dither that; ie, sometimes shift in a 1 instead. Exactly. The problem is that the binary represenation of an analog voltage is rarely exact. There is almost always quantization error. When you double the data by means of simple shifting, you also double the quantization error. OK, but how about in a theoretical, ideal case that's properly dithered and has no quantization error. Does a shift cause any quantization error? The shift does not add or subtract quantization error. Instead, it multiplies the error that is already there. As was pointed out, the SNR does not change, but the noise level increases. |
#39
|
|||
|
|||
"Chris Hornbeck" wrote in message
On Tue, 16 Nov 2004 22:09:24 -0500, "Arny Krueger" wrote: It may be advantageous to dither that; ie, sometimes shift in a 1 instead. Exactly. The problem is that the binary represenation of an analog voltage is rarely exact. There is almost always quantization error. When you double the data by means of simple shifting, you also double the quantization error. OK, but how about in a theoretical, ideal case that's properly dithered and has no quantization error. Does a shift cause any quantization error? The shift does not add or subtract quantization error. Instead, it multiplies the error that is already there. As was pointed out, the SNR does not change, but the noise level increases. |
#40
|
|||
|
|||
In article ,
Leonid Makarovsky wrote: Scott Dorsey wrote: : But for any other level changes that are NOT powers of two, there will be : some rounding error introduced with the multiplication, and that is what folks : are trying to avoid. Is 6 powers of 2? Did you mean the odd numbers would introduce rounding error? No. A 6 dB increase is a doubling of level. If you multiply all the elements in your data file by two, the meters jump 6 dB. In binary, multiplying by two is just done with shifting, the way in base 10, multiplying by ten is just done with shifting. Say if I went from -5db to 0db, I would've had a problem? Well, I guess I was going from any negative # to 0db. I wish I knew better. Well, the chances that you'll ever want to do anything in precise 6 dB increments are pretty small. --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |