[CM] lisp loop iteration in cm

Rick Taube taube@uiuc.edu
Sat, 16 Sep 2006 17:42:10 -0500


this version adds the rhythmic element a la http://henon.sapp.org/
also see the Chaos chapter in Notes from the Metalevel, I  think that  
version uses the y value for rhythmic values...


(defun henonseq (cycles rhy dur amp &key
		     (a -1.85039)  ;; a=-1.56693 b= -0.011811
		     (b 0.003937)
		     (x 0.63135448)
		     (y  0.18940634)
		     (low 0) (high 127))
   (process with key and newx = 0.00 and newy = 0.00
	   repeat cycles
	do (progn
	     (setf newx (+ (* a (expt x 2)) (* b y) 1))
	     (setf newy x)
	     (setf x newx)
	     (setf y newy)
	     (setf key (midinormz x)))
	when (<= low key high)
	output (new midi :time (now)
		    :duration dur
		    :amplitude amp
		    :keynum key)
	wait rhy))


(events (henonseq 500 0.125 0.1 0.7 :a -1.56693 :b -0.011811 :x 0 :y 0
		  :low 30 :high 100) "henonseq.mid")