Jump to content
  • Advertisement
Sign in to follow this  
Endemoniada

Scaling Question

This topic is 4495 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

Hi guys, If my base is 440.0 and one level below is half and one level above is double I have 220.0...440.0...880.0, how do I map [-1.0,1.0] (or [0.0,1.0]) to that ? I'm confused because it's not linear. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
First use a logarithmic mapping to get a linear range, and then map that to whatever other range you want. So if you had 220, 440, and 880, map that to log2(220) = 7.78, log2(440) = 8.78, and log2(880) = 9.78. Your're minimum could be log2(1) = 0, and your maximum could be log2(1048576) = 20, which you map to [-1, 1] or [0, 1] using standard linear shifting/scaling techniques.

Share this post


Link to post
Share on other sites
Quote:
Original post by Endemoniada
If my base is 440.0 and one level below is half and one level above is double I have 220.0...440.0...880.0, how do I map [-1.0,1.0] (or [0.0,1.0]) to that ? I'm confused because it's not linear.

#include <math.h>

double frequency(double octaves_from_A4){
return 440.0 * pow(2.0, octaves_from_A4);
}

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!