# 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.

## 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 on other sites
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 on other sites
Quote:
 Original post by EndemoniadaIf 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 on other sites
Thanks a lot guys, now I can make a logarithmic slider.

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 29
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631739
• Total Posts
3001958
×