lilypond-user
[Top][All Lists]
Advanced

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

Re: pitch name transpose into numeric per key signature


From: MING TSANG
Subject: Re: pitch name transpose into numeric per key signature
Date: Sun, 28 Oct 2012 15:16:34 -0700 (PDT)

   (let* ...
             (scalestep (modulo
                       (- (ly:pitch-notename pitch) (...base of key signature...)) 7))
             (name (format #f "~a~a"
                    (string-ref "1234567" (scalestep))...

assuming someone can point out what to substitute for my unknown quantity. The following is only work for C Major.  It is not working for other keys.  I am no programer. I don't know how to code for blue text above.

the original code:
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 "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)))))

 
Blessing in+,

reply via email to

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