i am using audacity 2.1.2 on windows 7 .
I want to create a script that reads an mp3 and picks out parts to normalize.
Here is my idea ,
Suppose we can sample audio amplitude at every 10 millisecond .
So it reads audio amplitude at beginning of file (say s) . reads amplitude after every 10 millisecond . When it encounters sample (say at position x) with amplitude s/2 or 3s/2 (±50%) it stops, Normalizes the beginning till here .
This way , we will process mp3 till the end .
}while(amp_at_position>present_vol/2 && amp_at_position<3*present_vol/2 && position<end_of_file)
normalize(beginning to position)
Is it possible ?
Actually I have sound files with silent and loud parts.
It ain’t music , just dialogue .
I want it to be equally loud at all places.
It sounds like you have re-invented the “dynamic range compression”.
The effect would need to be more sophisticated than you describe in order to achieve reasonable sound quality.
If you simply amplify (normalize) 10 ms sections, then there will be a click every time the amplification amount (“gain”) changes. To avoid the clicks, the gain would need to change progressively, so that when a quiet section is encountered, the gain is ramped up over a period of time. In a “compressor” effect, that period of time is called the “attack time”. When the input level rises again, the gain would need to ramp down over a period of time (the “release time”). In a “compressor” effect, the strength of your normalize function is called the “compression ratio”. If you are normalizing each 10 ms window to the same level, then that’s a compression ratio of “infinity:1”.
You would also need to not normalize sounds below a lower threshold, otherwise the noise in any “silent” parts would also be normalized. This lower threshold is usually called the “floor”.