Every time the knob is changed, you could recalculate the output value of a sample with the input of +1. If you set a variable to this value, you can multiply the output of the distortion by this value to get the same peak output level...
But, the distortion is going to cause the output to become compressed and sound a lot louder, regardless of the peak value. You could calculate the RMS of the input and output, then compensate the output. I think this would be highly dependent on the type of source material (e.g., distorted guitar, drums, harpsichord, etc.). Something that already has a lot of compression/distortion may sound a lot different than a source with more dynamic range.
|