exponential curves in CLM?
To: Larry Troxler <lt@westnet.com>
bil
Fri, 8 Aug 97 05:53:32 PDT
you can get as close as you like to a given exponential (i.e.
thinking in terms of e^(-kt)) by fiddling with the base:
(definstrument expins (dur k m)
(let* ((nd (floor (* dur sampling-rate)))
(j 0)
(maxdiff 0.0)
(zv (make-env (list 0 1 1 (exp (- k))) :base m)))
(run* (maxdiff)
(loop for i from 0 to nd do
(let* ((vala (env zv))
(valb (exp (* (- k) (/ j nd))))
(valc (abs (- valb vala))))
(outa i vala)
(outb i valb)
(if (> valc maxdiff) (setf maxdiff valc))
(incf j))))
(print maxdiff)))
;;; (with-sound (:channels 2) (expins 1 .5 1.65))
;;; 7.2419643e-5
;;; or
;;; (with-sound (:channels 2) (expins 1 5 148))
;;; 1.3118982e-4
;;;
;;; that is, let the envelope "base" be (exp k)