X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Fnew%2Ftransposing-pitches-with-minimum-accidentals-smart-transpose.ly;h=1ff8444f55d09245840be2912d5a2addecc70331;hb=5b2bdf8c532aa1b4aa8626f6847938f2ef4ba1be;hp=40bf9fb6640835ef7038f16b305e350fc1d5680b;hpb=5dddfa650f757c775b5ce062183d2061af4ae8d0;p=lilypond.git diff --git a/input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly b/input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly index 40bf9fb664..1ff8444f55 100644 --- a/input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly +++ b/input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly @@ -1,4 +1,4 @@ -\version "2.11.33" +\version "2.12.0" \header { lsrtags = "pitches" texidoc = "This example uses some Scheme code to enforce enharmonic @@ -31,7 +31,8 @@ In this manner, the most natural enharmonic notes are chosen. #(define (naturalize-pitch p) (let* ((o (ly:pitch-octave p)) (a (* 4 (ly:pitch-alteration p))) - ; alteration, a, in quarter tone steps, for historical reasons + ; alteration, a, in quarter tone steps, + ; for historical reasons (n (ly:pitch-notename p))) (cond ((and (> a 1) (or (eq? n 6) (eq? n 2))) @@ -52,32 +53,32 @@ In this manner, the most natural enharmonic notes are chosen. (e (ly:music-property music 'element)) (p (ly:music-property music 'pitch))) (if (pair? es) - (ly:music-set-property! + (ly:music-set-property! music 'elements (map (lambda (x) (naturalize x)) es))) (if (ly:music? e) - (ly:music-set-property! + (ly:music-set-property! music 'element (naturalize e))) (if (ly:pitch? p) - (begin - (set! p (naturalize-pitch p)) - (ly:music-set-property! music 'pitch p))) + (begin + (set! p (naturalize-pitch p)) + (ly:music-set-property! music 'pitch p))) music)) naturalizeMusic = #(define-music-function (parser location m) - (ly:music?) - (naturalize m)) + (ly:music?) + (naturalize m)) music = \relative c' { c4 d e g } \score { \new Staff { - \transpose c ais \music - \naturalizeMusic \transpose c ais \music - \transpose c deses \music - \naturalizeMusic \transpose c deses \music + \transpose c ais { \music } + \naturalizeMusic \transpose c ais { \music } + \transpose c deses { \music } + \naturalizeMusic \transpose c deses { \music } } \layout { } }