Automatic Gain Control in Python?

Martin Schöön martin.schoon at gmail.com
Sun May 29 05:19:41 EDT 2022


Den 2022-05-29 skrev Christian Gollwitzer <auriocus at gmx.de>:
> Am 29.05.22 um 00:45 schrieb Stefan Ram:
>> "Steve GS" <Gronicus at SGA.Ninja> writes:
>>> Subject: Automatic Gain Control in Python?
>> 
>>    Automatic Gain Control in Python is trivial. You have a list
>>    of samples and normalize them, i.e., divide by max. Slightly
>>    simplified
>> 
>> [ s/max( samples )for s in samples ]
>> 
>>    (where sample values are normalized to the range -1,+1.)
>
> No, that's not it. Loudness is perceived in a different way, the crudest 

<snip>

> music is incredibly loud, and you might have wondered, how they do that.
>
> Google for "Loudness war" and "dynamic range compression" if you want to 
> understand it in detail.
>
I have no suggestions for solving the problem but it struck me that
you might be interested in looking up a standard called EBU R128.
Start with youtube and you find lectures/demos.

Python connection; There is a Python package called ffmpeg-normalize
which contains an implementation of EBU R128. AFAIK it works on files,
not streaming audio.

/Martin


More information about the Python-list mailing list