comparison implementations/mtp/methods.lisp @ 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 dc01096751af
children 7ce34ccdcbda
comparison
equal deleted inserted replaced
81:4e1538df0d10 82:92e6625473e2
25 (make-mtp-composition-identifier dataset-id composition-id)) 25 (make-mtp-composition-identifier dataset-id composition-id))
26 compositions)) 26 compositions))
27 (sequence:adjust-sequence dataset (length compositions) 27 (sequence:adjust-sequence dataset (length compositions)
28 :initial-contents (nreverse compositions)) 28 :initial-contents (nreverse compositions))
29 dataset)) 29 dataset))
30
31
30 32
31 (defmethod get-composition ((identifier mtp-composition-identifier)) 33 (defmethod get-composition ((identifier mtp-composition-identifier))
32 (let* ((dataset-id (dataset-id identifier)) 34 (let* ((dataset-id (dataset-id identifier))
33 (composition-id (composition-id identifier)) 35 (composition-id (composition-id identifier))
34 (where-clause [and [= [dataset-id] dataset-id] 36 (where-clause [and [= [dataset-id] dataset-id]
201 (make-chromatic-pitch (%mtp-cpitch e))) 203 (make-chromatic-pitch (%mtp-cpitch e)))
202 204
203 (defmethod midi-pitch-number ((e mtp-event)) 205 (defmethod midi-pitch-number ((e mtp-event))
204 (%mtp-cpitch e)) 206 (%mtp-cpitch e))
205 207
208 (defmethod meredith-morphetic-pitch-number ((e mtp-event))
209 ;; MIPS morphetic pitch is relative to An0 while mpitch is relative to Cn2
210 (- (%mtp-mpitch e) 12))
211
212 (defmethod mips-pitch ((e mtp-event))
213 (make-mips-pitch (meredith-chromatic-pitch-number e)
214 (meredith-morphetic-pitch-number e)))
215
206 (defmethod diatonic-pitch ((e mtp-event)) 216 (defmethod diatonic-pitch ((e mtp-event))
207 ;; (make-diatonic-pitch (event-mpitch e) 217 (diatonic-pitch (mips-pitch e)))
208 ;; (event-accidental e) 218
209 ;; octave) 219 #.(clsql:locally-enable-sql-reader-syntax)
210 ) 220 (defmethod middle-c ((e mtp-event))
221 (let ((cpitch (car (clsql:select [midc] :from [dataset]
222 :where [= [dataset-id] (dataset-id e)]
223 :flatp t :field-names nil))))
224 (make-mtp-event :cpitch cpitch :mpitch (* (/ cpitch 12) 7))))
225 #.(clsql:restore-sql-reader-syntax-state)
211 226
212 ;;; Phrase boundaries 227 ;;; Phrase boundaries
213 228
214 (defmethod boundary-strength ((s mtp-before-segmenter) (e mtp-event) c) 229 (defmethod boundary-strength ((s mtp-before-segmenter) (e mtp-event) c)
215 (declare (ignore s c)) 230 (declare (ignore s c))