-%% Do not edit this file; it is auto-generated from LSR!
-%% Tags: pitches
-\version "2.11.35"
-
-\header { texidoc = "
-There is a way to enforce enharmonic modifications for notes in order
-to have the minimum number of accidentals. In that case, ``Double
-accidentals should be removed, as well as E-sharp (-> F), bC (-> B), bF
-(-> E), B-sharp (-> C).'', as proposed by a request for a new feature.
-In this manner, the most natural enharmonic notes are chosen in this
-example.
-" }
+%% Do not edit this file; it is auto-generated from input/new
+%% This file is in the public domain.
+\version "2.11.38"
+\header {
+ doctitle = "Transposing music with minimum accidentals"
+ lsrtags = "pitches"
+ texidoc = "There is a way to enforce enharmonic modifications for
+notes in order to have the minimum number of accidentals. In that
+case, ``Double accidentals should be removed, as well as E-sharp
+(-> F), bC (-> B), bF (-> E), B-sharp (-> C).'', as proposed by a
+request for a new feature. In this manner, the most natural
+enharmonic notes are chosen in this example. "
+}
% begin verbatim
#(define (naturalise-pitch p)
(let* ((o (ly:pitch-octave p))
- (a (ly:pitch-alteration p))
+ (a (* 4 (ly:pitch-alteration p)))
+ ; alteration, a, in quarter tone steps, for historical reasons
(n (ly:pitch-notename p)))
(cond
(if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))
(if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7))))
- (ly:make-pitch o n a)))
+ (ly:make-pitch o n (/ a 4))))
#(define (naturalise music)
(let* ((es (ly:music-property music 'elements))
(naturalise m))
\score {
- \context Staff {
- \transpose c ais \music
- \naturaliseMusic \transpose c ais \music
+ \new Staff {
+ \transpose c ais \music
+ \naturaliseMusic \transpose c ais \music
+ \break
\transpose c deses \music
\naturaliseMusic \transpose c deses \music
}