>From 9f784c97afa35d0bcfca1d0f3b5cda08fa767dff Mon Sep 17 00:00:00 2001 From: David Nalesnik Date: Mon, 10 Feb 2014 13:06:55 +0100 Subject: [PATCH 1/2] Issue 3856: dodecaphonic-no-repeat accidentalStyle This adds an accidental style that works like the dodecaphonic style except that it does _not_ print an accidental if the note is in the same voice immediately preceded with a note of the same pitch. --- scm/music-functions.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index c7f41ea..72005f9 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -1591,6 +1591,21 @@ look at bar lines nor different accidentals at the same note name." (cons #f (not (or (equal? acc key-acc) (and (equal? entrybn barnum) (equal? entrymp measurepos))))))))) +(define-public (dodecaphonic-no-repeat-rule context pitch barnum measurepos) + "An accidental rule that typesets an accidental before every note +(just as in the dodecaphonic accidental style) @emph{except} if the note +is immediately preceded by a note with the same pitch. This is a common +accidental style in contemporary notation." + (let* ((keysig (ly:context-property context 'localKeySignature)) + (entry (find-pitch-entry keysig pitch #t #t))) + (if (not entry) + (cons #f #t) + (let* ((entrymp (key-entry-measure-position entry)) + (entrybn (key-entry-bar-number entry))) + (cons #f + (not + (and (equal? entrybn barnum) (equal? entrymp measurepos)))))))) + (define-public (teaching-accidental-rule context pitch barnum measurepos) "An accidental rule that typesets a cautionary accidental if it is included in the key signature @emph{and} does not directly follow a note @@ -1701,6 +1716,14 @@ as a context." `(Staff ,(lambda (c p bn mp) '(#f . #t))) '() context)) + ;; As in dodecaphonic style with the exception that immediately + ;; repeated notes (in the same voice) don't get an accidental + ((equal? style 'dodecaphonic-no-repeat) + (set-accidentals-properties #f + `(Staff ,(make-accidental-rule 'same-octave 0) + ,dodecaphonic-no-repeat-rule) + '() + context)) ;; Multivoice accidentals to be read both by musicians playing one voice ;; and musicians playing all voices. ;; Accidentals are typeset for each voice, but they ARE canceled across voices. -- 1.7.10.4