;; pink noise generator
;; uses Paul Kellet's economy method
;; http://www.firstpr.com.au/dsp/pink-noise/
(bind-func static pink_c
(lambda ()
(let ((b0 0.0) (b1 0.0) (b2 0.0))
(lambda ()
(set! b0 (+ (* b0 0.99765) (* (dsp_randn) 0.0555179)))
(set! b1 (+ (* b1 0.96300) (* (dsp_randn) 0.2965164)))
(set! b2 (+ (* b2 0.57000) (* (dsp_randn) 1.0526913)))
(* 0.33 (+ b0 b1 b2 (* (dsp_randn) 0.1848)))))))