Low complexity compressor
You can download here and test with your own files the audio compression effect of this algorithm.
The complexity is limited to one addition and two 16 bits multiplications per samples.
The divisions are computed with pre-computed tables, to make it efficient for implementations on tiny processors like Cortex-M0.
In the example provided, the gain is set for up to 35dB, the other parameters are preset for this demo (attack and decay control, energy limitation to comply with national regulations, compression level at each input level like in the diagram below).
Example with music and voice (rock, K-pop, traditional, ITU speech files) :
output compressed file