ESP8266Audio icon indicating copy to clipboard operation
ESP8266Audio copied to clipboard

(feature request) - automatic gain limiter

Open softhack007 opened this issue 3 years ago • 0 comments

How about adding something like an "automatic gain limiter" to the AudioOutput class?

I imagine it the following way:

  • user does output->setGain(2.5) - or something which is a bit too high
  • user does output->enableGainLimiter(true)
  • during playback, the output class initially uses the gain set by users parameter.
  • whenever the output sample (after Amplify) would be above/below a certain threshold - say 96% of MAX - the gain value is slightly reduced and the output sample is re-computed (i.e. repeat Amplify step).

This would be an easy way to reduce gain and avoid sound saturation. Its not a real "AGC", but a lightweight version that avoids some complications because it only reduces amplification, but never increases it.

What do you think?

softhack007 avatar Jan 06 '22 16:01 softhack007