Hi,
You could simply use Excel to simulate this.
Let's imagine a sine waveform input.
Now if you use V_out = A × log(V_in)
You will see that there is a problem with input voltages <1
You may choose another mathematical nonlinear formula.
Maybe square_root.
It will work with positive input voltages only, thus you need to solve this problem, maybe this way:
V_out = sqrt(|V_in|) × V_in / |V_in|
If you simulate this you see that the sine shape becomes more like a square wave. This means overtones = distortions, THD.
What you need is some kind of "audio compressor".
Klaus