Loop samples

I am looking to make loop samples for my music notation software. My samples currently have exponetial decay and I am wanting to set each sample to a certain decibel so that I can create loop samples for my software. It is hard using adjustable fade to get the perfect inverse of the curve to amplify the softer parts a little, softest parts a lot, and the louder parts not at all. Is there a nyquist plugin that sets each sample to a certain aplitude?

Steve’s Dynamic Mirror plugin, in ducking mode, applied to a copy, can flatten the envelope

Flatten envelope.gif
You may have to apply it repeatedly (“Ctrl” +“R”).

Thanks Trebor for pointing me to Steve’s plugin.