fastsin   xtlang


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

Implementation

;; x values must fall within the range -PI ... PI
(bind-func fastsin
  (let ((p 0.225) ; :_abuf* (alloc))
        (b (/ 4.0 SPI))
        (c (/ -4.0 (* SPI SPI))))
    (lambda (x)
      (let ((y (+ (* b x) (* c x (fabs x)))))
        (+ (* p (- (* y (fabs y)) y)) y)))))


Back to Index