Simon Albrecht-2 wrote
> I’d like to avoid having to synchronise newTonic and newTonicString
> manually, but I’ve been unable to find a convenient way to convert one
> into the other. Can anybody help?
Hi Simon,
This does the job. I might contribute it to the LSR.
Cheers,
-Paul
%%%%%%%%%%%%%%
\version "2.19.12"
pitch-to-string =
#(define-scheme-function (parser location p) (ly:pitch?)
(let*
((pitch-num (ly:pitch-notename p))
(pitch-string (list-ref '("C" "D" "E" "F" "G" "A" "B") pitch-num))
(alt-num (+ 2 (* 2 (ly:pitch-alteration p))))
(alt-string (list-ref '("-Double-Flat" "-Flat" "" "-Sharp"
"-Double-Sharp") alt-num))
(note-string (string-append pitch-string alt-string)))
;; for testing:
;; (display note-string)
note-string))
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-tp167397p167404.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