No subject

Tobias Kunze t@ulysses.Stanford.EDU
Mon, 24 Feb 1997 01:56:56 -0800


Might as well comment on your code while I'm sitting here late at
night grading common music homework!

Here's what I would do:

  (algorithm melos midi-note (start 0 end 16 rhythm .25 duration .25)
    (vars (m (defmode (major on 'bf3) 2 2 1 2 2 2 1))
  	(lb (degree 'g3)) step)
    (setf step (item (steps 1 initially-from 48 of m))
  	note (if (> step lb)
  		 (mode-degree (+ lb (mod (- step lb) 12)) m)
  	       step)))


Or, if you like terse code:

  (defparameter *my-mode* (defmode (major on 'c4) 2 1 2 2 2 1 2))

  (algorithm melos midi-note (start 0 end 16 rhythm .25 duration .25)
    (setf note (item (steps 1 initially-from 48 of *my-mode*)))
    (and (>= note 67)
	 (setf note (mode-degree (+ 55 (mod (- note 55) 12)) *my-mode*))))