From 9c47603e7fb705ee8bf1ef21177d2f9a6159abc2 Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Sun, 30 Mar 2008 15:54:47 -0700 Subject: [PATCH] Snippets update from Neil Puttock, thanks! --- input/new/broken-crescendo-hairpin.ly | 41 +++++++++++++ .../changing-form-of-multi--measure-rests.ly | 15 +++-- input/new/makam.ly | 37 ++++++------ ...invisible-with-the-transparent-property.ly | 58 ++++++++++--------- input/new/positioning-multi--measure-rests.ly | 51 ++++++++-------- ...uoting-another-voice-with-transposition.ly | 45 +++++++------- ...ith-minimum-accidentals-smart-transpose.ly | 53 +++++++---------- 7 files changed, 166 insertions(+), 134 deletions(-) create mode 100644 input/new/broken-crescendo-hairpin.ly diff --git a/input/new/broken-crescendo-hairpin.ly b/input/new/broken-crescendo-hairpin.ly new file mode 100644 index 0000000000..3bd097c800 --- /dev/null +++ b/input/new/broken-crescendo-hairpin.ly @@ -0,0 +1,41 @@ +\version "2.11.38" + +\header { + doctitle = "Broken crescendo hairpin" + lsrtags = "expressive-marks" + texidoc = " +In order to make parts of a crescendo hairpin invisible, the following +method is used: A white rectangle is drawn on top of the respective +part of the crescendo hairpin, making it invisible. The rectangle is +defined as postscript code within a text markup. + +To fine-tune the position and size of the markup, the number +preceding @code{setgray} in the postscript definition can be set to a +value <1 making it grey. The two numbers before @code{scale} in the +postscript code are responsible for the width and height of the +rectangle, the two numbers before @code{translate} change the x- and +y-origin of the rectangle. + +Make sure to put the hairpin in a lower layer than the text markup to +actually draw the rectangle above the hairpin. +" } + +\score { + \relative c' { + << { + \dynamicUp + \override DynamicLineSpanner #'staff-padding = #4 + r2 r16 c'8.\pp r4 + } \\ { + \override DynamicLineSpanner #'layer = #0 + des,2\mf\< ~ + \override TextScript #'layer = #2 + des16_\markup { + \postscript #"1.9 -8 translate 5 4 scale 1 setgray 0 0 moveto 0 1 + lineto 1 1 lineto 1 0 lineto 0 0 lineto fill" + } + r8. des4 ~ des16->\sff + } >> + } + \layout { ragged-right = ##t } +} diff --git a/input/new/changing-form-of-multi--measure-rests.ly b/input/new/changing-form-of-multi--measure-rests.ly index 5dcdf9c422..53b7a27649 100644 --- a/input/new/changing-form-of-multi--measure-rests.ly +++ b/input/new/changing-form-of-multi--measure-rests.ly @@ -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 } - diff --git a/input/new/makam.ly b/input/new/makam.ly index 504a80d433..a3ae111e6d 100644 --- a/input/new/makam.ly +++ b/input/new/makam.ly @@ -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 } diff --git a/input/new/making-an-object-invisible-with-the-transparent-property.ly b/input/new/making-an-object-invisible-with-the-transparent-property.ly index 543debc168..403b8babd7 100644 --- a/input/new/making-an-object-invisible-with-the-transparent-property.ly +++ b/input/new/making-an-object-invisible-with-the-transparent-property.ly @@ -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" +\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, 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. To prevent the blanked stem's +flag from interfering with tie positioning, the stem is extended. +" } + +\relative c'' { + \time 2/4 + << { + \once \override Stem #'transparent = ##t + \once \override Stem #'length = #8 + b8 ~ b\noBeam + \once \override Stem #'transparent = ##t + \once \override Stem #'length = #8 + g ~ g\noBeam + } \\ { + b g g e + } >> +} diff --git a/input/new/positioning-multi--measure-rests.ly b/input/new/positioning-multi--measure-rests.ly index 56aeda5885..54d8a858a7 100644 --- a/input/new/positioning-multi--measure-rests.ly +++ b/input/new/positioning-multi--measure-rests.ly @@ -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 } + >> } - diff --git a/input/new/quoting-another-voice-with-transposition.ly b/input/new/quoting-another-voice-with-transposition.ly index 88c261edf3..5b23bf0754 100644 --- a/input/new/quoting-another-voice-with-transposition.ly +++ b/input/new/quoting-another-voice-with-transposition.ly @@ -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" >> +} diff --git a/input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly b/input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly index 8ca3eba3fe..bfcdee28d7 100644 --- a/input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly +++ b/input/new/transposing-pitches-with-minimum-accidentals-smart-transpose.ly @@ -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 } } - - -- 2.39.5