1 %% Do not edit this file; it is auto-generated from input/new
2 %% This file is in the public domain.
3 %% Note: this file works from version 2.12.0
6 %% Translation of GIT committish: 70f455b078620f842672c64c66d87a08158a24ac
7 doctitlees = "Transportar música con el menor número de alteraciones"
9 Este ejemplo utiliza código de Scheme para forzar las
10 modificaciones enarmónicas de las notas, y así tener el menor
11 número de alteraciones accidentales. En este caso se aplican las
16 Se quitan las dobles alteraciones
32 De esta forma se selecciona el mayor número de notas enarmónicas
37 %% Translation of GIT committish: e75f1604a1b866c853dee42dbffcb7800c706a5f
38 doctitlede = "Noten mit minimaler Anzahl an Versetzungszeichen transponieren."
39 texidocde = "Dieses Beispiel benutzt Scheme-Code, um enharmonische
40 Verwechslungen für Noten zu erzwingen, damit nur eine minimale Anzahl
41 an Versetzungszeichen ausgegeben wird. In diesem Fall gelten die
46 Doppelte Versetzungszeichen sollen entfernt werden
62 Auf diese Art werden am meisten natürliche Tonhöhen als enharmonische
68 texidoc = "This example uses some Scheme code to enforce enharmonic
69 modifications for notes in order to have the minimum number of
70 accidentals. In this case, the following rules apply:
74 Double accidentals should be removed
90 In this manner, the most natural enharmonic notes are chosen.
92 doctitle = "Transposing music with minimum accidentals"
96 #(define (naturalize-pitch p)
97 (let* ((o (ly:pitch-octave p))
98 (a (* 4 (ly:pitch-alteration p)))
99 ; alteration, a, in quarter tone steps,
100 ; for historical reasons
101 (n (ly:pitch-notename p)))
103 ((and (> a 1) (or (eq? n 6) (eq? n 2)))
106 ((and (< a -1) (or (eq? n 0) (eq? n 3)))
110 ((> a 2) (set! a (- a 4)) (set! n (+ n 1)))
111 ((< a -2) (set! a (+ a 4)) (set! n (- n 1))))
112 (if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))
113 (if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7))))
114 (ly:make-pitch o n (/ a 4))))
116 #(define (naturalize music)
117 (let* ((es (ly:music-property music 'elements))
118 (e (ly:music-property music 'element))
119 (p (ly:music-property music 'pitch)))
121 (ly:music-set-property!
123 (map (lambda (x) (naturalize x)) es)))
125 (ly:music-set-property!
130 (set! p (naturalize-pitch p))
131 (ly:music-set-property! music 'pitch p)))
135 #(define-music-function (parser location m)
139 music = \relative c' { c4 d e g }
143 \transpose c ais { \music }
144 \naturalizeMusic \transpose c ais { \music }
145 \transpose c deses { \music }
146 \naturalizeMusic \transpose c deses { \music }