Mercurial > hg > amuse
changeset 82:92e6625473e2
implementations/mtp: implement diatonic pitch
darcs-hash:20070717120244-c0ce4-4667ed1bf08ca41f6619e895c4cdc2e24224df04.gz
author | Marcus Pearce <m.pearce@gold.ac.uk> |
---|---|
date | Tue, 17 Jul 2007 13:02:44 +0100 |
parents | 4e1538df0d10 |
children | ae06767e84c5 |
files | implementations/mtp/methods.lisp |
diffstat | 1 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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