;;; ;;; A very simple frequency modulation instrument ;;; (nando, Oct 14 '96) (definstrument fm (start-time duration carrier-freq modulator-freq index amplitude &key (amp-env '(0 0 0.5 1 1 0))) (multiple-value-bind (beg end) (get-beg-end start-time duration) (let* ((carrier (make-oscil :frequency carrier-freq)) (modulator (make-oscil :frequency modulator-freq)) (envelope (make-env :envelope amp-env :scaler amplitude :start-time start-time :duration duration))) (Run (loop for i from beg to end do (outa i (* (env envelope) (oscil carrier (* index (oscil modulator)))))))))) ;;; (with-sound() (fm 0 3 440 5 0.005 0.1)) ;;; (with-sound() (loop for time from 0 by 1.1 ;;; for f from 10 by 10 below 150 ;;; with ae = '(0 0 0.1 1 0.9 1 1 0) do ;;; (fm time 1.2 440 f 0.1 :amp-env ae)))