title: How to normalize a NumPy array to within a certain range?
body: <p>After doing some processing on an audio or image array, it needs to be normalized within a range before it can be written back to a file.  This can be done like so:</p>
  
  <pre><code># Normalize audio channels to between -1.0 and +1.0
  audio[:,0] = audio[:,0]/abs(audio[:,0]).max()
  audio[:,1] = audio[:,1]/abs(audio[:,1]).max()
  
  # Normalize image to between 0 and 255
  image = image/(image.max()/255.0)
  </code></pre>
  
  <p>Is there a less verbose, convenience function way to do this? <code>matplotlib.colors.Normalize()</code> doesn't seem to be related.</p>