sfz.github.io icon indicating copy to clipboard operation
sfz.github.io copied to clipboard

ampeg curves

Open paulfd opened this issue 6 years ago • 3 comments

Hi,

I assumed that the ampeg filters were linearly interpolating between linear gain (0 to 1) values but I started to question this, since my release felt much longer than Sforzando. Surely enough, it is not linear in the release nor the decay stage. Using:

<global> ampeg_attack=1 ampeg_release=1 ampeg_sustain=50 ampeg_decay=1 ampeg_hold=0.1
<region> key=c3 sample=*sine

and comparing the linear envelope (bottom) and the sforzando one (on top). I have a bug in the hold value clearly, so disregard it :)

Sforzando_envelopes

I feel it would be interesting to integrate in this repository. Do you have any idea what the curve is in this case?

paulfd avatar May 27 '19 21:05 paulfd

After some more checks it matches "well enough" with a multiplicatively decreasing curve from 1.0 towards 0.0005 (which is around -33 dB). The step is x_{n+1} = (0.0005/num) * x_{n} where num is the number of samples of the ramp. The full formula for the curve would be x_{n+1} = (target/start/num) * x_{n}.

The decay is also multiplicative but the ramp does not seem to follow the same law with target = sustain, but rather something strange like x_{n+1} = (0.0005/(1-sustain)/num) *x_{n} where the actual envelope would be sustain + x_{n}.

I did not check if this matches well for different ramp length though, but I'll leave it at this for the time being. It sounds closer to my ears anyway :)

Concerning the website, maybe commenting that (at least for the amplitude) the attack curve is linear by default, and the decay and release curve are multiplicative seems interesting for both developers and sfz bank creators alike. What do you think?

paulfd avatar May 28 '19 11:05 paulfd

Thank you very much for sharing your findings @paulfd , this is exactly what I was looking for.

JimmyCushnie avatar Mar 25 '20 19:03 JimmyCushnie

Also finally got around to adding this to /opcodes/ampeg_attack, so we have this info captured for now. Will probably move it to a better page later, but for now at least it's somewhere.

DSmolken avatar Mar 25 '20 19:03 DSmolken