exponential curves in CLM?
To: Larry Troxler <lt@westnet.com>
bil
Fri, 1 Aug 97 08:07:10 PDT
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)
|#