Wiki » History » Version 2

Chris Cannam, 2014-07-18 07:57 PM

1 1 Chris Cannam
h1. Wiki
2 1 Chris Cannam
3 1 Chris Cannam
Trying this out in the "Piano Evaluation of the Silvet Note Transcription plugin":/projects/silvet/wiki/Piano_Evaluation_for_Level_Normalisation
4 1 Chris Cannam
5 1 Chris Cannam
h3. First attempt
6 1 Chris Cannam
7 1 Chris Cannam
As of commit:e36fe9312ad4
8 1 Chris Cannam
9 2 Chris Cannam
The aim is just to make the RMS level across a few seconds of audio tend toward some target.
10 2 Chris Cannam
11 2 Chris Cannam
We have a target RMS value T (example 0.05). Start with an initial gain G equal to 1.
12 1 Chris Cannam
13 1 Chris Cannam
At each sample:
14 1 Chris Cannam
15 1 Chris Cannam
* Update the RMS level of the past 4 seconds of audio
16 1 Chris Cannam
* Find the gain G' that would be necessary to make that level equal to T (i.e. T / rms)
17 1 Chris Cannam
* 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)
18 1 Chris Cannam
* Return the sample scaled by G