explin   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/audio_dsp.xtm

Implementation

;; explin is a function that can smoothly interpolate
;; between logarithmic and exponential curves
;;
;; t is a value between [0.0 .. 1.0] for time.
;; x is a value between [-1.0 ... 1.0] that
;; moves between logathmic (negative) and exponential (positive)
;; curves with a centre value of 0.0 being exactly linear
(bind-func explin
  (let ((time 0.0:f)
        (Ef (dtof E))
        (scale (/ 1.0 (- Ef 1.0))))
    (lambda (t:float x:float)
      (if (< x 0.0)
          (set! x (+ 1.0 x))
          (if (< (fabs x) 0.0001)
              (set! x 1.0)
              (set! x (/ 1.0 (- 1.0 x)))))
      (set! time (+ 1.0 (* t (- Ef 1.0))))
      (* (+ -1.0 (exp (pow (log time) x))) scale))))


Back to Index