;;; psa-plunder-mw.lisp ;; A public service announcement plundered by Matt Wright ;; to make a piece in CLM. ;; This uses utility routines defined in plunder.lisp ;; Some basic info about my sound file (which I got from the Unix utility sfinfo): (setq *soundfile* "/usr/ccrma/snd/matt/jb.wav") (setq *srate* 44100) (setq soundfile-numframes 1539384) ;; Same thing in samples instead of frames: (setq soundfile-duration (/ soundfile-numframes *srate*)) ;; The regions that I found in Snd that I want to be able to loop, play as single ;; "note"s, etc. (setq *regions* '((hh 20.873 21.095) (drugs 20.111 20.873) (hit1 1.74 1.974) (sax .243 .771) (groove1 5.557 6.342) (guit 7.73 7.986) (onebar 11.464 13.436) (bass 19.382 19.622) (3notes 1.748 2.496) (this-is-jb 2.753 3.692) (novox-loop .328 2.247) (leave-it 11.473 12.762) (end 23.668 34.9) )) (setq length-of-one-bar (region-dur 'onebar)) (setq *tempo* (/ 60 (/ length-of-one-bar 4))) ;;; From here on down is the construction of my particular piece ;;; out of the above elements: ;; Granular subroutines (defun this-is-jb (time duration) (stretch-it 'this-is-jb time duration)) (defun leave-it (time duration) (stretch-it 'leave-it time duration)) ;; Pattern stuff (defun busy (time n) (let ((timbres (new cycle :of `(bass hh ,(new heap :of `(hh sax sax hit1 guit guit 3notes 3notes ,(new heap :of '(hh hh hh drugs))))))) (rhythms (new cycle :of `((e e) ,(new cycle :of '((s e s) (e e e) (e s s))) ,(new heap :of '((32nd 32nd s e) (s. s. s. s. s s) (e s 32nd 64th 64th))) ,(new heap :of '((s e.) (s e.) (s s s s) (s e s))))))) (play-patterns time n timbres rhythms) )) (defun medium (time n) (let ((timbres (new cycle :of `(bass hh bass hh ,(new heap :of `(hh sax sax guit guit 3notes 3notes ,(new heap :of '(hh hh hh drugs))))))) (rhythms (new cycle :of `((h) ,(new cycle :of '((q q) (q q) (q q q) (q q) (q q q q))) ,(new heap :of '((s e.) (s e.) (s s s s) (s e s)))) ))) (play-patterns time n timbres rhythms) )) ;; Sections of my piece: (defun intro () (let ((time 0)) (mixr time 'hh 0.5) (setq time (+ time (rhythm 'w))) (mixr time 'sax 0.5) (setq time (+ time (rhythm 'w))) (mixr time 'guit 0.5) (setq time (+ time (rhythm 'h))) (mixr time '3notes 0.5) (setq time (+ time (rhythm 'w+w))) (mixr time '3notes 0.5) (setq time (+ time (rhythm 'e.))) (mixr time '3notes 0.5) (setq time (+ time (rhythm 'e.))) (mixr time '3notes 0.5) (setq time (+ time (rhythm 'h))) time )) (defun sayname (time dur) (let ((repetitions (ceiling (/ dur (region-dur 'novox-loop))))) (repeat-region time 'novox-loop 1.0 repetitions) (this-is-jb time dur) (+ time dur))) ;; The whole thing: (defun whole-thing () (with-sound (:srate *srate*) (let* ((t1 (intro)) (t2 (sayname t1 11)) (t3 (medium t2 25)) (t4 (busy t3 30)) ) (leave-it 40 12) (ritard 'end 60 20)))) #| The rest of this file is just examples; all this stuff is commented out so you can load the file. Using the pound-verticalbar comment syntax instead of beginning each line with a semicolon makes it easier to evaluate these expressions with copy+paste or with control-C control-E in xemacs. ;; Call (whole-thing) to render the whole piece: (whole-thing) ;; Play individual regions: (with-sound (:srate *srate*) (mixr 0 'guit 0.8) (with-sound (:srate *srate*) (mixr 0 '3notes 0.8) (with-sound (:srate *srate*) (my-cut 0 '3notes 0.8 1.0)) (with-sound (:srate *srate*) (mixr 0 'hit1 0.8) ;; Loop regions: (with-sound (:srate *srate*) (repeat-region 0 'onebar 1 3)) (with-sound (:srate *srate*) (repeat-region 0 'novox-loop 1 3)) (with-sound (:srate *srate*) (repeat-region 0 'drugs 1 3)) ;; Rhythmic layering of a loop with CLM notes: (with-sound (:srate *srate*) (repeat-region 0 'onebar 0.3 3) (let ((time 0)) (loop for note-value in '(q q q q e s s e s s q e e q) do (mixr time 'guit 1.) (incf time (rhythm note-value)) ))) (with-sound (:srate *srate*) (play-patterns 0 20 (new cycle of '(hh sax guit)) (new heap of '((h) (q) (e e) (s s s s))) )) (let ((timbres (new cycle :of `(bass hh ,(new heap :of `(hh sax sax hit1 guit guit 3notes 3notes ,(new heap :of '(hh hh hh drugs))))))) (rhythms (new cycle :of `((e e) ,(new cycle :of '((s e s) (e e e) (e s s))) ,(new heap :of '((32nd 32nd s e) (s. s. s. s. s s) (e s 32nd 64th 64th))) ,(new heap :of '((s e.) (s e.) (s s s s) (s e s))))))) (play-patterns time n timbres rhythms) )) (with-sound (:srate *srate*) (let ((time 0)) (loop for x in '(w w q q q w) do (mixr time (if (equalp x 'q) 'hit1 'onebar) 1.0) (setq time (+ time (rhythm x))) ))) (with-sound (:srate *srate*) (intro)) (with-sound (:srate *srate*) (sayname 0 10)) (with-sound (:srate *srate*) (medium 0 30)) (with-sound (:srate *srate*) (busy 0 30)) |#