Notationsspezifisch > Noten für Schlagzeug

Ghost Notes Global Ändern

<< < (3/3)

harm6:
Hallo Arnold,


--- Zitat ---Ich sehe drei praktikable Wege für diese Veränderungen
--- Ende Zitat ---

Ich hab' alle diese Wege mal ausprobiert, hier rumgedoktort, dort versucht etc., letztlich alles ohne Erfolg.

Also habe ich einen vierten Weg beschritten:

Ich habe mir ein paar properties definiert, und einen Engraver.
Das schöne ist, daß es absolut variabel einsetzbar ist. Man kann selektiv vorgehen oder global. Man kann das ParenthesesItem löschen oder auch nicht.
Im Moment sehe ich nur Vorteile. Aber natürlich steht ein Test mit einem größeren Musikstück noch aus.


--- Code: ---\version "2.14.2"
           
#(define (define-grob-custom-property symbol type? description)
  (if (not (equal? (object-property symbol 'backend-doc) #f))
      (ly:error (_ "symbol ~S redefined") symbol))

    (set-object-property! symbol 'backend-type? type?)
    (set-object-property! symbol 'backend-doc description)
    symbol)

#(define all-user-grob-custom-properties
   (map
     (lambda (x)
       (apply define-grob-custom-property x))

     `(
       (smaller-not-parenthesize-note-heads ,boolean? "boolean for making smaller parenthesized NoteHeads")
       (color-not-parenthesize-note-heads ,boolean? "boolean for coloring parenthesized NoteHeads")
       (transparent-not-parenthesize-note-heads ,boolean? "boolean for making transparent parenthesized NoteHeads")
       (new-stencil-not-parenthesize-note-heads ,boolean? "boolean for making a new stencil for parenthesized NoteHeads")
       (un-parenthesize ,boolean? "boolean for un-parenthesize NoteHeads")
     )))
     
#(define (new-stil grob)
   (grob-interpret-markup grob (markup
      #:with-color red
      #:fontsize -2
      #:rotate -90 ":)")))
     
AffectParenthesizedNoteHeadsEngraver =
#(lambda (context)
    `((acknowledgers
      (note-head-interface .
        ,(lambda (engraver grob source-engraver)
          (if (not (null? (ly:event-property (event-cause grob) 'parenthesize)))
              (cond ((eq? #t (ly:grob-property grob 'smaller-not-parenthesize-note-heads))
                     (set! (ly:grob-property grob 'font-size) -3))
                    ((eq? #t (ly:grob-property grob 'color-not-parenthesize-note-heads))
                     (set! (ly:grob-property grob 'color) (x11-color 'grey66)))
                    ((eq? #t (ly:grob-property grob 'transparent-not-parenthesize-note-heads))
                     (set! (ly:grob-property grob 'transparent) #t))
                    ((eq? #t (ly:grob-property grob 'new-stencil-not-parenthesize-note-heads))
                     (set! (ly:grob-property grob 'stencil) new-stil))
                    (else #f))
              #f)))
      (parentheses-interface .
        ,(lambda (engraver grob source-engraver)   
          (if (eq? #t (ly:grob-property grob 'un-parenthesize))
            (ly:grob-suicide! grob)
            #f))))))

%--- Test --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

myLayoutI = \layout {
  \context {
    \Voice
    \override NoteHead #'smaller-not-parenthesize-note-heads = ##t
    \override ParenthesesItem  #'un-parenthesize = ##t
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}

myLayoutII = \layout {
  \context {
    \Voice
    \override NoteHead #'color-not-parenthesize-note-heads = ##t
    \override ParenthesesItem  #'un-parenthesize = ##t
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}

myLayoutIII = \layout {
  \context {
    \Voice
    \override NoteHead #'transparent-not-parenthesize-note-heads = ##t
    \override ParenthesesItem  #'un-parenthesize = ##t
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}

myLayoutIV = \layout {
  \context {
    \Voice
    \override NoteHead #'new-stencil-not-parenthesize-note-heads = ##t
    \override ParenthesesItem  #'un-parenthesize = ##t
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}

myLayoutV = \layout {
  \context {
    \DrumStaff
    \override NoteHead #'smaller-not-parenthesize-note-heads = ##t
    \override ParenthesesItem  #'un-parenthesize = ##t
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}

myLayoutVI = \layout {
  \context {
    \DrumStaff
    \override NoteHead #'color-not-parenthesize-note-heads = ##t
    \override ParenthesesItem  #'un-parenthesize = ##t
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}

myLayoutVII = \layout {
  \context {
    \DrumStaff
    \override NoteHead #'transparent-not-parenthesize-note-heads = ##t
    \override ParenthesesItem  #'un-parenthesize = ##t
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}

myLayoutVIII = \layout {
  \context {
    \DrumStaff
    \override NoteHead #'new-stencil-not-parenthesize-note-heads = ##t
    \override ParenthesesItem  #'un-parenthesize = ##t
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}

music = \relative c' {
  <fis \parenthesize d'>4
  <g \parenthesize d'>
}

\score {
        \new Staff
\relative c' {
  \once\override NoteHead #'smaller-not-parenthesize-note-heads = ##t
  \once\override ParenthesesItem  #'un-parenthesize = ##t
  \music
 
  \once\override NoteHead #'color-not-parenthesize-note-heads = ##t
  \once\override ParenthesesItem  #'un-parenthesize = ##t
  \music
 
  \once\override NoteHead #'transparent-not-parenthesize-note-heads = ##t
  \once\override ParenthesesItem  #'un-parenthesize = ##t
  \music
 
  \once\override NoteHead #'new-stencil-not-parenthesize-note-heads = ##t
  \once\override ParenthesesItem  #'un-parenthesize = ##t
  \music
}
\layout {
  \context {
    \Voice
    \consists \AffectParenthesizedNoteHeadsEngraver
  }
}
}

\score {
        \new Staff <<
        \new Voice { \voiceOne \music }
        \new Voice \transpose c c, { \voiceTwo \music }
          >>
\layout {
        \myLayoutI
}
}

#(define mydrums '(
      (bassdrum      default            #f         -5)
      (snare         default            #f          0)
      (hihat         cross            #f          5)
      (pedalhihat      cross            #f         -3)
      (openhihat      xcircle            #f          5)
      (lowtom         default            #f          1)
      (hightom      default            #f          3)
      (lowfloortom   default            #f         -1)
      (ridecymbal      harmonic-black      #f          6)
      (ridebell      harmonic-black      #f          5)
      (crashcymbal   harmonic-black      #f          7)
      )
)

oben = \drummode {
\numericTimeSignature
\time 4/4
   {
   \override TextScript #'script-priority = #100
   cymc8\upbow rb
   rb16 rb16 rb8
   rb8 rb16 rb16
   rb8 rb16 rb16
   }
}

unten = \drummode
   {
   %\override Beam #'damping = #+inf.0
   \override Beam #'positions = #'(-5 . -5)
   bd16 hhp sn hhp
   sn16 hhp8 < sn hhp >16
   bd16 <  \parenthesize  sn hhp >16 << \parenthesize sn >> hhp
   r16 << sn8 hhp >> hhp16
   }

\score {
        \new DrumStaff <<
          \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
          \new DrumVoice { \voiceOne \oben }
          \new DrumVoice { \voiceTwo \unten }
        >>
\layout {
        \myLayoutVIII
}
}
--- Ende Code ---

Getestet mit "2.14.2" und "2.15.33"


Gruß,
  Harm

P.S. Das Problem wie man vom NoteHead-grob zum ParenthesesItem-grob kommt, wenn man 'before-line-breaking benutzt, bleibt natürlich ungelöst, es wird schlichtweg umgangen.

harm6:
Hallo,

in meinem Eifer meinen zweiten custom-scheme-engraver zu vollenden habe ich übersehen, daß ich (soweit es das ParenthesesItem betrifft) eigentlich nur den Befehl \override ParenthesesItem #'stencil = ##f dupliziert hatte.

Hier nun die verbesserte Fassung.
Man kann jetzt auch die Eigenschaften der Änderungen anpassen, indem man die Werte aus change-parenthesized-note-heads-alist verändert.
Alle neu definierten properties sind sowohl im \override als auch im \tweak einsetzbar. Kombinationen sind ebenfalls möglich.


Gruß,
  Harm

Arnold:
Ja, Harm,

an den vierten Weg habe ich zwar noch gedacht, aber nicht gewagt ihn zu erwähnen. Ich hielt einen neuen Engraver damals für ein »ne Nummer zu groß«.

Hast du jemanls schon \musicMap ausprobiert? Das wäre vielleicht auch ein Lösungsansatz gewesen (als Music-Funktion). Leider ist die Beschreibung in den Handbüchern mehr als dürftig. Diese Funktion scheint in »articulate.ly« benutzt zu sein.

Arnold

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln