;;;
;;; Simple demonstration of one pole filter
;;; nando, October 28 1996
;;;

(definstrument onepole(start-time duration amplitude
				  &key
				  (b1 '(0 0.5 1 0.5)))
  (multiple-value-bind (beg end) (get-beg-end start-time duration)
    (let* ((noise (make-randh :frequency (* 0.49 sampling-rate) 
			      :amplitude amplitude))
	   (b1-env (make-env :envelope b1))
	   (opfilt (make-one-pole :a0 1.0 :b1 0.5)))
      (Run
       (loop for i from beg to end do
	     (setf (smpflt-b1 opfilt) (env b1-env))
	     (outa i (one-pole opfilt (randh noise))))))))


;;; Coeff < 0 --> low pass
;;; (with-sound()(rawnoise 0 4 0.02))
;;; (with-sound()(onepole 0 5 0.01 :b1 '(0 0 0.1 0 0.9 -1 1 -1)))

;;; Coeff > 0 --> high pass
;;; (with-sound()(rawnoise 0 4 0.02))
;;; (with-sound()(onepole 0 4 0.02 :b1 '(0 0 0.1 0 0.9 1 1 1)))
