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

(definstrument onezero(start-time duration amplitude
				  &key
				  (a1 '(0 0.5 1 0.5)))
  (multiple-value-bind (beg end) (times->samples start-time duration)
    (let* ((noise (make-rand :frequency (* 0.49 *srate*) 
			      :amplitude amplitude))
	   (a1-env (make-env :envelope a1
			     :duration duration))
	   (ozfilt (make-one-zero :a0 1.0 :a1 0.5)))
      (run
       (loop for i from beg to end do
	     (setf (mus-a1 ozfilt) (env a1-env))
	     (outa i (one-zero ozfilt (rand noise))))))))


;;; Coeff > 0 --> weak low pass
;;; (with-sound()(rawnoise 0 4 0.02))
;;; (with-sound()(onezero 0 4 0.02 :a1 '(0 0 1 1)))

;;; Coeff < 0 --> weak high pass
;;; (with-sound()(rawnoise 0 4 0.02))
;;; (with-sound()(onezero 0 4 0.02 :a1 '(0 0 1 -1)))
