Le Sun, 28 Oct 2012 23:16:34 +0100, MING TSANG <tsan...@rogers.com> a
écrit:
(let* ...
(scalestep (modulo
(- (ly:pitch-notename pitch) (...base of key signature...)) 7))
(name (format #f "~a~a"
(string-ref "1234567" (scalestep))...
If i well understand what you want, there is a snippet very near of what
you are searching.
http://lsr.dsi.unimi.it/LSR/Snippet?id=818
The code below is a "mix" of the code you gave and this snippet.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numbr = #(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)))
(set! (ly:grob-property newgrob 'text) name)))))
music = \relative c' {
\key c\major c4 d e f g a b2 |\break
\key g\major g4 a b c d e fs2 | \break
\key ef\major ef,4 f g af bf c d2 | \break
\key d \major d,4 e fs g a b cs2 | \break
\key cf\major cf,4 df ef ff gf af bf2 | \break
}
\score{
\new Staff \with {\consists #numbr }
\music
\layout {}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--
Gilles
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user