lilypond-user
[Top][All Lists]
Advanced

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

Re: voice solfege sequence


From: Thomas Morley
Subject: Re: voice solfege sequence
Date: Sun, 20 Apr 2014 03:23:26 +0200

2014-04-19 23:25 GMT+02:00 MING TSANG <address@hidden>:
> Hi, lilyponders:
> The attach .ly file show the sequencing of solfege above the staff behaves
> inconsistent.
> How can this be resolved?  I am also hoping it will be the same if it is
> sequencing below the staff. The color solfege will be showing on the lower
> stack in both case.
> Help is appreciated.
> Emmanuel,
> Ming



Hi Ming,

the solfege-engraver creates a new TextScript-grob, I think the
properties are (partly) taken from the NoteHead.
Meaning that color persists in some cases and, if the NoteHeads part
of a chord, two TextSript-grobs are created with the same
outside-staff-priority. How they are printed is more or less
unpredictable.

Below I try to assign each Textscript a different
outside-staff-priority according to the staff-position of the
NoteHead.
I found no convincing method to set the color for the TextScript, though.
I used a workaround, hoping someone else comes up with a better solution.

#(define (solfege-engraver lst dir)
   (make-engraver
     (acknowledgers
      ((note-head-interface engraver grob source)
       (let* (
              (context (ly:translator-context engraver))
              (tonic-pitch (ly:context-property context 'tonic))
              (tonic-index (ly:pitch-notename tonic-pitch))
              (event (ly:grob-property grob 'cause))
              (grob-pitch (ly:event-property event 'pitch))
              (grob-index (ly:pitch-notename grob-pitch))
              (delta (modulo (- grob-index tonic-index) 7))
              (name (list-ref lst delta))
              (newgrob (ly:engraver-make-grob engraver 'TextScript event)))

         (if (string= name "Hb")  (set! name "B"))
         ;; Give newgrob 'outside-staff-priority depending on
         ;; grob 'staff-position
         (set! (ly:grob-property newgrob 'outside-staff-priority)
               (+ (ly:grob-property newgrob 'outside-staff-priority)
                  (* dir (ly:grob-property grob 'staff-position))))
         (set! (ly:grob-property newgrob 'text)
               ;; Ugh, color is taken from grob in some cases.
               ;; How to clear for newgrob?
               ;; workaround:
               (markup #:with-color black name))
         (set! (ly:grob-property newgrob 'direction) dir) )))))

HTH,
  Harm



reply via email to

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