Map the Amplitude Envelope from [dbmin,dbmax] to [-inf,dbmax] I would like to map the envelope of a sound (which has max dB level = dbmax, and min dB level = dbmin)   from [dbmin,dbmax] to [-inf,dbmax].
Here is an example :



It's like some sort of dynamic compression (or rather dynamic range 'expansion' to be precise), but here the mapping is linear from [dbmin,dbmax] to [-inf,dbmax].

What's the simplest way to do this with an  x[n] array? (my input is a soundfile, not an envelope. Is there a simple method for working on envelope (envelope follower ?))

Thank you.

PS : not realtime processing. Thus I can pre-compute dbmax, dbmin.
May be you can try the following:

 dbnew = dbmax * (1 + log((db-dbmin)/(dbmax-dbmin)))


dbnew = -inf when db = dbmin and dbnew = dbmax when db = dbmax. Please let me know if it works.