;;; Defining a recursive process with four input args. ;;; sprout's second arg is the time to start the sprouted object. ;;; ;;; http://serendip.brynmawr.edu/playground/sierpinski.html ;;; http://astronomy.swin.edu.au/~pbourke/fractals/gasket/ ;;; using the fm-violin (define (sierpinski knum ints dur amp depth) (let ((len (length ints))) (process for i in ints for k = (transpose knum i) output (new fm-violin :startime (now) :dur dur :amplitude amp :frequency (hertz k)) when (> depth 1) ;; sprout a process on output note sprout (sierpinski (transpose k 12) ints (/ dur len) amp (- depth 1)) wait dur))) ;;; using midi output (define (sierpinski knum ints dur amp depth) (let ((len (length ints))) (process for i in ints for k = (transpose knum i) output (new midi :time (now) :duration dur :amplitude amp :keynum k) when (> depth 1) ;; sprout a process on output note sprout (sierpinski (transpose k 12) ints (/ dur len) amp (- depth 1)) wait dur))) (define (sierpinski knum ints dur amp chan depth) (let ((len (length ints))) (process for i in ints for k = (transpose knum i) output (new midi :time (now) :duration dur :channel chan :amplitude amp :keynum k) when (> depth 1) ;; sprout a process on output note sprout (sierpinski (transpose k 12) ints (/ dur len) amp (+ chan 1) (- depth 1)) wait dur))) #| (defparameter *pm* (portmidi-open :output 0 :input 1)) (rts (sierpinski 'a0 '(0 7 5 ) 3 .1 4) *pm*) (rts (sierpinski 'a0 '(0 -1 2 13) 6 .1 0 4) *pm*) (events (sierpinski 'a0 '(0 7 5 ) 3 .1 4) "test.snd") (events (sierpinski 'a0 '(0 -1 2 13) 6 .1 4) "test.snd") |#