Hi, lily user,

Just want to find out how can I fix the problem I have with the following email 
sent on Oct 14.

 
Blessing in+,
Ming.


>________________________________
> From: MING TSANG <[email protected]>
>To: lilypond-usermailinglist <[email protected]> 
>Sent: Sunday, October 14, 2012 6:08:56 PM
>Subject: pitch name transpose into numeric pr key signature
> 
>
>The following snippet did not transpose the pitch name to numbers
>
>
>e.g.  for key g\major the transpose should be:
>     g= 1(do)  a= 2(re)  b= 3(mi)  c= 4(fa)  d= 5(so)  e= 6(la) ff=7(ti)
>
>
>
>I was told to substitute CDEFGAB(namer) for 1234567(numbr) will produce the 
>right numeric.  I appreciate if someone can show me how to fix \numbr so that 
>it will generate proper numeric per key signature.  Attached png file is the 
>output of the snippet.
>
>
>
>%snippet begins
>%
>
>\version "2.17.0"
>\include "english.ly"
>%\include "include_namer.ly"
>namer =
>#(make-engraver
>(acknowledgers
>((note-head-interface engraver grob source)
>(let* ((event (ly:grob-property grob 'cause))
>(pitch (ly:event-property event 'pitch))
>(newgrob (ly:engraver-make-grob engraver 'TextScript event))
>(name (format #f "~a~a"
>(string-ref "CDEFGAB" (ly:pitch-notename pitch))
>(assoc-ref 
>'((-1/2 . "") (0 . "") (1/2 . ""))
>(ly:pitch-alteration pitch)))))
>(if (string= name "Hb")
>(set! name "B"))
>(set! (ly:grob-property newgrob 'text) name)))))
>numbr =
>#(make-engraver
>(acknowledgers
>((note-head-interface engraver grob source)
>(let* ((event (ly:grob-property grob 'cause))
>(pitch (ly:event-property event 'pitch))
>(newgrob (ly:engraver-make-grob engraver 'TextScript event))
>(name (format #f "~a~a"
>(string-ref "1234567" (ly:pitch-notename pitch))
>(assoc-ref 
>'((-1/2 . "") (0 . "") (1/2 . ""))
>(ly:pitch-alteration pitch)))))
>(if (string= name "Hb")
>(set! name "B"))
>(set! (ly:grob-property newgrob 'text) name)))))
>SRxxSSa = \relative c' {
>\clef treble \key c\major
>\set Staff.instrumentName = \markup {\larger "AA"}
>c4 d e f g a b2  | \key g\major g4 a b c d e fs2 | \key ef\major  ef,4 f g af 
>bf c d2 
>}
>SRxxSSb = \relative c' {
>\set Staff.instrumentName = \markup {\larger "BB"}
>\key c\major 
>c4 d e f g a b2  | \key g\major g4 a b c d e fs2 | \key ef\major  ef,4 f g af 
>bf c d2 
>}
>\score{ 
>\new Staff 
>\with {\consists #namer } 
>{ 
>\SRxxSSa 
>}
>\layout {}
>}
>\score{ 
>\new Staff 
>\with {\consists #numbr } 
>{ 
>\SRxxSSb 
>}
>\layout {}
>}
>%
>%snippet ends
>
> 
>Blessing in+,
>
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to