;; template for Gabe's fibonacci series-based process ;; create the context the quick and dirty way (defun init-globals () (setf semit (expt 2.0 (/ 1.0 12.0))) (setf y1 0) (setf y2 1) (setf mm (make-array 8)) ) ;; define fibonacci to semitone transposition as a function (defun gf () (let ( (ss nil) (y0 nil) ) (setf y0 (+ y1 y2)) (setf y2 y1) (setf y1 y0) (setf ss (aref mm y0)) (expt semit ss) )) ;; function to sound and / or score a note (defun ins (beg dur freq amp scr stf) (let ((freq_envelope '(.00 1.00 0.25 1.0 0.75 0.0 1.0 0.0)) (amp_envelope '(.00 .00 .25 0.50 .75 1.00 1.00 .0))) ; (partial beg dur freq skew amp freq_envelope amp_envelope) (cmn::add-note-to-staff scr stf beg dur freq) )) ;; outer function to establish context and then run the whole process (defun make-fib () (let* ( (scr (cmn::init-clm-input)) (stf (cmn::add-staff scr "fib" nil)) (n 5) ) (init-globals) (setf (aref mm 0 ) 12) (setf (aref mm 1 ) 0) (setf (aref mm 2 ) 2) (setf (aref mm 3 ) 3) (setf (aref mm 4 ) 5) (setf (aref mm 5 ) 7) (setf (aref mm 6 ) 9) (setf (aref mm 7 ) 11) (with-sound (:srate 48000 :output "/zap/test.wav" :channels 2) (loop for i from 0 below n do (ins i 1 (* 440.0 (gf)) 0.1 scr stf) )) (cmn::finish-clm-input scr nil nil) ))