--- music-functions.scm.orig 2013-10-06 19:05:19.000000000 +0200 +++ music-functions.scm 2013-10-24 21:13:35.305128903 +0200 @@ -1328,14 +1328,16 @@ (car alteration-def)) (else 0))) -(define (check-pitch-against-signature context pitch barnum laziness octaveness) +(define (check-pitch-against-signature context pitch barnum laziness octaveness all-naturals) "Checks the need for an accidental and a @q{restore} accidental against @code{localKeySignature}. The @var{laziness} is the number of measures for which reminder accidentals are used (i.e., if @var{laziness} is zero, only cancel accidentals in the same measure; if @var{laziness} is three, we cancel accidentals up to three measures after they first appear. @var{octaveness} is either @code{'same-octave} or @code{'any-octave} and -specifies whether accidentals should be canceled in different octaves." +specifies whether accidentals should be canceled in different octaves. +If @var{all-naturals} is ##t, notes that do not occur in @code{keySignature} +also get an accidental." (let* ((ignore-octave (cond ((equal? octaveness 'any-octave) #t) ((equal? octaveness 'same-octave) #f) (else @@ -1393,7 +1395,7 @@ (let* ((prev-alt (extract-alteration previous-alteration)) (this-alt (ly:pitch-alteration pitch))) - (if (not (= this-alt prev-alt)) + (if (or (and all-naturals (eq? #f previous-alteration)) (not (= this-alt prev-alt))) (begin (set! need-accidental #t) (if (and (not (= this-alt 0)) @@ -1420,7 +1422,13 @@ accidental lasts over that many bar lines. @address@hidden is `forget immediately', that is, only look at key signature. @code{#t} is `forever'." - (check-pitch-against-signature context pitch barnum laziness octaveness)) + (check-pitch-against-signature context pitch barnum laziness octaveness #f)) + +(define-public ((make-accidental-dodecaphonic-rule octaveness laziness) context pitch barnum measurepos) + "Variation on function make-accidental-rule that creates an dodecaphonic +accidental rule." + + (check-pitch-against-signature context pitch barnum laziness octaveness #t)) (define (key-entry-notename entry) "Return the pitch of an @var{entry} in @code{localKeySignature}. @@ -1610,6 +1618,14 @@ `(Staff ,(lambda (c p bn mp) '(#f . #t))) '() context)) + ;; Variety of the dodecaphonic style. Each note gets an accidental, + ;; except notes that were already handled in the same measure. + ((equal? style 'dodecaphonic-first) + (set-accidentals-properties #f + `(Staff ,(make-accidental-dodecaphonic-rule 'same-octave 0)) + '() + 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.