'(d4 c4) '(q. q.)
(defvar A-notes '((d4 c4)(b3 c4 b3 c4 a3)(b3 a3 b3 c4 b3)(c4) (e4 d4 c4 b3 a3)(g3 r a3 b3)(c4 g3 r a3)(f3 r a3 b3)(c4 a3 r c4) (b3 r d4 e4)(f4 e4 d4 c4 b3)(d4))) (defvar A-rhythm '((q. q.)(e e e e q)(e e e e q)(h.) (e e e q e)(q. e e e)(e q e q)(q. e e e)(e q e q) (q. e e e)(e e e q e)(h.))) (defvar B-notes '((e4 d4)(c4 b3) (c4 b3 c4 a3 b3)(c4 b3 c4 d4)(e4 d4 c4 b3 a3)(g3 r a3 b3)(c4 b3 r e4) (d4 r e4 fs4)(g4 c4 r d4)(e4 r g4 e4)(f4 e4 d4 c4 b3)(c4))) (defvar B-rhythm '((q. q.)(q. q.) (e e e e q)(q e q e)(e e e q e)(q. e e e)(e q e q) (q. e e e)(e q e q)(q. e e e)(e e e q e)(h.))) (setf q 0.5 q. (* q 1.5) e (/ q 2.0) h. (* q. 2))
(defvar rondeau '(A B pa1 A pa2 pb A B))
(defvar A (list A-notes A-rhythm "Quant ma dame les maus d'amer m'aprent")) (defvar B (list B-notes B-rhythm "Elle me puet aussi le biens aprendre")) (defvar pa1 (list A-notes A-rhythm "Qu'en grant douceur mon cuer tient et esprent")) (defvar pa2 (list A-notes A-rhythm "Dont qui les biens a droit saveure")) (defvar pb (list B-notes B-rhythm "Rien n'est plus dous; c'est legier a comprendre"))
(car rondeau)
(first rondeau)
(cdr rondeau)
(rest rondeau)
(second rondeau) Note that this is identical to do: (car (cdr rondeau)) or: (cadr rondeau)
(third rondeau) Note that this is identical to do: (car (cdr (cdr rondeau))) or: (caddr rondeau)
(nth 4 rondeau)
(nthcdr 5 rondeau)
(list-length rondeau)
(loop for i from 0 below (list-length rondeau) do (print (nth i rondeau)))
(loop for i from 0 below (list-length rondeau) do (print (third (eval (nth i rondeau))))) Note that we need to use eval to get the content of the symbols in rondeau.
(loop for i from 0 below (list-length rondeau) do (let ((note-list (first (eval (nth i rondeau)))) (rhythm-list (second (eval (nth i rondeau))))) (loop for measure from 0 below (list-length note-list) do (format t "~S ~S~%" (nth measure note-list)(nth measure rhythm-list)))))
(loop for i from 0 below (list-length rondeau) do (dolist (element (eval (nth i rondeau))) (print element)))Save, compile and load this file to get the CLM instrument to play the piece.
(with-sound (:output "/zap/rondeau.snd" :play nil) (let ((time 0.0)) (loop for i from 0 below (list-length rondeau) do (let ((note-list (first (eval (nth i rondeau)))) (rhythm-list (second (eval (nth i rondeau))))) (loop for measure from 0 below (list-length note-list) do (let ((note-measure (nth measure note-list)) (rhythm-measure (nth measure rhythm-list))) (loop for note from 0 below (list-length note-measure) do (let ((note-to-play (nth note note-measure)) (rhythm-to-play (nth note rhythm-measure))) (if (equal 'r note-to-play) () (simp-clm-env time (eval rhythm-to-play) (pitch note-to-play) 0.3)) (incf time (eval rhythm-to-play))))))))))
(defvar c-major-scale (make-array 7)) C-MAJOR-SCALE
(aref c-major-scale 2)
(setf (aref c-major-scale 0) 'c4) Note that array positions starts form zero (as list positions). (aref c-major-scale 0)
(defvar c-major-notes '(c4 d4 e4 f4 g4 a4 b4)) (loop for n from 0 below (list-length c-major-notes) do (setf (aref c-major-scale n) (nth n c-major-notes)))
(loop for degree from 0 below (length c-major-scale) do (print (aref c-major-scale degree))) or: (with-sound () (loop for degree from 0 below (length c-major-scale) and start from 0 by 0.5 do (simp-clm-env start 0.5 (pitch (aref c-major-scale degree)) 0.1)))
(defvar quant-ma-dame (make-array 3)) (setf (aref quant-ma-dame 0) "Machaut") (setf (aref quant-ma-dame 1) 14) (setf (aref quant-ma-dame 2) 'rondeau) quant-ma-dame
(defvar c-major-frequency (make-array 7 :element-type 'single-float :initial-element 0.0)) c-major-frequency Note that the new array is full of O.0 instead of NIL. (loop for n from 0 below (list-length c-major-notes) do (setf (aref c-major-frequency n) (pitch (nth n c-major-notes)))) c-major-frequency
(let ((array-size (length c-major-frequency)) (osc-array (make-array (length c-major-frequency) :element-type 'osc))) ;;; fill 'er up... (loop for j from 0 below array-size do (setf (aref osc-array j) (make-oscil :frequency (aref c-major-frequency j)))) ;;; and show the array osc-array)
©1996-98 by Juan Pampin, juan@ccrma.stanford.edu