# HG changeset patch # User Marcus Pearce # Date 1184673764 -3600 # Node ID 92e6625473e2ecd4bbe4e865c4ca3422ab8714c1 # Parent 4e1538df0d10ecd5e2ae996517193c608cc113ef implementations/mtp: implement diatonic pitch darcs-hash:20070717120244-c0ce4-4667ed1bf08ca41f6619e895c4cdc2e24224df04.gz diff -r 4e1538df0d10 -r 92e6625473e2 implementations/mtp/methods.lisp --- a/implementations/mtp/methods.lisp Tue Jul 17 13:02:06 2007 +0100 +++ b/implementations/mtp/methods.lisp Tue Jul 17 13:02:44 2007 +0100 @@ -28,6 +28,8 @@ :initial-contents (nreverse compositions)) dataset)) + + (defmethod get-composition ((identifier mtp-composition-identifier)) (let* ((dataset-id (dataset-id identifier)) (composition-id (composition-id identifier)) @@ -203,11 +205,24 @@ (defmethod midi-pitch-number ((e mtp-event)) (%mtp-cpitch e)) +(defmethod meredith-morphetic-pitch-number ((e mtp-event)) + ;; MIPS morphetic pitch is relative to An0 while mpitch is relative to Cn2 + (- (%mtp-mpitch e) 12)) + +(defmethod mips-pitch ((e mtp-event)) + (make-mips-pitch (meredith-chromatic-pitch-number e) + (meredith-morphetic-pitch-number e))) + (defmethod diatonic-pitch ((e mtp-event)) -;; (make-diatonic-pitch (event-mpitch e) -;; (event-accidental e) -;; octave) - ) + (diatonic-pitch (mips-pitch e))) + +#.(clsql:locally-enable-sql-reader-syntax) +(defmethod middle-c ((e mtp-event)) + (let ((cpitch (car (clsql:select [midc] :from [dataset] + :where [= [dataset-id] (dataset-id e)] + :flatp t :field-names nil)))) + (make-mtp-event :cpitch cpitch :mpitch (* (/ cpitch 12) 7)))) +#.(clsql:restore-sql-reader-syntax-state) ;;; Phrase boundaries