title: How to skew normalization using a logarithmic scale?
body: <p>I'm working on a program that reads data from a graph and plays the values at a certain frequency that has been normalized to show the variance between data points. </p>
  
  <p>In testing I found that an "acceptable" sound range lies between 200 and ~3800 for frequency ranges that aren't too high or too low to be of use. This means that I need all of the data to be converted into that range of numbers. Here is a solution to that given those guidelines.</p>
  
  <pre><code>function normalize(enteredValue, minEntry, maxEntry, normalizedMin, normalizedMax) {
  
  var mx = (enteredValue-minEntry)/(maxEntry-minEntry);
  var preshiftNormalized = mx*(normalizedMax-normalizedMin);
  var shiftedNormalized = preshiftNormalized + normalizedMin;
  
  return shiftedNormalized;
  
  }
  </code></pre>
  
  <p>This works, but it poses a small problem with certain cases. If a user has a very small value and a very large value in the same data set.</p>
  
  <p>Simple Example: $1 profits for company A and $1 billion for company B there won't be an issue IF company C and D  etc... have profits that are extremely far away from the edge cases. However, let's say company C has a profit of $50 million. This is significantly more than $1  and far less than $1 billion and won't be too much of an issue. However, if D has a profit of $20 thousand then we might  have a problem.</p>
  
  <p><strong>The numbers after normalization would be this (using 3800 as a max and 200 as a min):</strong></p>
  
  <p>1 = 200.0000036</p>
  
  <p>20 thousand = 200.072</p>
  
  <p>50 million = 380</p>
  
  <p>1 billion = 3800</p>
  
  <p>Here we can see the obvious problem. IF we use the function above to normalize the sound into the desired frequency range, then a large data set with a huge variance in data could skew perception of what is being represented on the graph. Because of how normalization squeezes larger data into a smaller range of numbers, this becomes a problem only when the largest and smallest numbers are very far apart.</p>
  
  <p><strong>Two potential solutions:</strong></p>
  
  <ul>
  <li><p>Set a maximum number that users can have in the data set. This is an easy fix, but it would limit the capabilities of the program when
  it comes to automatically parsing data from csv files because
  anything over the cap would simply play the highest frequency. </p></li>
  <li><p>The second solution is complicated and I'm not sure how to do it yet, which is what I'm hoping to gleam from you or someone to point
  me in the right direction. I think using some sort of logarithmic
  scaling to make larger data less significant would be a good
  solution. What I mean by this is something like this graph here:</p></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/zVhQl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zVhQl.png" alt=""></a></p>
  
  <p>Excuse my poor paint drawing skills, but you can see what I mean. As numbers get larger they get less and less significant. It's not how numbers work in relation to one another, but I think human perception of large numbers is already vague so it would be better to have larger numbers sound closer together than smaller numbers. (Such as 1 and 20,000).</p>
  
  <p>What do you think?</p>
  
  <p>Edit:
  I think one of the comments mentioning taking log base 10 of the number is on the right track, however it wouldn't work for smaller data points because numbers would be too close together. IE Log 1 is 1 and log 10 is 2. 1 and 2 are so close together that you wouldn't hear a difference.</p>