[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ly:pitch and string
From: |
Paul Morris |
Subject: |
Re: ly:pitch and string |
Date: |
Fri, 10 Oct 2014 14:28:28 -0700 (PDT) |
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.
- ly:pitch and string, Simon Albrecht, 2014/10/10
- Re: ly:pitch and string,
Paul Morris <=
- Re: ly:pitch and string, Paul Morris, 2014/10/10
- Re: ly:pitch and string, Simon Albrecht, 2014/10/10
- Re: ly:pitch and string, Simon Albrecht, 2014/10/10
- Re: ly:pitch and string, Paul Morris, 2014/10/11
- Re: ly:pitch and string, Simon Albrecht, 2014/10/12
- Re: ly:pitch and string, Paul Morris, 2014/10/12
Re: ly:pitch and string, David Kastrup, 2014/10/11