I have a general purpose synthesizer envelope with an arbitrary number of
segments.  Each segment can be linear or exponential right now, as chosen
by the user.

Whichever of the two options was chosen, the "next sample's output" of the
envelope is generated from the current sample with the formula:

   current = previous * multiplier + delta.

Say the segment is going to be 10,000 samples long and the output should
fall from 2 to 1.

For a linear segment, multiplier = 1 and delta = (1-2) / 10000.

For a exponential segment, delta = 0 and multiplier = pow( 2/1, 1/10000).

(It turns out that the repeated multiplication is extremely accurate.  Even
for segment lengths under 5 minutes at 44.1kHz and value outputs of just a
semitone ratio, the output closest to the expected final output is the
expected sample.)

Users suggest that other curves be offered.  I'm sure that given the
constraints of start point, end point, and any other point within that
rectangle to go through, there will be a multiplier/delta combo that does
it.  But:

1) how do I find that pair (other than for instance brute-force binary
search)?

2) is there any naming convention for the resulting set of curves?  My
current thought on would be a notation whereby 0=linear.  1=exponential.
Otherwise, we look at x=halfway through the curve, and y [0,1] is an
interpolation between linear and exponential y at that x; [1,infinity] is
an interpolation between exponential y and the endpoint; and negative
values are simply on the other side of linear.  But while this would be
easy enough to explain (with a picture) and code, it's not particularly
even, and I wonder if there isn't already an established system.
_______________________________________________
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Reply via email to