lilypond-user
[Top][All Lists]
Advanced

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

Re: pitch name transpose into numeric pr key signature


From: MING TSANG
Subject: Re: pitch name transpose into numeric pr key signature
Date: Wed, 24 Oct 2012 09:06:22 -0700 (PDT)

Hi, lily user community

This is my third post on the same subject. First time on Oct 14, Second time on Oct 19.  In the past, I get reply on the same day, and sometime 2 to 3 day later.  I don't know what happpen.

Appreciate someone acknowledge receipt of the post.  Even better tell me is there any solution or it can't be done.

I am seeking to print number beneath the note.  Refer to the png. 
On Key C seems correct on "AA" "BB".
On Key G only "AA" is correct and "BB" is wrong
On Key E-flat, again "AA" is correct, and "BB" is wrong.

Is it possible to resolve the \numer?

The png is produce by test_namer.ly

 
Blessing in+,
Ming.

From: MING TSANG <address@hidden>
To: lilypond-usermailinglist <address@hidden>
Sent: Friday, October 19, 2012 8:54:11 AM
Subject: Re: pitch name transpose into numeric pr key signature

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 <address@hidden>
To: lilypond-usermailinglist <address@hidden>
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+,




Attachment: 2012-10-24_115010.png
Description: PNG image

Attachment: test_namer.ly
Description: Binary data


reply via email to

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