]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/test/improv.ly
*** empty log message ***
[lilypond.git] / input / test / improv.ly
index ff350187ec6995bba63c0d8921240376178fb8b6..1f3e201f1c18eb2b337bd8c8480fce24c52f2068 100644 (file)
@@ -1,46 +1,51 @@
+\version "2.2.0"
+\header {
 
-improOn = \notes {\translator Voice = impro }
-improOff = \notes {\translator SquashVoice = melo }
+    texidoc =
+"
 
-global = \notes { s1*3 \bar "|."; }
+In improvisation, noteheads do not have a pitch, and have different
+shapes. In this example, this is achieved by adding
+@code{Pitch_squash_engraver} and setting @code{squashedPosition} when the
+improvisation is active.
+
+"
+
+}
+
+
+improOn = \notes {
+    \set squashedPosition = #0
+    \override NoteHead  #'style = #'slash
+}
+
+improOff = \notes {
+    \unset squashedPosition 
+    \revert NoteHead #'style
+}
+
+global = \notes { s1*3 \bar "|." }
 
 \score {
-  <
-    \context ChordNames \chords {e8:m7*7 a2.:m7 bes4:m7 b1:m7 e8:m }
-    \context Staff \notes <
-      \context SquashVoice = impro { \global }
-      \context Voice = melo \transpose c'' {
-       e8 e g a a16()bes()a8 g \improOn e8
-       ~e2~e8 f4 fis8
-       ~fis2 \improOff a16()bes a8 g e
-      }
-    >
-  >
-  \paper { 
-    \translator {
-      \VoiceContext
-      \name SquashVoice;
-      \alias Voice;
-      \consists Pitch_squash_engraver;
-      \consists Local_key_engraver;
-      squashedPosition = 6;
-      NoteHead \override #'style = #'slash
-      Accidentals \override #'transparent = ##t
-    }
-    \translator {
-      \VoiceContext
-      \alias SquashVoice;
-      \consists Local_key_engraver;
+    <<
+       \context ChordNames \chords {
+           e8*7:m7 a2.:m7 bes4:m7 b1:m7 e8:m
+       }
+       \notes <<
+           \context Voice = melo \transpose c c' {
+               e8 e g a a16(bes)(a8) g \improOn
+               e8
+               ~e2~e8 f4 fis8
+               ~fis2 \improOff a16(bes) a8 g e
+           }
+       >>
+    >>
+    \paper { 
+       \context {
+           \VoiceContext
+           \consists Pitch_squash_engraver
+       }
+       raggedright = ##t
     }
-    \translator {
-      \ScoreContext
-      \accepts SquashVoice;
-    }
-    \translator {
-      \StaffContext
-      \remove Local_key_engraver;
-      \accepts SquashVoice;
-    }
-    linewidth = -1;
-  }
 }
+