Jump to content
  • Advertisement
Sign in to follow this  
tonymontana

Changing Volume programatically - Amplification effect

This topic is 4542 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

İ 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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!