[CM] #t... for pitches

Bill Schottstaedt bil at ccrma.Stanford.EDU
Sat May 15 06:45:10 PDT 2010


Someone asked earlier about using #t for base 12 and
automatically reading things like #t04 as a pitch
designation (middle-C in this case):

(set! *#readers* 
      (cons (cons #\t (lambda (str) 
			(* 16.351 (expt 2 (/ (+ (* 12 (string->number (string (str 2))))
						(string->number (string (str 1)) 12))
					     12)))))
	    *#readers*))

:#t94
439.98391314603
:#t04
261.616
:#t05
523.232

So the syntax here is #t<pitch><octave>.



More information about the Cmdist mailing list