Mercurial > hg > amuse
comparison implementations/mtp/methods.lisp @ 329:f54848e1f74c
Flag use of cents; define diatonic-pitch correctly for cents
author | Jeremy Gow <jeremy.gow@gmail.com> |
---|---|
date | Mon, 19 Nov 2012 15:11:49 +0000 |
parents | 04940d80aaed |
children | 2fbff655ba47 |
comparison
equal
deleted
inserted
replaced
328:04940d80aaed | 329:f54848e1f74c |
---|---|
1 (cl:in-package #:amuse-mtp) | 1 (cl:in-package #:amuse-mtp) |
2 | |
3 ;;; Are we using cents to represent chromatc pitch, or MIDI values? | |
4 ;;; A hack to allow backwards compatibility with old MIDI value databases. | |
5 (defvar *cpitch-cents* t) | |
2 | 6 |
3 ;;; Compositions | 7 ;;; Compositions |
4 | 8 |
5 #.(clsql:locally-enable-sql-reader-syntax) | 9 #.(clsql:locally-enable-sql-reader-syntax) |
6 | 10 |
276 (defmethod midi-pitch-number ((e mtp-event)) | 280 (defmethod midi-pitch-number ((e mtp-event)) |
277 (%mtp-cpitch e)) | 281 (%mtp-cpitch e)) |
278 | 282 |
279 (defmethod diatonic-pitch-cp ((e mtp-event)) | 283 (defmethod diatonic-pitch-cp ((e mtp-event)) |
280 ;; MIPS morphetic pitch is relative to An0 while cpitch is relative to Cn2 | 284 ;; MIPS morphetic pitch is relative to An0 while cpitch is relative to Cn2 |
281 (- (%mtp-cpitch e) 21)) | 285 ;; Make sure MIDI value is used |
286 (- (if *cpitch-cents* (/ (%mtp-cpitch e) 100) (%mtp-cpitch e)) | |
287 21)) | |
282 | 288 |
283 (defmethod diatonic-pitch-mp ((e mtp-event)) | 289 (defmethod diatonic-pitch-mp ((e mtp-event)) |
284 ;; MIPS morphetic pitch is relative to An0 while mpitch is relative to Cn2 | 290 ;; MIPS morphetic pitch is relative to An0 while mpitch is relative to Cn2 |
285 (- (%mtp-mpitch e) 12)) | 291 (- (%mtp-mpitch e) 12)) |
286 | 292 |