]> git.donarmstrong.com Git - lilypond.git/commitdiff
Snippets update from Neil Puttock, thanks!
authorGraham Percival <graham@percival-music.ca>
Sun, 30 Mar 2008 22:54:47 +0000 (15:54 -0700)
committerGraham Percival <graham@percival-music.ca>
Sun, 30 Mar 2008 22:54:47 +0000 (15:54 -0700)
input/new/broken-crescendo-hairpin.ly [new file with mode: 0644]
input/new/changing-form-of-multi--measure-rests.ly
input/new/makam.ly
input/new/making-an-object-invisible-with-the-transparent-property.ly
input/new/positioning-multi--measure-rests.ly
input/new/quoting-another-voice-with-transposition.ly
input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly

diff --git a/input/new/broken-crescendo-hairpin.ly b/input/new/broken-crescendo-hairpin.ly
new file mode 100644 (file)
index 0000000..3bd097c
--- /dev/null
@@ -0,0 +1,41 @@
+\version "2.11.38"\r
+\r
+\header {\r
+  doctitle = "Broken crescendo hairpin"\r
+  lsrtags = "expressive-marks"\r
+  texidoc = "\r
+In order to make parts of a crescendo hairpin invisible, the following\r
+method is used: A white rectangle is drawn on top of the respective\r
+part of the crescendo hairpin, making it invisible. The rectangle is\r
+defined as postscript code within a text markup.\r
+\r
+To fine-tune the position and size of the markup, the number\r
+preceding @code{setgray} in the postscript definition can be set to a\r
+value <1 making it grey. The two numbers before @code{scale} in the\r
+postscript code are responsible for the width and height of the\r
+rectangle, the two numbers before @code{translate} change the x- and\r
+y-origin of the rectangle. \r
+\r
+Make sure to put the hairpin in a lower layer than the text markup to\r
+actually draw the rectangle above the hairpin. \r
+" }\r
+\r
+\score {\r
+  \relative c' {\r
+    << {\r
+      \dynamicUp\r
+      \override DynamicLineSpanner #'staff-padding = #4\r
+      r2 r16 c'8.\pp r4\r
+    } \\ {\r
+      \override DynamicLineSpanner #'layer = #0\r
+      des,2\mf\< ~\r
+      \override TextScript #'layer = #2\r
+      des16_\markup {\r
+        \postscript #"1.9 -8 translate 5 4 scale 1 setgray 0 0 moveto 0 1\r
+        lineto 1 1 lineto 1 0 lineto 0 0 lineto fill"\r
+      }\r
+      r8. des4 ~ des16->\sff\r
+    } >>\r
+  }\r
+  \layout { ragged-right = ##t }\r
+}\r
index 5dcdf9c422b62a042bf120652a22c33fd69ebb45..53b7a276491fb8fb53425d6d70a77e98b1fa4cbe 100644 (file)
@@ -4,17 +4,16 @@
   doctitle = "Changing form of multi-measure rests"
   lsrtags = "rhythms,tweaks-and-overrides"
   texidoc = "
-If there are 10 or fewer measures of rest, LilyPond prints
+If there are ten or fewer measures of rests, LilyPond prints
 a series of longa and breve rests (called in German
-Kirchenpausen - church rests) within the staff and
-prints a simple line otherwise.  This default number of 10
+\"Kirchenpausen\" - church rests) within the staff and
+prints a simple line otherwise.  This default number of ten
 may be changed by an override:
 "}
 
 \relative c'' {
-\compressFullBarRests
-R1*2 | R1*5 | R1*9
-\override MultiMeasureRest #'expand-limit = 3
-R1*2 | R1*5 | R1*9
+  \compressFullBarRests
+  R1*2 | R1*5 | R1*9
+  \override MultiMeasureRest #'expand-limit = 3
+  R1*2 | R1*5 | R1*9
 }
-
index 504a80d43301cd2d9db8790af812e293723379df..a3ae111e6dae94c70867391cf665d9ecec0f240b 100644 (file)
@@ -1,9 +1,9 @@
 \version "2.11.6"
-\layout { ragged-right= ##t }
+\layout { ragged-right = ##t }
 \header {
   doctitle = "Makam"
   lsrtags = "pitches"
-  texidoc = "Makam is Turkish type of melody that uses 1/9 tone
+  texidoc = "Makam is a type of melody from Turkey using 1/9th-tone
   microtonal alterations."
 }
 
@@ -33,7 +33,7 @@ makamPitchNames = #`(
   (gc . ,(ly:make-pitch -1 4 KOMA))
   (ac . ,(ly:make-pitch -1 5 KOMA))
   (bc . ,(ly:make-pitch -1 6 KOMA))
-
+  
   (cb . ,(ly:make-pitch -1 0 BAKIYE))
   (db . ,(ly:make-pitch -1 1 BAKIYE))
   (eb . ,(ly:make-pitch -1 2 BAKIYE))
@@ -41,7 +41,7 @@ makamPitchNames = #`(
   (gb . ,(ly:make-pitch -1 4 BAKIYE))
   (ab . ,(ly:make-pitch -1 5 BAKIYE))
   (bb . ,(ly:make-pitch -1 6 BAKIYE))
-
+  
   (ck . ,(ly:make-pitch -1 0 KUCUK))
   (dk . ,(ly:make-pitch -1 1 KUCUK))
   (ek . ,(ly:make-pitch -1 2 KUCUK))
@@ -49,7 +49,7 @@ makamPitchNames = #`(
   (gk . ,(ly:make-pitch -1 4 KUCUK))
   (ak . ,(ly:make-pitch -1 5 KUCUK))
   (bk . ,(ly:make-pitch -1 6 KUCUK))
-
+  
   (cbm . ,(ly:make-pitch -1 0 BUYUKMUCENNEB))
   (dbm . ,(ly:make-pitch -1 1 BUYUKMUCENNEB))
   (ebm . ,(ly:make-pitch -1 2 BUYUKMUCENNEB))
@@ -57,7 +57,7 @@ makamPitchNames = #`(
   (gbm . ,(ly:make-pitch -1 4 BUYUKMUCENNEB))
   (abm . ,(ly:make-pitch -1 5 BUYUKMUCENNEB))
   (bbm . ,(ly:make-pitch -1 6 BUYUKMUCENNEB))
-
+  
   ;; f for flat.
   (cfc . ,(ly:make-pitch -1 0 (- KOMA)))
   (dfc . ,(ly:make-pitch -1 1 (- KOMA)))
@@ -74,7 +74,7 @@ makamPitchNames = #`(
   (gfb . ,(ly:make-pitch -1 4 (- BAKIYE)))
   (afb . ,(ly:make-pitch -1 5 (- BAKIYE)))
   (bfb . ,(ly:make-pitch -1 6 (- BAKIYE)))
-
+  
   (cfk . ,(ly:make-pitch -1 0 (- KUCUK)))
   (dfk . ,(ly:make-pitch -1 1 (- KUCUK)))
   (efk . ,(ly:make-pitch -1 2 (- KUCUK)))
@@ -82,7 +82,7 @@ makamPitchNames = #`(
   (gfk . ,(ly:make-pitch -1 4 (- KUCUK)))
   (afk . ,(ly:make-pitch -1 5 (- KUCUK)))
   (bfk . ,(ly:make-pitch -1 6 (- KUCUK)))
-
+  
   (cfbm . ,(ly:make-pitch -1 0 (- BUYUKMUCENNEB)))
   (dfbm . ,(ly:make-pitch -1 1 (- BUYUKMUCENNEB)))
   (efbm . ,(ly:make-pitch -1 2 (- BUYUKMUCENNEB)))
@@ -90,14 +90,14 @@ makamPitchNames = #`(
   (gfbm . ,(ly:make-pitch -1 4 (- BUYUKMUCENNEB)))
   (afbm . ,(ly:make-pitch -1 5 (- BUYUKMUCENNEB)))
   (bfbm . ,(ly:make-pitch -1 6 (- BUYUKMUCENNEB)))
-
 )
 
-%% set pitch names.
-pitchnames = \makamPitchNames 
+% Set pitch names.
+pitchnames = \makamPitchNames
 #(ly:parser-set-note-names parser makamPitchNames)
 
-makamGlyphs = #'((1 . "accidentals.doublesharp")
+makamGlyphs = #'(
+       (1 . "accidentals.doublesharp")
        (8/9 . "accidentals.sharp.slashslashslash.stemstem")
        (5/9 . "accidentals.sharp.slashslashslash.stem")
        (4/9 . "accidentals.sharp")
@@ -111,7 +111,7 @@ makamGlyphs = #'((1 . "accidentals.doublesharp")
        )
 
 \relative {
-
+  
   %{ define alteration <-> symbol mapping. The following glyphs are available.
   accidentals.sharp 
   accidentals.sharp.slashslash.stem 
@@ -128,13 +128,12 @@ makamGlyphs = #'((1 . "accidentals.doublesharp")
   accidentals.flatflat.slash 
   accidentals.doublesharp 
   %}
-
-  \override Accidental #'glyph-name-alist =  \makamGlyphs
   
+  \override Accidental #'glyph-name-alist =  \makamGlyphs
   \override Staff.KeySignature #'glyph-name-alist = \makamGlyphs
-  \set Staff.keySignature =  #'(
-    (3 .  4/9)
-    (6 . -1/9))
+  \set Staff.keySignature =  #'((3 .  4/9) (6 . -1/9))
   
-  c cc db fk gbm gfc gfb efk dfbm
+  c cc db fk
+  gbm gfc gfb efk
+  fk db cc c
 }
index 543debc168c39d83354edadfd70bee26e32ca4c5..403b8babd702514c3376ba5d2f13887d1f6f2b69 100644 (file)
@@ -1,26 +1,32 @@
-\version "2.11.23"
-\layout { ragged-right= ##t }
-\header {
-  doctitle = "Making an object invisible with the transparent property"
-  lsrtags = "rhythms,tweaks-and-overrides"
-  texidoc = "
-Setting the @code{transparent} property will cause an object to be
-printed in `invisible ink': the object is not printed, but all its
-other behavior is retained.  The object still takes up space, it takes
-part in collisions, and slurs, and ties and beams can be attached to it.
-
-
-The snippet demonstrates how to connect different voices using ties. 
-Normally, ties only connect two notes in the same voice.  By
-introducing a tie in a different voice, and blanking the first up-stem
-in that voice, the tie appears to cross voices. 
-" }
-
-\relative c'' <<
-  {
-    \once \override Stem #'transparent = ##t
-    b8~ b8\noBeam
-  } \\ {
-    b[ g8]
-  }
->>
+\version "2.11.23"\r
+\layout { ragged-right = ##t }\r
+\header {\r
+  doctitle = "Making an object invisible with the transparent property"\r
+  lsrtags = "rhythms,tweaks-and-overrides"\r
+  texidoc = "\r
+Setting the @code{transparent} property will cause an object to be\r
+printed in \"invisible ink\": the object is not printed, but all its\r
+other behavior is retained.  The object still takes up space, it takes\r
+part in collisions, and slurs, ties and beams can be attached to it.\r
+\r
+\r
+The snippet demonstrates how to connect different voices using ties. \r
+Normally, ties only connect two notes in the same voice.  By\r
+introducing a tie in a different voice, and blanking the first up-stem\r
+in that voice, the tie appears to cross voices.  To prevent the blanked stem's\r
+flag from interfering with tie positioning, the stem is extended.\r
+" }\r
+\r
+\relative c'' {\r
+  \time 2/4\r
+  << {\r
+    \once \override Stem #'transparent = ##t\r
+    \once \override Stem #'length = #8\r
+    b8 ~ b\noBeam\r
+    \once \override Stem #'transparent = ##t\r
+    \once \override Stem #'length = #8\r
+    g ~ g\noBeam\r
+  } \\ {\r
+    b g g e\r
+  } >>\r
+}\r
index 56aeda5885598176d6d5a785a868ee2284bda5df..54d8a858a7eff9e5ab8c39d62181159318ef135e 100644 (file)
@@ -1,5 +1,5 @@
 \version "2.11.42"
-\layout { ragged-right= ##t }
+\layout { ragged-right = ##t }
 \header {
   doctitle = "Positioning multi-measure rests"
   lsrtags = "rhythms,tweaks-and-overrides"
@@ -13,29 +13,28 @@ of multi-measure rests can be controlled as follows:
  "}
 
 \relative c'' {
-% Multi-measure rests by default are set under the 2nd line
-R1
-% They can be moved with an override
-\override MultiMeasureRest #'staff-position = #-2
-R1
-% A value of 0 is the default position;
-% the following trick moves the rest to the center line
-\override MultiMeasureRest #'staff-position = #-0.01
-R1
-% Multimeasure rests in odd-numbered voices are under the top line
-<< {R1} \\ {a1} >>
-% Multi-measure rests in even-numbered voices are under the bottom line
-<< {c1} \\ {R1} >>
-% They remain separated even in empty bars
-<< {R1} \\ {R1} >>
-% This brings them together even though there are two voices
-\compressFullBarRests
-<<
-  \revert MultiMeasureRest #'staff-position
-  {R1*3}
-\\
-  \revert MultiMeasureRest #'staff-position
-  {R1*3}
->>
+  % Multi-measure rests by default are set under the second line
+  R1
+  % They can be moved with an override
+  \override MultiMeasureRest #'staff-position = #-2
+  R1
+  % A value of 0 is the default position;
+  % the following trick moves the rest to the center line
+  \override MultiMeasureRest #'staff-position = #-0.01
+  R1
+  % Multi-measure rests in odd-numbered voices are under the top line
+  << { R1 } \\ { a1 } >>
+  % Multi-measure rests in even-numbered voices are under the bottom line
+  << { c1 } \\ { R1 } >>
+  % They remain separated even in empty bars
+  << { R1 } \\ { R1 } >>
+  % This brings them together even though there are two voices
+  \compressFullBarRests
+  <<
+    \revert MultiMeasureRest #'staff-position
+    { R1*3 }
+    \\
+    \revert MultiMeasureRest #'staff-position
+    { R1*3 }
+  >>
 }
-
index 88c261edf39b9686f5c76719c915d86c5865095b..5b23bf07545157cacdd6f305cb4a7e59f8ba7450 100644 (file)
@@ -3,36 +3,33 @@
   doctitle = "Quoting another voice with transposition"
   lsrtags = "pitches,staff-notation"
   texidoc = "Quotations take into account the transposition of both
-source and target.  In this example, all instruments play sounding
-central C, the target is a instrument in F.  The target part may be
-@code{\\transpose}d.  In this case, all the pitches (including the
-quoted ones) will transposed as well."
+source and target. In this example, all instruments play sounding
+middle C; the target is an instrument in F. The target part may be
+transposed using @code{\\transpose}. In this case, all the pitches (including the
+quoted ones) are transposed."
 }
 
-\addQuote clarinet  {
-    \transposition bes
-    d'16 d'16 d'8 
-    d'16 d'16 d'8 
-    d'16 d'16 d'8 
-    d'16 d'16 d'8 
+\addQuote clarinet {
+  \transposition bes
+  \repeat unfold 8 { d'16 d'16 d'8 }
 }
 
-\addQuote sax  {
-    \transposition es'
-    a8 a a a a a  a a 
+\addQuote sax {
+  \transposition es'
+  \repeat unfold 16 { a8 }
 }
 
 quoteTest = {
-    \transposition f  % french horn
-    
-    g'4
-    << \quoteDuring #"clarinet" { \skip 4 } s4^"clar" >> 
-    << \quoteDuring #"sax" { \skip 4 } s4^"sax" >> 
+  % french horn
+  \transposition f
+  g'4
+  << \quoteDuring #"clarinet" { \skip 4 } s4^"clar." >>
+  << \quoteDuring #"sax" { \skip 4 } s4^"sax." >>
+  g'4
 }
 
-<< \quoteTest
-   \new Staff
-   << \transpose c' d' \quoteTest
-     s4_"up 1 tone"
-  >>
->>
+{
+  \set Staff.instrumentName = \markup \center-align { "Horn" "in F" }
+  \quoteTest
+  \transpose c' d' << \quoteTest s4_"up a tone" >>
+}
index 8ca3eba3fe996cb11e502531b5340ec8301c1ad5..bfcdee28d7a682de5d6e70837f7d7eeed03ba164 100644 (file)
@@ -3,19 +3,20 @@
   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.  "
-}
+notes in order to have the minimum number of accidentals. In this
+case, the following rules apply:
+
+\"Double accidentals should be removed, as well as E sharp (-> F),
+C flat (-> B), F flat (-> E) and B sharp (-> C)\".
 
-#(define  (naturalise-pitch p)
+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
          (n (ly:pitch-notename p)))
-
     (cond
      ((and (> a 1) (or (eq? n 6) (eq? n 2)))
       (set! a (- a 2))
@@ -23,54 +24,44 @@ enharmonic notes are chosen in this example.  "
      ((and (< a -1) (or (eq? n 0) (eq? n 3)))
       (set! a (+ a 2))
       (set! n (- n 1))))
-
     (cond
      ((> a 2) (set! a (- a 4)) (set! n (+ n 1)))
      ((< a -2) (set! a (+ a 4)) (set! n (- n 1))))
-
     (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 4))))
 
-#(define (naturalise music)
+#(define (naturalize music)
   (let* ((es (ly:music-property music 'elements))
          (e (ly:music-property music 'element))
          (p (ly:music-property music 'pitch)))
-
     (if (pair? es)
         (ly:music-set-property!
          music 'elements
-         (map (lambda (x) (naturalise x)) es)))
-
+         (map (lambda (x) (naturalize x)) es)))
     (if (ly:music? e)
         (ly:music-set-property!
          music 'element
-         (naturalise e)))
-
+         (naturalize e)))
     (if (ly:pitch? p)
         (begin
-          (set! p (naturalise-pitch p))
+          (set! p (naturalize-pitch p))
           (ly:music-set-property! music 'pitch p)))
-
     music))
 
-music =  \relative c' { c4 d  e f g a b  c }
-
-naturaliseMusic =
+naturalizeMusic =
 #(define-music-function (parser location m)
                                        (ly:music?)
-                       (naturalise m))
+                       (naturalize m))
+
+music =  \relative c' { c4 d e g }
 
 \score {
-   \new Staff {
-     \transpose c ais \music
-     \naturaliseMusic \transpose c ais \music 
-    \break
+  \new Staff {
+    \transpose c ais \music
+    \naturalizeMusic \transpose c ais \music
     \transpose c deses \music
-    \naturaliseMusic \transpose c deses \music
+    \naturalizeMusic \transpose c deses \music
   }
-  \layout { ragged-right = ##t}
+  \layout { ragged-right = ##t }
 }
-
-