Wiki » History » Version 2

« Previous - Version 2/6 (diff) - Next » - Current version
Chris Cannam, 2014-07-18 07:57 PM


Wiki

Trying this out in the Piano Evaluation of the Silvet Note Transcription plugin

First attempt

As of e36fe9312ad4

The aim is just to make the RMS level across a few seconds of audio tend toward some target.

We have a target RMS value T (example 0.05). Start with an initial gain G equal to 1.

At each sample:

  • Update the RMS level of the past 4 seconds of audio
  • Find the gain G' that would be necessary to make that level equal to T (i.e. T / rms)
  • Update our stored gain G to move it 1/N of the distance from G to G' (where N is 0.5 seconds in sample count)
  • Return the sample scaled by G