From: Eluze 
Subject: Re: consolidate code 
Date: Tue, 11 Feb 2014 11:57:54 -0800 (PST) 
________________________________

MING TSANG wrote
>I hope the attached .ly file qualifies as tiny snippet. >>certainly not - 
>please reduce it to one or two notes to show the >>unexpected
>>behavior, and define clearly what you'd expect!
I reduce the six variables to three; six bars note to 3 bars. I want to 
demonstrate the problem and what I expect. I expect all numbers on top of 
solfege ( s, so; f, fa). >Any help or suggestion is appreciated.  I don't know 
scheme code. I do not >under what the code is doing except they display numbers 
or solfege.  >>you could at least specify where the code you use is coming from!
I don't recall where and when I got the original code. It was since v2.15 not 
v1.15 as I mention on my original post. >>thanks!
>>Eluze
Here is the revise .ly and .pdf
\version "2.19.2"


  %\include "include_solfege.ly"      %  \new Satff \with { \consists | #solfegeUP  | #solfegeU  |  #solfegeDOWNN  | #solfegeD   }  OR  \zup \xup xdown zdown
solfegeUP = #(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 '("do" "re" "mi" "fa" "so" "la" "ti") delta))
      (newgrob (ly:engraver-make-grob engraver 'TextScript event)))
    (if (string= name "Hb")  (set! name "B"))
   (set! (ly:grob-property newgrob 'text) name)
   (set! (ly:grob-property newgrob 'direction) UP) ))))



xup=\with { \consists #solfegeUP }



solfegeU = #(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 '("d" "r" "m" "f" "s" "l" "t") delta))
      (newgrob (ly:engraver-make-grob engraver 'TextScript event)))
    (if (string= name "Hb")  (set! name "B"))
   (set! (ly:grob-property newgrob 'text) name)
   (set! (ly:grob-property newgrob 'direction) UP) ))))



zup=\with { \consists #solfegeU }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  \include "include_numbrs.ly"     %   \new Staff \with { \consists #numbrUP }    #nmubrDOWN   OR  \nup   \ndown 
numbrUP = #(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 '("1" "2" "3" "4" "5" "6" "7") delta))
      (newgrob (ly:engraver-make-grob engraver 'TextScript event)))
    (if (string= name "Hb")  (set! name "B"))
   (set! (ly:grob-property newgrob 'text) name)
   (set! (ly:grob-property newgrob 'direction) UP) ))))



nup=\with { \consists #numbrUP }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


soprano = {
  g'1 | %m12
   
   
  g'4 g'8.g'16 a'2 |%m15
  f'1  }
alto = {
  e'1 |%m12

  e'2 e'2 |%m15
  c'1|%m16
}

\score {
  \new Staff \with {
  }
  <<
    \new Voice = "soprano"  \xup   {   \voiceOne   \soprano  }
    \new Voice = "alto"  \nup { \voiceTwo   \alto  }  
  >>
  \layout { }

}


\score {
  \new Staff \with {
  }
  <<
    \new Voice = "soprano"  \zup   {   \voiceOne   \soprano  }
    \new Voice = "alto"  \nup { \voiceTwo   \alto  }  
  >>
  \layout { }

}

Attachment: test_num-solfege(1).pdf
Description: Adobe PDF document

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

Reply via email to