Just for fun, another version, more compact, probably more cryptic:
%%%%%%%%%%%%%%
\version "2.19.12"
pitch-to-string =
#(define-scheme-function (parser location p) (ly:pitch?)
(string-append
(list-ref '("C" "D" "E" "F" "G" "A" "B")
(ly:pitch-notename p))
(list-ref '("-Double-Flat" "-Flat" "" "-Sharp" "-Double-Sharp")
(+ 2 (* 2 (ly:pitch-alteration p))))))
newTonic = d
newTonicString = \pitch-to-string \newTonic
% for testing:
#(display (string-append "in-" newTonicString))
\bookOutputSuffix #(string-append "in-" newTonicString)
\score { \transpose c \newTonic { c' } }
%%%%%%%%%%%%%%
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/ly-pitch-and-string-tp167397p167405.html
Sent from the User mailing list archive at Nabble.com.
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user