On 03/24/2014 01:50 PM, Gilberto Agostinho wrote:> Gilberto Agostinho wrote
The correct syntax is with the "s" [...]

I meant without.... without the "s", as in "repeat" and NOT "repeats"
Rutger Hofman-2 wrote
[...]
As a fix, I made a small addition to music-functions.scm to add a
dodecaphonic-first accidental style. Patch against 2.17.18-1 attached.
[...]
Using dodecaphonic-first and adding ! here and there works fine for me.

I already apologize for replying to an old post (almost 1 year old!), but I
am really interested in this dodecaphonic-first accidental style. The
problem is I do not know how to deal with this .patch file!

Right, so there is a new style dodecaphonic-no-repeat from 2.19.3 onwards. But it does something else than the style dodecaphonic-first that I wrote about, long ago. dodecaphonic-no-repeat suppresses accidentals for immediately repeated notes. dodecaphonic-first suppresses accidentals for any notes that already occurred earlier in the bar. My opinion is that there is still good use for dodecaphonic-first; the main reason is that wiping out undesired accidentals leaves visible traces because it consumes horizontal space, whereas adding occasional forced accidentals works fully as desired.

I would love it if the dodecaphonic-first style can be patched into lilypond; not only for the Greater Good, but also to relieve me from applying it to each and every lilypond release, and maintaining it across changes...

I renewed the patch for versions from 2.19.3 upwards. It is attached (pre-2.19.3 and 2.19.3 onwards; it used to be a reverse-patch, no longer now). It is extremely small. I also keep it in my github repo for lilypond additions, in the patches/ dir:

https://github.com/rfhh/lily-contribs

That repo currently also contains my converter from NIFF to lilypond (and the NIFF sdk, with 64-bit patch), and an upgraded version of Han-Wen's pmx2ly converter that I used to prepare an edition of Bach's BWV 146/1052a (on IMSLP).

Rutger





--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/dodecaphonic-first-accidental-style-tp141907p160773.html
Sent from the User mailing list archive at Nabble.com.

_______________________________________________
lilypond-user mailing list
lilypond-u...@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


--- 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.  @w{@code{-1}} 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.
--- music-functions.cm.orig	2014-03-02 18:02:01.000000000 +0100
+++ music-functions.scm	2014-03-24 15:16:43.496269260 +0100
@@ -1419,14 +1419,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
@@ -1484,7 +1486,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))
@@ -1511,7 +1513,13 @@
 accidental lasts over that many bar lines.  @w{@code{-1}} 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 @@
                                           ,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.
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to