exponential curves in CLM?

Larry Troxler lt@westnet.com
Wed, 06 Aug 1997 23:24:14 -0400


Yep, just as I suspected, it doesn't seem like make-env can be used  to
get a natural ringing, eponential ( e^-kt ) decay. What your code does
is something different. You can see this if you plot the output in snd.
The shape is obviously wrong - it doesn't approach zero slope as it
approaches zero, and it has more curvature towards the end of the decay,
rather then towards the begginning.


My idea of feeding the env output to a one-pole filter has the drawback
that it will wreck the attack of the envelope, if it is at all fast. I
guess what I really want is some way to follow the rising slopes of the
envelope exactly, but applying the exponential decay to the decaying
slope.

Any ideas on how this is accomplished, or am I not communicating or
understanding clearly? A naturally decaying envelope seems like such a
common thing, I think I might still be misunderstanding something. 


Bill Schottstaedt wrote:
> 
> Perhaps this instrument will make it more obvious what
> the exponential envelope segments are doing:
> 
> (definstrument expins (dur frq amp)
>   (let* ((nd (floor (* dur sampling-rate)))
>          (o1 (make-oscil frq))
>          (o2 (make-oscil frq))
>          (j nd)
>          (maxdiff 0.0)
>          (zv (make-env '(0 1 1 0) :base 2.718)))
>     (run* (maxdiff)
>      (loop for i from 0 to nd do
>        (let* ((vala (* amp (env zv) (oscil o1)))
>               (valb (* (/ amp (- 2.718 1.0)) (- (exp (/ j nd)) 1.0) (oscil o2)))
>               (valc (abs (- valb vala))))
>        (outa i vala)
>        (outb i valb)
>        (if (> valc maxdiff) (setf maxdiff valc))
>        (decf j))))
>     (print maxdiff)))
> 
> #|
> (with-sound (:channels 2 :statistics t) (expins 1.0 440.0 .5))
> 8.189678e-5 test.snd:
> 
>   Duration: 1.0001, Last begin time: 0.0000
>   Compute time: 0.338, Compute ratio: 0.34
>   OutA max amp: 0.499 (near 0.001 secs)
>   OutB max amp: 0.499 (near 0.001 secs)
> |#

--  Larry Troxler --  lt@westnet.com  --  Patterson, NY USA  --