lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add dodecaphonic-first accidental style (issue 79680044)


From: lilyliska
Subject: Add dodecaphonic-first accidental style (issue 79680044)
Date: Tue, 25 Mar 2014 11:02:53 +0000

Reviewers: ,

Description:
Add dodecaphonic-first accidental style

This accidental style assigns accidentals to _all_ pitches
(just as dodecaphonic does) but remembers them throughout
a whole measure.
This style is useful for different styles of contemporary notation
that want to make use of the non-tonal dodecaphonic style but don't
want to print so many redundant accidentals.

Please review this at https://codereview.appspot.com/79680044/

Affected files (+80, -4 lines):
  M Documentation/notation/pitches.itely
  M scm/music-functions.scm


Index: Documentation/notation/pitches.itely
diff --git a/Documentation/notation/pitches.itely b/Documentation/notation/pitches.itely index 5d246864207020a5f270a305aa6e496792619f4e..b5cc66246d5856e4f609528fb5aa964d587bc704 100644
--- a/Documentation/notation/pitches.itely
+++ b/Documentation/notation/pitches.itely
@@ -2502,6 +2502,66 @@ musicB = {
 @end lilypond


address@hidden dodecaphonic-first
+
address@hidden dodecaphonic accidental style
address@hidden dodecaphonic style, neo-modern
+
address@hidden dodecaphonic-first
+
+Similar to the dodecaphonic accidental style @emph{every} pitch
+gets an accidental sign, but only the first time it is encountered
+in a measure.  Accidentals are only remembered for the actual octave
+but throughout voices.
+
address@hidden
+musicA = {
+  <<
+    \relative c' {
+      cis'8 fis, bes4 <a cis>8 f bis4 |
+      cis2. <c, g'>4 |
+    }
+    \\
+    \relative c' {
+      ais'2 cis, |
+      fis8 b a4 cis2 |
+    }
+  >>
+}
+
+musicB = {
+  \clef bass
+  \new Voice {
+    \voiceTwo \relative c' {
+      <fis, a cis>8[ <fis a cis>
+      \change Staff = up
+      cis' cis
+      \change Staff = down
+      <fis, a> <fis a>]
+      \showStaffSwitch
+      \change Staff = up
+      dis'4 |
+      \change Staff = down
+      <fis, a cis>4 gis <f a d>2 |
+    }
+  }
+}
+
+\new PianoStaff {
+  <<
+    \context Staff = "up" {
+      \accidentalStyle dodecaphonic-first
+      \musicA
+    }
+    \context Staff = "down" {
+      \accidentalStyle dodecaphonic-first
+      \musicB
+    }
+  >>
+}
address@hidden lilypond
+
+
 @item teaching

 @cindex teaching accidental style
Index: scm/music-functions.scm
diff --git a/scm/music-functions.scm b/scm/music-functions.scm
index c77c1dc6fbbff36e50caec2fac3acf04e81ec988..068376e6a713492f61864b277fe2a755f6970d94 100644
--- a/scm/music-functions.scm
+++ b/scm/music-functions.scm
@@ -1419,14 +1419,16 @@ Returns @code{#f} or the reason for the invalidation, a symbol."
          (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
@@ -1484,7 +1486,7 @@ specifies whether accidentals should be canceled in different octaves."
         (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))
@@ -1511,7 +1513,13 @@ is, to the end of current measure. A positive integer means that the
 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}.
@@ -1724,6 +1732,14 @@ as a context."
                                           ,dodecaphonic-no-repeat-rule)
                                           '()
                                           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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]