[CM] Fixed(?) :CMN key signature, bar lines, and accidentals
Larry Troxler
lt at westnet.com
Sat Dec 28 14:10:04 PST 2002
I think I got this thing working - here's a modified CMN function that
seems to work for me,
in case anybody is doing CM to CMN transcriptions or the like.
Of course this is just a temporary patch because I don't understand how
the accidental notation is actually intended to work.
Larry
~ ~ ~
(in-package cmn)
(defun check-note-for-needed-natural (object current-accidentals
current-key-signature-accidentals current-durations cancel octaves)
(let ((this-cclass (cclass object))
(this-sign (note-sign object))
(tied (and (ties object) (find :right (ties object) :key #'tie-type))))
(when (not tied)
(if (aref current-accidentals this-cclass)
(if (not this-sign)
(if (not (eq (aref current-key-signature-accidentals this-cclass)
(aref current-accidentals this-cclass)))
(if (not (aref current-key-signature-accidentals this-cclass))
(if (not (eq (aref current-accidentals this-cclass) natural))
(setf (note-sign object) natural))
(setf (note-sign object) (aref current-key-signature-accidentals
this-cclass))))
(if (and cancel
;; now look for redundant accidental -- the problem with this
version is that
;; it will leave in accidentals that are technically redundant
if the same
;; pitch occurs in a different octave in between, and that
makes (for example)
;; repeated octave jumps kinda fussy looking.
(eq this-sign (aref current-accidentals this-cclass))
(/= (aref octaves this-cclass) -1)
(= (aref octaves this-cclass) (octave object)))
(setf (note-sign object) nil)))
(progn
;;; From Larry Troxler: I don't understand what this form does; I
leave it in
;;; because for my personal use, it will never get hit.
(if (and (aref current-key-signature-accidentals this-cclass)
(not this-sign))
(progn
;; bug fix thanks to Jin S. Choi 3-Nov-96
;; (setf this-sign natural)
;; (setf (note-sign object) natural))))
(setf this-sign (or (aref current-key-signature-accidentals
this-cclass) natural))
(if (not cancel) (setf (note-sign object) this-sign))))
;;; From Larry Troxler: This seems to fix my problem of accidentals
being redundantly
;;; notated although they are in the current key signature.
(if (and cancel
this-sign
(eq (or (aref current-key-signature-accidentals this-cclass)
natural) this-sign))
(setf (note-sign object) nil)))))
(setf (aref octaves this-cclass) (octave object))
(setf (aref current-durations this-cclass) 0)
(setf (aref current-accidentals this-cclass) this-sign)))
(defun cmn-acc-test ()
(cmn (automatic-naturals t) (redundant-accidentals nil) staff treble
g-major (meter 4 4)
cs4 cs4 cs5 cs4
fs5 fn5 ef5 fs4
dn4 ds4 dn4 fs4
ds4 dn4 dn4 ds4))
~ ~ ~
More information about the Cmdist
mailing list