]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/lsr/transposing-pitches-with-minimum-accidentals-smart-transpose.ly
Merge commit 'ce4b499'
[lilypond.git] / input / lsr / transposing-pitches-with-minimum-accidentals-smart-transpose.ly
index 69d3e3af7a2c88c2da54ff1b4d0ad98b31257945..4bce592109fad2cf31c3fe33d01aa3d6304bcec1 100644 (file)
@@ -1,20 +1,21 @@
-%% Do not edit this file; it is auto-generated from LSR http://lsr.dsi.unimi.it
+%% Do not edit this file; it is auto-generated from input/new
 %% This file is in the public domain.
-%% 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.
-}
+\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
@@ -32,7 +33,7 @@ example.
     (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))
@@ -64,9 +65,10 @@ naturaliseMusic =
                        (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
   }