|
|||||||||
|
Thread Tools | Search this Thread |
March 20th, 2011, 03:44 PM | #1 |
New Boot
Join Date: Apr 2008
Location: Juneau, AK
Posts: 21
|
Bit shift left for multiplication of audio
I'm wondering if there is an audio editing or processing tool that will permit me to so a bit left-shift operation.
I have a wav file that is very low level, and I'd like to left shift the bits 2 or 3 positions. That would avoid any integer-to-float-back-to-integer conversions. Just want to do integer multiplication by some power of 2. The background noise in this live recording makes loss of the extra precision from low order bits irrelevant, and I'd prefer a ligher level signal on the CD. I don't see how to do this with Audacity, and am thinking probably not possible, because I think Audacity already makes the conversion to float (or maybe double) when the wav file is imported. Is there any way to do integer multiplication in Audacity? Or some other audio tool? Or should I just use the Audacity "Amplify" tool and specify 12db of gain, if I want to shift left 2 bits, figuring that the precision in Audacity is sufficient that there won't really be any rounding error for the "round trip" of integer-->float-->floating multiplication arithmetic-->integer? Thank you for any comments. Regards, DG |
March 20th, 2011, 04:23 PM | #2 |
Trustee
Join Date: Jan 2011
Location: Pennsylvania
Posts: 1,791
|
Re: Bit shift left for multiplication of audio
I haven't used Audacity although I'm familiar with the name.
I mostly use CoolEdit Pro. I'm pretty sure that it keeps everything at 16-bit unless you specifically tell it to convert to 32-bit depth. I can understand your desire to do a direct bit shift. I'm wondering whether it's really terribly important. If you shift by 3 bits (or multiply by 8) you will essentially have audio with 13-bit accuracy. Any rounding and averaging errors will be the least significant bit out of 16 bits, won't they? If so, the error will be 1/8 the size of your smallest actual audio "bit" at that point... in other words, pretty insignificant. However, if you are really concerned about minimizing rounding/averaging errors, do not boost gain by 12dB. That is a gain factor of 3.9810717... If you really want to multiply by 4.000, then change your gain scale from dB to percentage, and multiply by 400.000.... percent. Of course I could write a DOS executable that would open your file, and shift each sample by some number of bits. But I question whether it's really worthwhile. |
March 20th, 2011, 08:44 PM | #3 |
Major Player
Join Date: Dec 2005
Posts: 895
|
Re: Bit shift left for multiplication of audio
Does dshift in sox do what you're asking?
dcshift shift [ limitergain ] DC Shift the audio data, with basic linear amplitude formula. This is most useful if your audio data tends to not be centered around a value of 0. Shifting it back will allow you to get the most volume adjustments without clipping audio data. The first option is the dcshift value. It is a floating point number that indicates the amount to shift. An option limtergain value can be specified as well. It should have a value much less then 1.0 and is used only on peaks to prevent clipping. |
March 21st, 2011, 07:34 PM | #4 |
New Boot
Join Date: Apr 2008
Location: Juneau, AK
Posts: 21
|
Re: Bit shift left for multiplication of audio
Thank you for the responses.
Good point about the insignificance of the rounding. Audacity seems to require that I enter gain in dB. I think that a DC level shift is a different problem than I was trying to describe. Sorry for the lack of clarity. Regards, DG |
March 21st, 2011, 08:55 PM | #5 |
Trustee
Join Date: Jan 2011
Location: Pennsylvania
Posts: 1,791
|
Re: Bit shift left for multiplication of audio
Sorry I am not familiar with Audacity, except by name.
I might suggest you do a web search, I have found lots of Audacity help pages on there in the past. If you really want to imitate multiplying by 2^n, use the numbers below. 200% = 6.0205999... dB 400% = 12.0412 dB 800% = 18.0618 dB This should keep all your math errors much smaller than the magnitude of the original audio data. But IMHO it doesn't matter. What would be nice would be having an original file with a higher sample rate than the desired sample rate of the final file. Then the downsampling operation would interpolate new amplitude values between values that existed in the original file... essentially giving you more resolution than you had originally. (But I'm not sure that would really make an audible difference.) Good luck! |
| ||||||
|
|