Changing Volume programatically - Amplification effect

Started by
1 comment, last by Kylotan 17 years, 12 months ago
İ loaded a Wav file.Iparsed it myself.So i have the buffer.What i want to do is lower /higher the sound programatically.My idea was getting left channel bits shift them 1 ( thats doubles their value.So makes them louder).and doing the same thing for the right channel.This doesn't work.What's the trick here?
Essegin Ziki:) bunu bu sitede imza hesabına yazsam kimse anlamaz!!!:)
Advertisement
Are you saying you're trying to make a program that does that?
________________________Quote:OluseyiI knew of a "Christian" couple in Nigeria who named their child "God's End-time Battle Axe." I kid you not.
The values are typically 16 bit signed values, ie. centred around zero, so you can't just shift them as it would make the values fly all over the place. You need to multiply them by between 0.0 and 1.0, to do it properly. I don't know much about low-level speed these days, so I'm unsure whether it's faster to convert to a float, perform the multiplication, then convert back, or to do it all in integers (eg. multiply by 100, then divide by a number between 1 and 100). I'm sure there are other tricks with bit manipulation or special CPU instructions but I'd recommend you keep it simple to begin with.

This topic is closed to new replies.

Advertisement