Files
lilypond-common-includes/private_includes/base/transposition.ily

28 lines
958 B
Plaintext

TRANSPOSITION = #(cons #f #f)
transposeGlobal =
#(define-void-function (from to) (ly:pitch? ly:pitch?)
(if (not (car TRANSPOSITION))
(set! TRANSPOSITION (cons from to))
(let ((current_to (cdr TRANSPOSITION))
(interval (ly:pitch-diff to from)))
(set! TRANSPOSITION (cons (car TRANSPOSITION)
(ly:pitch-transpose current_to interval))))))
transposable =
#(define-music-function (fromto music) (pair? ly:music?)
(if (car fromto)
#{
\transpose #(car fromto) #(cdr fromto) #music
#}
music))
% Akkorde in Strophen transponieren
#(define-markup-list-command (transpose layout props from to markuplist)
(markup? markup? markup-list?)
(define (markup->pitch m)
(ly:assoc-get (string->symbol (markup->string m)) pitchnames))
(interpret-markup-list layout (prepend-alist-chain 'transposition (cons (markup->pitch from) (markup->pitch to)) props) markuplist))