This is out-www/lilypond-snippets.info, produced by makeinfo version 4.13 from out-www/lilypond-snippets.texi. INFO-DIR-SECTION GNU LilyPond -- the music typesetter START-INFO-DIR-ENTRY * LilyPond Snippets: (lilypond-snippets). Short tricks, tips, and examples. END-INFO-DIR-ENTRY File: lilypond-snippets.info, Node: Top, Next: Pitches, Up: (dir) GNU LilyPond -- Snippets List ***************************** This document shows a selected set of LilyPond snippets from the LilyPond Snippet Repository (http://lsr.dsi.unimi.it) (LSR). It is in the public domain. Please note that it is not an exact subset of LSR: some snippets come from `input/new' LilyPond sources directory, and snippets from LSR are converted through `convert-ly', as LSR is based on a stable LilyPond version, and this document is for version 2.12.3. Snippets are grouped by tags; tags listed in the table of contents match a section of LilyPond notation manual. Snippets may have several tags, and not all LSR tags may appear in this document. In the HTML version of this document, you can click on the file name or figure for each example to see the corresponding input file. * Menu: Musical notation * Pitches:: * Rhythms:: * Expressive marks:: * Repeats:: * Simultaneous notes:: * Staff notation:: * Editorial annotations:: * Text:: Specialist notation * Vocal music:: * Chords:: * Keyboards:: * Percussion:: * Fretted strings:: * Unfretted strings:: * Winds:: * Ancient notation:: * World music:: Other collections * Contexts and engravers:: * Tweaks and overrides:: * Paper and layout:: * Titles:: * Spacing:: * MIDI:: * Templates:: File: lilypond-snippets.info, Node: Pitches, Next: Rhythms, Prev: Top, Up: Top Pitches ******* These snippets illustrate *note Pitches: (lilypond)Pitches. Adding ambitus per voice ======================== Ambitus can be added per voice. In this case, the ambitus must be moved manually to prevent collisions. \new Staff << \new Voice \with { \consists "Ambitus_engraver" } \relative c'' { \override Ambitus #'X-offset = #2.0 \voiceOne c4 a d e f1 } \new Voice \with { \consists "Ambitus_engraver" } \relative c' { \voiceTwo es4 f g as b1 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼲楬祬㤭㙦㉣ㄴ⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Ambitus with multiple voices ============================ Adding the `Ambitus_engraver' to the `Staff' context creates a single ambitus per staff, even in the case of staves with multiple voices. \new Staff \with { \consists "Ambitus_engraver" } << \new Voice \relative c'' { \voiceOne c4 a d e f1 } \new Voice \relative c' { \voiceTwo es4 f g as b1 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⼱楬祬ㄭ挲㉤㠰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Ambitus ======= Ambitus indicate pitch ranges for voices. Accidentals only show up if they are not part of the key signature. `AmbitusNoteHead' grobs also have ledger lines. \layout { \context { \Voice \consists "Ambitus_engraver" } } << \new Staff { \relative c' { \time 2/4 c4 f' } } \new Staff { \relative c' { \time 2/4 \key d \major cis4 as' } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽦楬祬㤭攴㔶㝤湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Applying note head styles depending on the step of the scale ============================================================ The `shapeNoteStyles' property can be used to define various note head styles for each step of the scale (as set by the key signature or the "tonic" property). This property requires a set of symbols, which can be purely arbitrary (geometrical expressions such as `triangle', `cross', and `xcircle' are allowed) or based on old American engraving tradition (some latin note names are also allowed). That said, to imitate old American song books, there are several predefined note head styles available through shortcut commands such as `\aikenHeads' or `\sacredHarpHeads'. This example shows different ways to obtain shape note heads, and demonstrates the ability to transpose a melody without losing the correspondence between harmonic functions and note head styles. fragment = { \key c \major c2 d e2 f g2 a b2 c } \score { \new Staff { \transpose c d \relative c' { \set shapeNoteStyles = #'#(do re mi fa #f la ti) \fragment } \break \relative c' { \set shapeNoteStyles = #'#(cross triangle fa #f mensural xcircle diamond) \fragment } } \layout { ragged-right = ##t } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼸楬祬〭昶愲㝢湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Coloring notes depending on their pitch ======================================= It is possible to color note heads depending on their pitch and/or their names: the function used in this example even makes it possible to distinguish enharmonics. %Association list of pitches to colors. #(define color-mapping (list (cons (ly:make-pitch 0 0 0) (x11-color 'red)) (cons (ly:make-pitch 0 0 1/2) (x11-color 'green)) (cons (ly:make-pitch 0 1 -1/2) (x11-color 'green)) (cons (ly:make-pitch 0 2 0) (x11-color 'red)) (cons (ly:make-pitch 0 2 1/2) (x11-color 'green)) (cons (ly:make-pitch 0 3 -1/2) (x11-color 'red)) (cons (ly:make-pitch 0 3 0) (x11-color 'green)) (cons (ly:make-pitch 0 4 1/2) (x11-color 'red)) (cons (ly:make-pitch 0 5 0) (x11-color 'green)) (cons (ly:make-pitch 0 5 -1/2) (x11-color 'red)) (cons (ly:make-pitch 0 6 1/2) (x11-color 'red)) (cons (ly:make-pitch 0 1 0) (x11-color 'blue)) (cons (ly:make-pitch 0 3 1/2) (x11-color 'blue)) (cons (ly:make-pitch 0 4 -1/2) (x11-color 'blue)) (cons (ly:make-pitch 0 5 1/2) (x11-color 'blue)) (cons (ly:make-pitch 0 6 -1/2) (x11-color 'blue)))) %Compare pitch and alteration (not octave). #(define (pitch-equals? p1 p2) (and (= (ly:pitch-alteration p1) (ly:pitch-alteration p2)) (= (ly:pitch-notename p1) (ly:pitch-notename p2)))) #(define (pitch-to-color pitch) (let ((color (assoc pitch color-mapping pitch-equals?))) (if color (cdr color)))) #(define (color-notehead grob) (pitch-to-color (ly:event-property (event-cause grob) 'pitch))) \score { \new Staff \relative c' { \override NoteHead #'color = #color-notehead c8 b d dis ees f g aes } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⽦楬祬㜭攱㠹ㅥ⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating a sequence of notes on various pitches =============================================== In music that contains many occurrences of the same sequence of notes at different pitches, the following music function may prove useful. It takes a note, of which only the pitch is used. The supporting Scheme functions were borrowed from the "Tips and tricks" document in the manual for version 2.10. This example creates the rhythm used throughout Mars, from Gustav Holst's The Planets. #(define (make-note-req p d) (make-music 'NoteEvent 'duration d 'pitch p)) #(define (make-note p d) (make-music 'EventChord 'elements (list (make-note-req p d)))) #(define (make-triplet elt) (make-music 'TimeScaledMusic 'denominator 3 'numerator 2 'element elt)) rhythm = #(define-music-function (parser location note) (ly:music?) "Make the rhythm in Mars (the Planets) at the given note's pitch" (let ((p (ly:music-property (car (ly:music-property note 'elements)) 'pitch))) (make-sequential-music (list (make-triplet (make-sequential-music (list (make-note p (ly:make-duration 3 0 2 3)) (make-note p (ly:make-duration 3 0 2 3)) (make-note p (ly:make-duration 3 0 2 3))))) (make-note p (ly:make-duration 2 0)) (make-note p (ly:make-duration 2 0)) (make-note p (ly:make-duration 3 0)) (make-note p (ly:make-duration 3 0)) (make-note p (ly:make-duration 2 0)))))) \new Staff { \time 5/4 \rhythm c' \rhythm c'' \rhythm g } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽥楬祬ㄭㅦ㔵㌰⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Dodecaphonic-style accidentals for each note including naturals =============================================================== In early 20th century works, starting with Schoenberg, Berg and Webern (the "Second" Viennese school), every pitch in the twelve-tone scale has to be regarded as equal, without any hierarchy such as the classical (tonal) degrees. Therefore, these composers print one accidental for each note, even at natural pitches, to emphasize their new approach to music theory and language. This snippet shows how to achieve such notation rules. \score { \new Staff { #(set-accidental-style 'dodecaphonic) c'4 dis' cis' cis' c'4 dis' cis' cis' c'4 c' dis' des' } \layout { \context { \Staff \remove "Key_engraver" } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼸楬祬㌭㉣㘸晣⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Generating random notes ======================= This Scheme-based snippet generates 24 random notes (or as many as required), based on the current time (or any randomish number specified instead, in order to obtain the same random notes each time): i.e., to get different random note patterns, just change this number. \score { { #(let ((random-state (seed->random-state (current-time)))) (ly:export (make-sequential-music (map (lambda (x) (let ((idx (random 12 random-state))) (make-event-chord (list (make-music 'NoteEvent 'duration (ly:make-duration 2 0 1 1) 'pitch (ly:make-pitch (quotient idx 7) (remainder idx 7) 0)))))) (make-list 24))))) } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⽢楬祬戭戳ㄴ㘶⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Makam example ============= Makam is a type of melody from Turkey using 1/9th-tone microtonal alterations. Consult the initialization file `ly/makam.ly' for details of pitch names and alterations. % Initialize makam settings \include "makam.ly" \relative c' { \set Staff.keySignature = #`((3 . ,BAKIYE) (6 . ,(- KOMA))) c4 cc db fk gbm4 gfc gfb efk fk4 db cc c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼸楬祬搭搶㥤㜷⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Non-traditional key signatures ============================== The commonly used `\key' command sets the `keySignature' property, in the `Staff' context. To create non-standard key signatures, set this property directly. The format of this command is a list: ` \set Staff.keySignature = #`(((octave . step) . alter) ((octave . step) . alter) ...) ' where, for each element in the list, `octave' specifies the octave (0 being the octave from middle C to the B above), `step' specifies the note within the octave (0 means C and 6 means B), and `alter' is `,SHARP ,FLAT ,DOUBLE-SHARP' etc. (Note the leading comma.) The accidentals in the key signature will appear in the reverse order to that in which they are specified. Alternatively, for each item in the list, using the more concise format `(step . alter)' specifies that the same alteration should hold in all octaves. For microtonal scales where a "sharp" is not 100 cents, `alter' refers to the alteration as a proportion of a 200-cent whole tone. Here is an example of a possible key signature for generating a whole-tone scale: \relative c' { \set Staff.keySignature = #`(((0 . 3) . ,SHARP) ((0 . 5) . ,FLAT) ((0 . 6) . ,FLAT)) c4 d e fis aes4 bes c2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⼶楬祬〭昱㔳愸⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Ottava text =========== Internally, `\ottava' sets the properties `ottavation' (for example, to `"8va"' or `"8vb"') and `middleCPosition'. To override the text of the bracket, set `ottavation' after invoking `\ottava'. { \ottava #1 \set Staff.ottavation = #"8" c''1 \ottava #0 c'1 \ottava #1 \set Staff.ottavation = #"Text" c''1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼶楬祬愭㙦搳攲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Preventing extra naturals from being automatically added ======================================================== In accordance with standard typesetting rules, a natural sign is printed before a sharp or flat if a previous accidental on the same note needs to be canceled. To change this behavior, set the `extraNatural' property to "false" in the `Staff' context. \relative c'' { aeses4 aes ais a \set Staff.extraNatural = ##f aeses4 aes ais a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼵楬祬㔭㔱昵㕡⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Preventing natural signs from being printed when the key signature changes ========================================================================== When the key signature changes, natural signs are automatically printed to cancel any accidentals from previous key signatures. This may be prevented by setting to "false" the `printKeyCancellation' property in the `Staff' context. \relative c' { \key d \major a4 b cis d \key g \minor a4 bes c d \set Staff.printKeyCancellation = ##f \key d \major a4 b cis d \key g \minor a4 bes c d } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⽤楬祬挭㔶㙥〵⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Quoting another voice with transposition ======================================== Quotations take into account the transposition of both 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 `\transpose'. In this case, all the pitches (including the quoted ones) are transposed. \addQuote clarinet { \transposition bes \repeat unfold 8 { d'16 d' d'8 } } \addQuote sax { \transposition es' \repeat unfold 16 { a8 } } quoteTest = { % french horn \transposition f g'4 << \quoteDuring #"clarinet" { \skip 4 } s4^"clar." >> << \quoteDuring #"sax" { \skip 4 } s4^"sax." >> g'4 } { \set Staff.instrumentName = \markup { \center-column { Horn \line { in F } } } \quoteTest \transpose c' d' << \quoteTest s4_"up a tone" >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼷楬祬昭㌷捣㉢⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Separating key cancellations from key signature changes ======================================================= By default, the accidentals used for key cancellations are placed adjacent to those for key signature changes. This behavior can be changed by overriding the `'break-align-orders' property of the `BreakAlignment' grob. The value of `'break-align-orders' is a vector of length 3, with quoted lists of breakable items as elements. This example only modifies the second list, moving `key-cancellation' before `staff-bar'; by modifying the second list, break alignment behavior only changes in the middle of a system, not at the beginning or the end. \new Staff { \override Score.BreakAlignment #'break-align-orders = #'#((left-edge ambitus breathing-sign clef staff-bar key-cancellation key-signature time-signature custos) (left-edge ambitus breathing-sign clef key-cancellation staff-bar key-signature time-signature custos) (left-edge ambitus breathing-sign clef key-cancellation key-signature staff-bar time-signature custos)) \key des \major c'1 \bar "||" \key bes \major c'1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼲楬祬愭攱㜴㈴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Transposing pitches with minimum accidentals ("Smart" transpose) ================================================================ This example uses some Scheme code to enforce enharmonic modifications for notes in order to have the minimum number of accidentals. In this case, the following rules apply: Double accidentals should be removed B sharp -> C E sharp -> F C flat -> B F flat -> E 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)) (set! n (+ n 1))) ((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 (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) (naturalize x)) es))) (if (ly:music? e) (ly:music-set-property! music 'element (naturalize e))) (if (ly:pitch? p) (begin (set! p (naturalize-pitch p)) (ly:music-set-property! music 'pitch p))) music)) naturalizeMusic = #(define-music-function (parser location m) (ly:music?) (naturalize m)) music = \relative c' { c4 d e g } \score { \new Staff { \transpose c ais { \music } \naturalizeMusic \transpose c ais { \music } \transpose c deses { \music } \naturalizeMusic \transpose c deses { \music } } \layout { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⽦楬祬㌭敤㠴㠲⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Tweaking clef properties ======================== The command `\clef "treble_8"' is equivalent to setting `clefGlyph', `clefPosition' (which controls the vertical position of the clef), `middleCPosition' and `clefOctavation'. A clef is printed when any of the properties except `middleCPosition' are changed. Note that changing the glyph, the position of the clef, or the octavation does not in itself change the position of subsequent notes on the staff: the position of middle C must also be specified to do this. The positional parameters are relative to the staff center line, positive numbers displacing upwards, counting one for each line and space. The `clefOctavation' value would normally be set to 7, -7, 15 or -15, but other values are valid. When a clef change takes place at a line break the new clef symbol is printed at both the end of the previous line and the beginning of the new line by default. If the warning clef at the end of the previous line is not required it can be suppressed by setting the `Staff' property `explicitClefVisibility' to the value `end-of-line-invisible'. The default behavior can be recovered with `\unset Staff.explicitClefVisibility'. The following examples show the possibilities when setting these properties manually. On the first line, the manual changes preserve the standard relative positioning of clefs and notes, whereas on the second line, they do not. \layout { ragged-right = ##t } { % The default treble clef c'1 % The standard bass clef \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 \set Staff.middleCPosition = #6 c'1 % The baritone clef \set Staff.clefGlyph = #"clefs.C" \set Staff.clefPosition = #4 \set Staff.middleCPosition = #4 c'1 % The standard choral tenor clef \set Staff.clefGlyph = #"clefs.G" \set Staff.clefPosition = #-2 \set Staff.clefOctavation = #-7 \set Staff.middleCPosition = #1 c'1 % A non-standard clef \set Staff.clefPosition = #0 \set Staff.clefOctavation = #0 \set Staff.middleCPosition = #-4 c'1 \break % The following clef changes do not preserve % the normal relationship between notes and clefs: \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 c'1 \set Staff.clefGlyph = #"clefs.G" c'1 \set Staff.clefGlyph = #"clefs.C" c'1 \set Staff.clefOctavation = #7 c'1 \set Staff.clefOctavation = #0 \set Staff.clefPosition = #0 c'1 % Return to the normal clef: \set Staff.middleCPosition = #0 c'1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽢楬祬戭挳㈹㑤湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Rhythms, Next: Expressive marks, Prev: Pitches, Up: Top Rhythms ******* These snippets illustrate *note Rhythms: (lilypond)Rhythms. Adding beams, slurs, ties etc. when using tuplet and non-tuplet rhythms ======================================================================= LilyPond syntax can involve many unusual placements for parentheses, brackets etc., which might sometimes have to be interleaved. For example, when entering a manual beam, the left square bracket has to be placed after the starting note and its duration, not before. Similarly, the right square bracket should directly follow the note which is to be at the end of the requested beaming, even if this note happens to be inside a tuplet section. This snippet demonstrates how to combine manual beaming, manual slurs, ties and phrasing slurs with tuplet sections (enclosed within curly braces). { r16[ g16 \times 2/3 { r16 e'8] } g16( a \times 2/3 { b d e') } g8[( a \times 2/3 { b d') e'] ~ } \time 2/4 \times 4/5 { e'32\( a b d' e' } a'4.\) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼵楬祬㜭㍥㍢㕥⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Adding drum parts ================= Using the powerful pre-configured tools such as the `\drummode' function and the `DrumStaff' context, inputting drum parts is quite easy: drums are placed at their own staff positions (with a special clef symbol) and have note heads according to the drum. Attaching an extra symbol to the drum or restricting the number of lines is possible. drh = \drummode { cymc4.^"crash" hhc16^"h.h." hh hhc8 hho hhc8 hh16 hh hhc4 r4 r2 } drl = \drummode { bd4 sn8 bd bd4 << bd ss >> bd8 tommh tommh bd toml toml bd tomfh16 tomfh } timb = \drummode { timh4 ssh timl8 ssh r timh r4 ssh8 timl r4 cb8 cb } \score { << \new DrumStaff \with { drumStyleTable = #timbales-style \override StaffSymbol #'line-count = #2 \override BarLine #'bar-size = #2 } << \set Staff.instrumentName = #"timbales" \timb >> \new DrumStaff << \set Staff.instrumentName = #"drums" \new DrumVoice { \stemUp \drh } \new DrumVoice { \stemDown \drl } >> >> \layout { } \midi { \context { \Score tempoWholesPerMinute = #(ly:make-moment 120 4) } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼴楬祬㈭㝤㉥㙣⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Aligning bar numbers ==================== Bar numbers by default are right-aligned to their parent object. This is usually the left edge of a line or, if numbers are printed within a line, the left hand side of a bar line. The numbers may also be positioned directly over the bar line or left-aligned to the bar line. \relative c' { \set Score.currentBarNumber = #111 \override Score.BarNumber #'break-visibility = #'#(#t #t #t) % Increase the size of the bar number by 2 \override Score.BarNumber #'font-size = #2 % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 | c1 % Center-align bar numbers \override Score.BarNumber #'self-alignment-X = #CENTER c1 | c1 % Left-align bar numbers \override Score.BarNumber #'self-alignment-X = #LEFT c1 | c1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼶楬祬㜭㝥㡢搵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Automatic beam subdivisions =========================== Beams can be subdivided automatically. By setting the property `subdivideBeams', beams are subdivided at beat positions (as specified in `beatLength'). \new Staff { \relative c'' { << { \voiceOne \set subdivideBeams = ##t b32[ a g f c' b a g b32^"subdivide beams" a g f c' b a g] } \new Voice { \voiceTwo b32_"default"[ a g f c' b a g b32 a g f c' b a g] } >> \oneVoice \set beatLength = #(ly:make-moment 1 8) b32^"beatLength 1 8"[ a g f c' b a g] \set beatLength = #(ly:make-moment 1 16) b32^"beatLength 1 16"[ a g f c' b a g] } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽥楬祬㘭攲挶搹⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Avoiding collisions with chord fingerings ========================================= Fingerings and string numbers applied to individual notes will automatically avoid beams and stems, but this is not true by default for fingerings and string numbers applied to the individual notes of chords. The following example shows how this default behavior can be overridden. \relative c' { \set fingeringOrientations = #'(up) \set stringNumberOrientations = #'(up) \set strokeFingerOrientations = #'(up) % Default behavior r8 <f c'-5>8 <f c'\5>8 <f c'-\rightHandFinger #2 >8 % Corrected to avoid collisions r8 \override Fingering #'add-stem-support = ##t <f c'-5>8 \override StringNumber #'add-stem-support = ##t <f c'\5>8 \override StrokeFinger #'add-stem-support = ##t <f c'-\rightHandFinger #2 >8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼱楬祬㤭㈵挸㙥⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Beam endings in Score context ============================= Beam-ending rules specified in the `Score' context apply to all staves, but can be modified at both `Staff' and `Voice' levels: \relative c'' { \time 5/4 % Set default beaming for all staves #(score-override-auto-beam-setting '(end * * 5 4) 3 8) #(score-override-auto-beam-setting '(end * * 5 4) 7 8) << \new Staff { c8 c c c c c c c c c } \new Staff { % Modify beaming for just this staff #(override-auto-beam-setting '(end * * 5 4) 6 8 'Staff) #(revert-auto-beam-setting '(end * * 5 4) 7 8 'Staff) c8 c c c c c c c c c } \new Staff { % Inherit beaming from Score context << { \voiceOne c8 c c c c c c c c c } % Modify beaming for this voice only \new Voice { \voiceTwo #(override-auto-beam-setting '(end * * 5 4) 6 8) #(revert-auto-beam-setting '(end * * 5 4) 7 8) a8 a a a a a a a a a } >> } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⽣楬祬㌭戴㥤㌶⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Beam grouping in 7/8 time ========================= There are no default automatic beam groupings specified for 7/8 time, so if automatic beams are required the grouping must be specified. For example, to group all beams 2-3-2 in 7/8 time, specify beam endings at 2/8 and 5/8: \relative c'' { \time 7/8 % rhythm 2-3-2 a8 a a a a a a #(override-auto-beam-setting '(end * * 7 8) 2 8) #(override-auto-beam-setting '(end * * 7 8) 5 8) a8 a a a a a a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼵楬祬ㄭ㈸户㈰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Beams across line breaks ======================== Line breaks are normally forbidden when beams cross bar lines. This behavior can be changed as shown: \relative c'' { \override Beam #'breakable = ##t c8 c[ c] c[ c] c[ c] c[ \break c8] c[ c] c[ c] c[ c] c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽥楬祬ㄭ攰㤹搹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing beam knee gap ====================== Kneed beams are inserted automatically when a large gap is detected between the note heads. This behavior can be tuned through the `auto-knee-gap' property. A kneed beam is drawn if the gap is larger than the value of `auto-knee-gap' plus the width of the beam object (which depends on the duration of the notes and the slope of the beam). By default `auto-knee-gap' is set to 5.5 staff spaces. { f8 f''8 f8 f''8 \override Beam #'auto-knee-gap = #6 f8 f''8 f8 f''8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼶楬祬㈭晢㈶挲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing form of multi-measure rests ==================================== If there are ten or fewer measures of rests, a series of longa and breve rests (called in German "Kirchenpausen" - church rests) is printed within the staff; otherwise a simple line is shown. This default number of ten may be changed by overriding the `expand-limit' property. \relative c'' { \compressFullBarRests R1*2 | R1*5 | R1*9 \override MultiMeasureRest #'expand-limit = #3 R1*2 | R1*5 | R1*9 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⽥楬祬㜭〴搰㥦⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the time signature without affecting the beaming ========================================================= The `\time' command sets the properties `timeSignatureFraction', `beatLength', `beatGrouping' and `measureLength' in the `Timing' context, which is normally aliased to `Score'. Changing the value of `timeSignatureFraction' causes the new time signature symbol to be printed without changing any of the other properties: \relative c'' { \time 3/4 a16 a a a a a a a a a a a % Change time signature symbol but keep 3/4 beaming % due to unchanged underlying time signature \set Score.timeSignatureFraction = #'(12 . 16) a16 a a a a a a a a a a a \time 12/16 % Lose 3/4 beaming now \time has been changed a16 a a a a a a a a a a a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼷楬祬昭㔴晣愹⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the tuplet number ========================== By default, only the numerator of the tuplet number is printed over the tuplet bracket, i.e., the denominator of the argument to the `\times' command. Alternatively, num:den of the tuplet number may be printed, or the tuplet number may be suppressed altogether. \relative c'' { \times 2/3 { c8 c c } \times 2/3 { c8 c c } \override TupletNumber #'text = #tuplet-number::calc-fraction-text \times 2/3 { c8 c c } \override TupletNumber #'stencil = ##f \times 2/3 { c8 c c } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼵楬祬戭㥢㌰㡦⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing time signatures inside a polymetric section using \scaleDurations ========================================================================== The `measureLength' property, together with `measurePosition', determines when a bar line is needed. However, when using `\scaleDurations', the scaling of durations makes it difficult to change time signatures. In this case, `measureLength' should be set manually, using the `ly:make-moment' callback. The second argument must be the same as the second argument of `\scaleDurations'. \layout { \context { \Score \remove "Timing_translator" \remove "Default_bar_line_engraver" } \context { \Staff \consists "Timing_translator" \consists "Default_bar_line_engraver" } } << \new Staff { \scaleDurations #'(8 . 5) { \time 6/8 \set Timing.measureLength = #(ly:make-moment 6 5) b8 b b b b b \time 2/4 \set Timing.measureLength = #(ly:make-moment 4 5) b4 b } } \new Staff { \clef bass \time 2/4 c2 d e f } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼹楬祬ㄭ〹㜷搱⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Chant or psalms notation ======================== This form of notation is used for the chant of the Psalms, where verses aren't always the same length. stemOn = { \revert Staff.Stem #'transparent } stemOff = { \override Staff.Stem #'transparent = ##t } \score { \new Staff \with { \remove "Time_signature_engraver" } { \key g \minor \cadenzaOn \stemOff a'\breve bes'4 g'4 \stemOn a'2 \bar "||" \stemOff a'\breve g'4 a'4 \stemOn f'2 \bar "||" \stemOff a'\breve^\markup { \italic flexe } \stemOn g'2 \bar "||" } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⽢楬祬挭攵㉣㕢⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Compound time signatures ======================== Odd 20th century time signatures (such as "5/8") can often be played as compound time signatures (e.g. "3/8 + 2/8"), which combine two or more inequal metrics. LilyPond can make such music quite easy to read and play, by explicitly printing the compound time signatures and adapting the automatic beaming behavior. (Graphic measure grouping indications can also be added; see the appropriate snippet in this database.) #(define ((compound-time one two num) grob) (grob-interpret-markup grob (markup #:override '(baseline-skip . 0) #:number (#:line ( (#:column (one num)) #:vcenter "+" (#:column (two num))))))) \relative c' { \override Staff.TimeSignature #'stencil = #(compound-time "2" "3" "8") \time 5/8 #(override-auto-beam-setting '(end 1 8 5 8) 1 4) c8 d e fis gis c8 fis, gis e d c8 d e4 gis8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼰楬祬戭愵换攲⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Conducting signs, measure grouping signs ======================================== Options to group beats within a bar are available through the Scheme function `set-time-signature', which takes three arguments: the number of beats, the beat length, and the internal grouping of beats in the measure. If the `Measure_grouping_engraver' is included, the function will also create `MeasureGrouping' signs. Such signs ease reading rhythmically complex modern music. In the example, the 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to `set-time-signature' as the third argument: `'(2 2 2 3)': \score { \relative c'' { #(set-time-signature 9 8 '(2 2 2 3)) #(revert-auto-beam-setting '(end * * 9 8) 3 8) #(override-auto-beam-setting '(end 1 8 9 8) 1 4) #(override-auto-beam-setting '(end 1 8 9 8) 2 4) #(override-auto-beam-setting '(end 1 8 9 8) 3 4) g8 g d d g g a( bes g) | #(set-time-signature 5 8 '(3 2)) a4. g4 } \layout { \context { \Staff \consists "Measure_grouping_engraver" } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽢楬祬搭〴ㄱ敦湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Controlling tuplet bracket visibility ===================================== The default behavior of tuplet-bracket visibility is to print a bracket unless there is a beam of the same length as the tuplet. To control the visibility of tuplet brackets, set the property `'bracket-visibility' to either `#t' (always print a bracket), `#f' (never print a bracket) or `#'if-no-beam' (only print a bracket if there is no beam). music = \relative c'' { \times 2/3 { c16[ d e } f8] \times 2/3 { c8 d e } \times 2/3 { c4 d e } } \new Voice { \relative c' { << \music s4^"default" >> \override TupletBracket #'bracket-visibility = #'if-no-beam << \music s4^"'if-no-beam" >> \override TupletBracket #'bracket-visibility = ##t << \music s4^"#t" >> \override TupletBracket #'bracket-visibility = ##f << \music s4^"#f" >> } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⼶楬祬〭搲〸搳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Engraving ties manually ======================= Ties may be engraved manually by changing the `tie-configuration' property of the `TieColumn' object. The first number indicates the distance from the center of the staff in staff-spaces, and the second number indicates the direction (1 = up, -1 = down). \relative c' { <c e g>2 ~ <c e g> \override TieColumn #'tie-configuration = #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1)) <c e g> ~ <c e g> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⼰楬祬愭㑥㤲昱⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Engraving tremolos with floating beams ====================================== If a tremolo's total duration is less than a quarter-note, or exactly a half-note, or between a half-note and a whole-note, it is normally typeset with all beams touching the stems. Certain engraving styles typeset some of these beams as centered floating beams that do not touch the stems. The number of floating beams in this type of tremolo is controlled with the `'gap-count ' property of the `Beam' object, and the size of the gaps between beams and stems is set with the `'gap' property. \relative c'' { \repeat tremolo 8 { a32 f } \override Beam #'gap-count = #1 \repeat tremolo 8 { a32 f } \override Beam #'gap-count = #2 \repeat tremolo 8 { a32 f } \override Beam #'gap-count = #3 \repeat tremolo 8 { a32 f } \override Beam #'gap-count = #3 \override Beam #'gap = #1.33 \repeat tremolo 8 { a32 f } \override Beam #'gap = #1 \repeat tremolo 8 { a32 f } \override Beam #'gap = #0.67 \repeat tremolo 8 { a32 f } \override Beam #'gap = #0.33 \repeat tremolo 8 { a32 f } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼷楬祬攭㉣攴慥⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Entering several tuplets using only one \times command ====================================================== The property `tupletSpannerDuration' sets how long each of the tuplets contained within the brackets after `\times' should last. Many consecutive tuplets can then be placed within a single `\times' expression, thus saving typing. In the example, two triplets are shown, while `\times' was entered only once. For more information about `make-moment', see "Time administration". \relative c' { \time 2/4 \set tupletSpannerDuration = #(ly:make-moment 1 4) \times 2/3 { c8 c c c c c } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼴楬祬㤭㘳戰㤲⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Flat flags and beam nibs ======================== Flat flags on lone notes and beam nibs at the ends of beamed figures are both possible with a combination of `stemLeftBeamCount', `stemRightBeamCount' and paired `[]' beam indicators. For right-pointing flat flags on lone notes, use paired `[]' beam indicators and set `stemLeftBeamCount' to zero (see Example 1). For left-pointing flat flags, set `stemRightBeamCount' instead (Example 2). For right-pointing nibs at the end of a run of beamed notes, set `stemRightBeamCount' to a positive value. And for left-pointing nibs at the start of a run of beamed notes, set `stemLeftBeamCount' instead (Example 3). Sometimes it may make sense for a lone note surrounded by rests to carry both a left- and right-pointing flat flag. Do this with paired `[]' beam indicators alone (Example 4). (Note that `\set stemLeftBeamCount' is always equivalent to `\once \set'. In other words, the beam count settings are not "sticky", so the pair of flat flags attached to the lone `c'16[]' in the last example have nothing to do with the `\set' two notes prior.) \score { << % Example 1 \new RhythmicStaff { \set stemLeftBeamCount = #0 c16[] r8. } % Example 2 \new RhythmicStaff { r8. \set stemRightBeamCount = #0 c16[] } % Example 3 \new RhythmicStaff { c16 c \set stemRightBeamCount = #2 c16 r r \set stemLeftBeamCount = #2 c16 c c } % Example 4 \new RhythmicStaff { c16 c \set stemRightBeamCount = #2 c16 r c16[] r16 \set stemLeftBeamCount = #2 c16 c } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼴楬祬戭㌳㤱愲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Forcing rehearsal marks to start from a given letter or number ============================================================== This snippet demonstrates how to obtain automatic ordered rehearsal marks, but from the letter or number desired. \relative c''{ c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark #14 c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark \default \break \set Score.markFormatter = #format-mark-numbers c1 \mark #1 c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark #14 c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark \default } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽦楬祬昭ㄷ㕣㈵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Grouping beats ============== Beaming patterns may be altered with the `beatGrouping' property: \relative c'' { \time 5/16 #(override-auto-beam-setting '(end * * 5 16) 5 16) \set beatGrouping = #'(2 3) c8^"(2+3)" c16 c8 \set beatGrouping = #'(3 2) c8^"(3+2)" c16 c8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽥楬祬ㄭ慣㍤㕥湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Guitar strum rhythms ==================== For guitar music, it is possible to show strum rhythms, along with melody notes, chord names and fret diagrams. \include "predefined-guitar-fretboards.ly" << \new ChordNames { \chordmode { c1 f g c } } \new FretBoards { \chordmode { c1 f g c } } \new Voice \with { \consists "Pitch_squash_engraver" } { \relative c'' { \improvisationOn c4 c8 c c4 c8 c f4 f8 f f4 f8 f g4 g8 g g4 g8 g c4 c8 c c4 c8 c } } \new Voice = "melody" { \relative c'' { c2 e4 e4 f2. r4 g2. a4 e4 c2. } } \new Lyrics { \lyricsto "melody" { This is my song. I like to sing. } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼹楬祬㘭㡦㐹㤲⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Heavily customized polymetric time signatures ============================================= Though the polymetric time signature shown was not the most essential item here, it has been included to show the beat of this piece (which is the template of a real Balkan song!). #(define plus (markup #:vcenter "+")) #(define ((custom-time-signature one two three four five six seven eight nine ten eleven num) grob) (grob-interpret-markup grob (markup #:override '(baseline-skip . 0) #:number (#:line ( (#:column (one num)) plus (#:column (two num)) plus (#:column (three num)) plus (#:column (four num)) plus (#:column (five num)) plus (#:column (six num)) plus (#:column (seven num)) plus (#:column (eight num)) plus (#:column (nine num)) plus (#:column (ten num)) plus (#:column (eleven num))))))) melody = \relative c'' { \set Staff.instrumentName = #"Bb Sop." \key g \major #(set-time-signature 25 8 '(3 2 2 3 2 2 2 2 3 2 2)) \override Staff.TimeSignature #'stencil = #(custom-time-signature "3" "2" "2" "3" "2" "2" "2" "2" "3" "2" "2" "8") c8 c c d4 c8 c b c b a4 g fis8 e d c b' c d e4-^ fis8 g \break c,4. d4 c4 d4. c4 d c2 d4. e4-^ d4 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break } drum = \new DrumStaff \drummode { \bar "|:" bd4.^\markup { "Drums" } sn4 bd \bar ":" sn4. bd4 sn \bar ":" bd sn bd4. sn4 bd \bar ":|" } { \melody \drum } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼳楬祬㈭つ㡥づ⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Making an object invisible with the 'transparent property ========================================================= Setting the `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. This 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'' { \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 g8 ~ g\noBeam } \\ { b8 g g e } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽥楬祬愭ㄵ换慢湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Manually controlling beam positions =================================== Beam positions may be controlled manually, by overriding the `positions' setting of the `Beam' grob. \relative c' { \time 2/4 % from upper staff-line (position 2) to center (position 0) \override Beam #'positions = #'(2 . 0) c8 c % from center to one above center (position 1) \override Beam #'positions = #'(0 . 1) c8 c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼱楬祬攭㤹捤㤴⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Merging multi-measure rests in a polyphonic part ================================================ When using multi-measure rests in a polyphonic staff, the rests will be placed differently depending on the voice they belong to. However they can be printed on the same staff line, using the following setting. normalPos = \revert MultiMeasureRest #'staff-position { << { c''1 R1 c''1 \normalPos R1 } \\ { c'1 R1 c'1 \normalPos R1 } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⼵楬祬㔭㐰搴㘴⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Modifying tuplet bracket length =============================== Tuplet brackets can be made to run to prefatory matter or the next note. Default tuplet brackets end at the right edge of the final note of the tuplet; full-length tuplet brackets extend farther to the right, either to cover all the non-rhythmic notation up to the following note, or to cover only the whitespace before the next item of notation, be that a clef, time signature, key signature, or another note. The example shows how to switch tuplets to full length mode and how to modify what material they cover. \new RhythmicStaff { % Set tuplets to be extendable... \set tupletFullLength = ##t % ...to cover all items up to the next note \set tupletFullLengthNote = ##t \time 2/4 \times 2/3 { c4 c c } % ...or to cover just whitespace \set tupletFullLengthNote = ##f \time 4/4 \times 4/5 { c4 c1 } \time 3/4 c2. } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼵楬祬〭㌰挸换⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Multi-measure rest markup ========================= Markups attached to a multi-measure rest will be centered above or below it. Long markups attached to multi-measure rests do not cause the measure to expand. To expand a multi-measure rest to fit the markup, use a spacer rest with an attached markup before the multi-measure rest. Note that the spacer rest causes a bar line to be inserted. Text attached to a spacer rest in this way is left-aligned to the position where the note would be placed in the measure, but if the measure length is determined by the length of the text, the text will appear to be centered. \relative c' { \compressFullBarRests \textLengthOn s1*0^\markup { [MAJOR GENERAL] } R1*19 s1*0_\markup { \italic { Cue: ... it is yours } } s1*0^\markup { A } R1*30^\markup { [MABEL] } \textLengthOff c4^\markup { CHORUS } d f c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼶楬祬戭捣搷捡⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Permitting line breaks within beamed tuplets ============================================ This artificial example shows how both manual and automatic line breaks may be permitted to within a beamed tuplet. Note that such off-beat tuplets have to be beamed manually. \layout { \context { \Voice % Permit line breaks within tuplets \remove "Forbid_line_break_engraver" % Allow beams to be broken at line breaks \override Beam #'breakable = ##t } } \relative c'' { a8 \repeat unfold 5 { \times 2/3 { c[ b a] } } % Insert a manual line break within a tuplet \times 2/3 { c[ b \bar "" \break a] } \repeat unfold 5 { \times 2/3 { c[ b a] } } c8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⽡楬祬攭㈹捦湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Positioning grace notes with floating space =========================================== Setting the property `'strict-grace-spacing' makes the musical columns for grace notes 'floating', i.e., decoupled from the non-grace notes: first the normal notes are spaced, then the (musical columns of the) graces are put left of the musical columns for the main notes. \relative c'' { << \override Score.SpacingSpanner #'strict-grace-spacing = ##t \new Staff \new Voice { \afterGrace c4 { c16[ c8 c16] } c8[ \grace { b16[ d] } c8] c4 r } \new Staff { c16 c c c c c c c c4 r } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⽥楬祬㌭㑤〳㥣湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Positioning multi-measure rests =============================== Unlike ordinary rests, there is no predefined command to change the staff position of a multi-measure rest symbol of either form by attaching it to a note. However, in polyphonic music multi-measure rests in odd-numbered and even-numbered voices are vertically separated. The positioning of multi-measure rests can be controlled as follows: \relative c'' { % Multi-measure rests by default are set under the fourth 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 measures << { 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 } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⽥楬祬搭㜱㘱戱⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing bar numbers at regular intervals ========================================= Bar numbers can be printed at regular intervals by setting the property `barNumberVisibility'. Here the bar numbers are printed every two measures except at the end of the line. \relative c' { \override Score.BarNumber #'break-visibility = #'#(#f #t #t) \set Score.currentBarNumber = #11 % Permit first bar number to be printed \bar "" % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 | c | c | c | c \break c1 | c | c | c | c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⼸楬祬愭ㄳ㕣㠲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing bar numbers inside boxes or circles ============================================ Bar numbers can also be printed inside boxes or circles. \relative c' { % Prevent bar numbers at the end of a line and permit them elsewhere \override Score.BarNumber #'break-visibility = #end-of-line-invisible \set Score.barNumberVisibility = #(every-nth-bar-number-visible 4) % Increase the size of the bar number by 2 \override Score.BarNumber #'font-size = #2 % Draw a box round the following bar number(s) \override Score.BarNumber #'stencil = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print) \repeat unfold 5 { c1 } % Draw a circle round the following bar number(s) \override Score.BarNumber #'stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print) \repeat unfold 4 { c1 } \bar "|." } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼴楬祬ㄭ㔸愶〶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing metronome and rehearsal marks below the staff ====================================================== By default, metronome and rehearsal marks are printed above the staff. To place them below the staff simply set the `direction' property of `MetronomeMark' or `RehearsalMark' appropriately. \layout { ragged-right = ##f } { % Metronome marks below the staff \override Score.MetronomeMark #'direction = #DOWN \tempo 8. = 120 c''1 % Rehearsal marks below the staff \override Score.RehearsalMark #'direction = #DOWN \mark \default c''1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼶楬祬搭挷愷㤷⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing music with different time signatures ============================================= In the following snippet, two parts have a completely different time signature, yet remain synchronized. The bar lines can no longer be printed at the `Score' level; to allow independent bar lines in each part, the `Default_barline_engraver' and `Timing_translator' are moved from the `Score' context to the `Staff' context. \paper { indent = #0 ragged-right = ##t } global = { \time 3/4 { s2.*3 } \bar "" \break { s2.*3 } } \layout { \context { \Score \remove "Timing_translator" \remove "Time_signature_engraver" \remove "Default_bar_line_engraver" \override SpacingSpanner #'uniform-stretching = ##t \override SpacingSpanner #'strict-note-spacing = ##t proportionalNotationDuration = #(ly:make-moment 1 64) } \context { \Staff \consists "Timing_translator" \consists "Default_bar_line_engraver" \consists "Time_signature_engraver" } \context { \Voice \remove "Forbid_line_break_engraver" tupletFullLength = ##t } } Bassklarinette = \new Staff << \global { \bar "|" \clef treble \time 3/8 d''4. \bar "|" \time 3/4 r8 des''2( c''8) \bar "|" \time 7/8 r4. ees''2 ~ \bar "|" \time 2/4 \tupletUp \times 2/3 { ees''4 r4 d''4 ~ } \bar "|" \time 3/8 \tupletUp \times 3/4 { d''4 r4 } \bar "|" \time 2/4 e''2 \bar "|" \time 3/8 es''4. \bar "|" \time 3/4 r8 d''2 r8 \bar "|" } >> Perkussion = \new StaffGroup << \new Staff << \global { \bar "|" \clef percussion \time 3/4 r4 c'2 ~ \bar "|" c'2. \bar "|" R2. \bar "|" r2 g'4 ~ \bar "|" g'2. ~ \bar "|" g'2. } >> \new Staff << \global { \bar "|" \clef percussion \time 3/4 R2. \bar "|" g'2. ~ \bar "|" g'2. \bar "|" r4 g'2 ~ \bar "|" g'2 r4 \bar "|" g'2. } >> >> \score { << \Bassklarinette \Perkussion >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼸楬祬㘭搲㔵⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing the bar number for the first measure ============================================= By default, the first bar number in a score is suppressed if it is less than or equal to `1'. By setting `barNumberVisibility' to `all-bar-numbers-visible', any bar number can be printed for the first measure and all subsequent measures. Note that an empty bar line must be inserted before the first note for this to work. \relative c' { \set Score.barNumberVisibility = #all-bar-numbers-visible \bar "" c1 d e f \break g1 e d c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼱楬祬昭㌶昹ㄲ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Redefining grace note global defaults ===================================== The global defaults for grace notes are stored in the identifiers `startGraceMusic', `stopGraceMusic', `startAcciaccaturaMusic', `stopAcciaccaturaMusic', `startAppoggiaturaMusic' and `stopAppoggiaturaMusic', which are defined in the file `ly/grace-init.ly'. By redefining them other effects may be obtained. startAcciaccaturaMusic = { s1*0( \override Stem #'stroke-style = #"grace" \slurDashed } stopAcciaccaturaMusic = { \revert Stem #'stroke-style \slurSolid s1*0) } \relative c'' { \acciaccatura d8 c1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⽥楬祬〭㘴晤㐸⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Removing bar numbers from a score ================================= Bar numbers can be removed entirely by removing the `Bar_number_engraver' from the `Score' context. \layout { \context { \Score \remove "Bar_number_engraver" } } \relative c'' { c4 c c c \break c4 c c c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼷楬祬㌭㑡㔹昱⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Rest styles =========== Rests may be used in various styles. \layout { indent = 0.0 \context { \Staff \remove "Time_signature_engraver" } } \new Staff \relative c { \cadenzaOn \override Staff.Rest #'style = #'mensural r\maxima^\markup \typewriter { mensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \override Staff.Rest #'style = #'neomensural r\maxima^\markup \typewriter { neomensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \override Staff.Rest #'style = #'classical r\maxima^\markup \typewriter { classical } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 \bar "" \override Staff.Rest #'style = #'default r\maxima^\markup \typewriter { default } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼴楬祬昭昸攴摥⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Reverting default beam endings ============================== To typeset beams grouped `3-4-3-2' in 12/8 it is necessary first to override the default beam endings in 12/8, and then to set up the new beaming endings: \relative c'' { \time 12/8 % Default beaming a8 a a a a a a a a a a a % Revert default values in scm/auto-beam.scm for 12/8 time #(revert-auto-beam-setting '(end * * 12 8) 3 8) #(revert-auto-beam-setting '(end * * 12 8) 3 4) #(revert-auto-beam-setting '(end * * 12 8) 9 8) a8 a a a a a a a a a a a % Set new values for beam endings #(override-auto-beam-setting '(end * * 12 8) 3 8) #(override-auto-beam-setting '(end * * 12 8) 7 8) #(override-auto-beam-setting '(end * * 12 8) 10 8) a8 a a a a a a a a a a a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼴楬祬㐭㔰㤰挶⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Rhythmic slashes ================ In "simple" lead-sheets, sometimes no actual notes are written, instead only "rhythmic patterns" and chords above the measures are notated giving the structure of a song. Such a feature is for example useful while creating/transcribing the structure of a song and also when sharing lead sheets with guitarists or jazz musicians. The standard support for this using `\repeat percent' is unsuitable here since the first beat has to be an ordinary note or rest. This example shows two solutions to this problem, by redefining ordinary rests to be printed as slashes. (If the duration of each beat is not a quarter note, replace the `r4' in the definitions with a rest of the appropriate duration). % Macro to print single slash rs = { \once \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash \once \override Rest #'thickness = #0.48 \once \override Rest #'slope = #1.7 r4 } % Function to print a specified number of slashes comp = #(define-music-function (parser location count) ( integer?) #{ \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash \override Rest #'thickness = #0.48 \override Rest #'slope = #1.7 \repeat unfold $count { r4 } \revert Rest #'stencil #} ) \score { \relative c' { c4 d e f | \rs \rs \rs \rs | \comp #4 | } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⽤楬祬㌭扦㑡㜳⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Skips in lyric mode (2) ======================= Although `s' skips cannot be used in `\lyricmode' (it is taken to be a literal "s", not a space), double quotes (`""') or underscores (`_') are available.So for example: << \relative c'' { a4 b c d } \new Lyrics \lyricmode { a4 "" _ gap } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼸楬祬㈭ㅥ收㥣湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Skips in lyric mode =================== The `s' syntax for skips is only available in note mode and chord mode. In other situations, for example, when entering lyrics, using the `\skip' command is recommended. << \relative { a'1 a } \new Lyrics \lyricmode { \skip 1 bla1 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼰楬祬㐭㔶ㄷ扦湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Specifying context with beatGrouping ==================================== By specifying the context, the effect of `beatGrouping' can be limited to the context specified, and the values which may have been set in higher-level contexts can be overridden. The `\set' commands must be placed after all `\time' commands: \score { \new Staff << \time 7/8 \new Voice { \relative c'' { \set Staff.beatGrouping = #'(2 3 2) a8 a a a a a a } } \new Voice { \relative c' { \voiceTwo \set beatGrouping = #'(1 3 3) f8 f f f f f f } } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼹楬祬㈭㑣慦戱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Stemlets ======== In some notational conventions beams are allowed to extend over rests. Depending on preference, these beams may drop 'stemlets' to help the eye appreciate the rhythm better, and in some modern music the rest itself is omitted and only the stemlet remains. This snippet shows a progression from traditional notation, to beams over the rest, to stemlets over the rest, to stemlets alone. Stemlets are generated by overriding the `'stemlet-length' property of `Stem', while rests are hidden by setting `'transparent = ##t'. Some `\markup' elements are included in the source to highlight the different notations. \paper { ragged-right = ##f } { c'16^\markup { traditional } d' r f' g'16[^\markup { beams over rests } f' r d'] % N.B. use Score.Stem to set for the whole score. \override Staff.Stem #'stemlet-length = #0.75 c'16[^\markup { stemlets over rests } d' r f'] g'16[^\markup { stemlets and no rests } f' \once \override Rest #'transparent = ##t r d'] } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⽡楬祬愭搷㝤搳⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Sub-dividing beams ================== The beams of consecutive 16th (or shorter) notes are, by default, not sub-divided. That is, the three (or more) beams stretch unbroken over entire groups of notes. This behavior can be modified to sub-divide the beams into sub-groups by setting the property `subdivideBeams'. When set, multiple beams will be sub-divided at intervals defined by the current value of `beatLength' by reducing the multiple beams to just one beam between the sub-groups. Note that `beatLength' defaults to one over the denominator of the current time signature if not set explicitly. It must be set to a fraction giving the duration of the beam sub-group using the `make-moment' function, as shown here: \relative c'' { c32[ c c c c c c c] \set subdivideBeams = ##t c32[ c c c c c c c] % Set beam sub-group length to an eighth note \set beatLength = #(ly:make-moment 1 8) c32[ c c c c c c c] % Set beam sub-group length to a sixteenth note \set beatLength = #(ly:make-moment 1 16) c32[ c c c c c c c] } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⼵楬祬㈭㈸㔷㑡⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Three-sided box =============== This example shows how to add a markup command to get a three sided box around some text (or other markup). % New command to add a three sided box, with sides north, west and south % Based on the box-stencil command defined in scm/stencil.scm % Note that ";" is used to comment a line in Scheme #(define-public (NWS-box-stencil stencil thickness padding) "Add a box around STENCIL, producing a new stencil." (let* ((x-ext (interval-widen (ly:stencil-extent stencil 0) padding)) (y-ext (interval-widen (ly:stencil-extent stencil 1) padding)) (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext)) (x-rule (make-filled-box-stencil (interval-widen x-ext thickness) (cons 0 thickness)))) ; (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil X -1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil Y 1 x-rule 0.0)) (set! stencil (ly:stencil-combine-at-edge stencil Y -1 x-rule 0.0)) stencil)) % The corresponding markup command, based on the \box command defined % in scm/define-markup-commands.scm #(define-markup-command (NWS-box layout props arg) (markup?) "Draw a box round @var{arg}. Looks at @code{thickness}, @code{box-padding} and @code{font-size} properties to determine line thickness and padding around the markup." (let* ((th (chain-assoc-get 'thickness props 0.1)) (size (chain-assoc-get 'font-size props 0)) (pad (* (magstep size) (chain-assoc-get 'box-padding props 0.2))) (m (interpret-markup layout props arg))) (NWS-box-stencil m th pad))) % Test it: \layout { ragged-right = ##f } \relative c' { c2^\markup { \NWS-box ABCD } c2^\markup { \NWS-box \note #"4" #1.0 } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⽢楬祬㘭㔸㔸㠱⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Time signature printing only the numerator as a number (instead of the fraction) ================================================================================ Sometimes, a time signature should not print the whole fraction (e.g. 7/4), but only the numerator (7 in this case). This can be easily done by using \override Staff.TimeSignature #'style = #'single-digit to change the style permanently. By using \revert Staff.TimeSignature #'style, this setting can be reversed. To apply the single-digit style to only one time signature, use the \override command and prefix it with a \once. \relative c'' { \time 3/4 c4 c c % Change the style permanently \override Staff.TimeSignature #'style = #'single-digit \time 2/4 c c \time 3/4 c c c % Revert to default style: \revert Staff.TimeSignature #'style \time 2/4 c c % single-digit style only for the next time signature \once \override Staff.TimeSignature #'style = #'single-digit \time 5/4 c c c c c \time 2/4 c c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⽦楬祬㔭㍡㕥戱⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Tweaking grace layout within music ================================== The layout of grace expressions can be changed throughout the music using the functions `add-grace-property' and `remove-grace-property'. The following example undefines the `Stem' direction for this grace, so that stems do not always point up, and changes the default note heads to crosses. \relative c'' { \new Staff { #(remove-grace-property 'Voice 'Stem 'direction) #(add-grace-property 'Voice 'NoteHead 'style 'cross) \new Voice { \acciaccatura { f16 } g4 \grace { d16[ e] } f4 \appoggiatura { f,32[ g a] } e2 } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⽦楬祬㘭㙥㉡㑡⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Using beatLength and beatGrouping ================================= The property `measureLength' determines where bar lines should be inserted and, with `beatLength' and `beatGrouping', how automatic beams should be generated for beam durations and time signatures for which no beam-ending rules are defined. This example shows several ways of controlling beaming by setting these properties. The explanations are shown as comments in the code. \relative c'' { \time 3/4 % The default in 3/4 time is to beam in three groups % each of a quarter note length a16 a a a a a a a a a a a \time 12/16 % No auto-beaming is defined for 12/16 a16 a a a a a a a a a a a \time 3/4 % Change time signature symbol, but retain underlying 3/4 beaming \set Score.timeSignatureFraction = #'(12 . 16) a16 a a a a a a a a a a a % The 3/4 time default grouping of (1 1 1) and beatLength of 1/8 % are not consistent with a measureLength of 3/4, so the beams % are grouped at beatLength intervals \set Score.beatLength = #(ly:make-moment 1 8) a16 a a a a a a a a a a a % Specify beams in groups of (3 3 2 3) 1/16th notes % 3+3+2+3=11, and 11*1/16<>3/4, so beatGrouping does not apply, % and beams are grouped at beatLength (1/16) intervals \set Score.beatLength = #(ly:make-moment 1 16) \set Score.beatGrouping = #'(3 3 2 3) a16 a a a a a a a a a a a % Specify beams in groups of (3 4 2 3) 1/16th notes % 3+4+2+3=12, and 12*1/16=3/4, so beatGrouping applies \set Score.beatLength = #(ly:make-moment 1 16) \set Score.beatGrouping = #'(3 4 2 3) a16 a a a a a a a a a a a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼱楬祬攭㡦㕤㕡⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Using grace note slashes with normal heads ========================================== The slash through the stem found in acciaccaturas can be applied in other situations. \relative c'' { \override Stem #'stroke-style = #"grace" c8( d2) e8( f4) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⽣楬祬㐭㐴㡤㈴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Using ties with arpeggios ========================= Ties are sometimes used to write out arpeggios. In this case, two tied notes need not be consecutive. This can be achieved by setting the `tieWaitForNote' property to `#t'. The same feature is also useful, for example, to tie a tremolo to a chord, but in principle, it can also be used for ordinary consecutive notes. \relative c' { \set tieWaitForNote = ##t \grace { c16[ ~ e ~ g] ~ } <c, e g>2 \repeat tremolo 8 { c32 ~ c' ~ } <c c,>1 e8 ~ c ~ a ~ f ~ <e' c a f>2 \tieUp c8 ~ a \tieDown \tieDotted g8 ~ c g2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼶楬祬搭㌹昸㜸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Expressive marks, Next: Repeats, Prev: Rhythms, Up: Top Expressive marks **************** These snippets illustrate *note Expressive marks: (lilypond)Expressive marks. Adding beams, slurs, ties etc. when using tuplet and non-tuplet rhythms ======================================================================= LilyPond syntax can involve many unusual placements for parentheses, brackets etc., which might sometimes have to be interleaved. For example, when entering a manual beam, the left square bracket has to be placed after the starting note and its duration, not before. Similarly, the right square bracket should directly follow the note which is to be at the end of the requested beaming, even if this note happens to be inside a tuplet section. This snippet demonstrates how to combine manual beaming, manual slurs, ties and phrasing slurs with tuplet sections (enclosed within curly braces). { r16[ g16 \times 2/3 { r16 e'8] } g16( a \times 2/3 { b d e') } g8[( a \times 2/3 { b d') e'] ~ } \time 2/4 \times 4/5 { e'32\( a b d' e' } a'4.\) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼵楬祬㜭㍥㍢㕥⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Adding parentheses around an expressive mark or chordal note ============================================================ The `\parenthesize' function is a special tweak that encloses objects in parentheses. The associated grob is `Score.ParenthesesItem'. \relative c' { c2-\parenthesize -> \override ParenthesesItem #'padding = #0.1 \override ParenthesesItem #'font-size = #-4 <d \parenthesize f a>2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼶楬祬愭ㄷ〴㉡⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Adjusting the shape of falls and doits ====================================== The `shortest-duration-space' property may have to be tweaked to adjust the shape of falls and doits. \relative c'' { \override Score.SpacingSpanner #'shortest-duration-space = #4.0 c2-\bendAfter #+5 c2-\bendAfter #-3 c2-\bendAfter #+8 c2-\bendAfter #-6 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼲楬祬㈭㔲ㅤ昸⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Breathing signs =============== Breathing signs are available in different tastes: commas (default), ticks, vees and "railroad tracks" (caesura). \new Staff \relative c'' { \key es \major \time 3/4 % this bar contains no \breathe << { g4 as g } \\ { es4 bes es } >> | % Modern notation: % by default, \breathe uses the rcomma, just as if saying: % \override BreathingSign #'text = #(make-musicglyph-markup "scripts.rcomma") << { g4 as g } \\ { es4 \breathe bes es } >> | % rvarcomma and lvarcomma are variations of the default rcomma and lcomma % N.B.: must use Staff context here, since we start a Voice below \override Staff.BreathingSign #'text = \markup { \musicglyph #"scripts.rvarcomma" } << { g4 as g } \\ { es4 \breathe bes es } >> | % vee \override BreathingSign #'text = \markup { \musicglyph #"scripts.upbow" } es8[ d es f g] \breathe f | % caesura \override BreathingSign #'text = \markup { \musicglyph #"scripts.caesura.curved" } es8[ d] \breathe es[ f g f] | es2 r4 \bar "||" } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⽡楬祬㘭㔲ㅢ㥥湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Broken Crescendo Hairpin ======================== 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 `setgray' in the postscript definition can be set to a value less than one, making it grey. The two numbers before `scale' in the postscript code are responsible for the width and height of the rectangle, the two numbers before `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 draw the rectangle over the hairpin. \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 } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼵楬祬㜭㝥扢昷⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Caesura ("railtracks") with fermata =================================== A caesura is sometimes denoted by a double "railtracks" breath mark with a fermata sign positioned above. This snippet should present an optically pleasing combination of railtracks and fermata. \relative c'' { c2. % construct the symbol \override BreathingSign #'text = \markup { \line { \musicglyph #"scripts.caesura.curved" \translate #'(-1.75 . 1.6) \musicglyph #"scripts.ufermata" } } \breathe c4 % set the breathe mark back to normal \revert BreathingSign #'text c2. \breathe c4 \bar "|." } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⽤楬祬㘭ㄷ挱〴⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Center text below hairpin dynamics ================================== This example provides a function to typeset a hairpin (de)crescendo with some additional text below it, such as "molto" or "poco". The example also illustrates how to modify the way an object is normally printed, using some Scheme code. hairpinWithCenteredText = #(define-music-function (parser location text) (markup?) #{ \override Voice.Hairpin #'stencil = #(lambda (grob) (ly:stencil-aligned-to (ly:stencil-combine-at-edge (ly:stencil-aligned-to (ly:hairpin::print grob) X CENTER) Y DOWN (ly:stencil-aligned-to (grob-interpret-markup grob $text) X CENTER)) X LEFT)) #}) hairpinMolto = \hairpinWithCenteredText \markup { \italic molto } hairpinMore = \hairpinWithCenteredText \markup { \larger moltissimo } \layout { ragged-right = ##f } \relative c' { \hairpinMolto c2\< c\f \hairpinMore c2\< c\f } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼰楬祬㜭ㄹ搹ㅤ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing \flageolet mark size ============================= To make the `\flageolet' circle smaller use the following Scheme function. smallFlageolet = #(let ((m (make-music 'ArticulationEvent 'articulation-type "flageolet"))) (ly:music-set-property! m 'tweaks (acons 'font-size -3 (ly:music-property m 'tweaks))) m) \layout { ragged-right = ##f } \relative c'' { d4^\flageolet_\markup { default size } d_\flageolet c4^\smallFlageolet_\markup { smaller } c_\smallFlageolet } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⽢楬祬㈭扢ㄴ㈱⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing text and spanner styles for text dynamics ================================================== The text used for crescendos and decrescendos can be changed by modifying the context properties `crescendoText' and `decrescendoText'. The style of the spanner line can be changed by modifying the `'style' property of `DynamicTextSpanner'. The default value is `'hairpin', and other possible values include `'line', `'dashed-line' and `'dotted-line'. \relative c'' { \set crescendoText = \markup { \italic { cresc. poco } } \set crescendoSpanner = #'text \override DynamicTextSpanner #'style = #'dotted-line a2\< a a2 a a2 a a2 a\mf } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⽥楬祬㐭挳㍤㍥湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the appearance of a slur from solid to dotted or dashed ================================================================ The appearance of slurs may be changed from solid to dotted or dashed. \relative c' { c4( d e c) \slurDotted c4( d e c) \slurSolid c4( d e c) \slurDashed c4( d e c) \slurSolid c4( d e c) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽥楬祬〭㉡㜹㕦⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the breath mark symbol =============================== The glyph of the breath mark can be tuned by overriding the text property of the `BreathingSign' layout object with any markup text. \relative c'' { c2 \override BreathingSign #'text = \markup { \musicglyph #"scripts.rvarcomma" } \breathe d2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼵楬祬㤭昵ち〱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Combining dynamics with markup texts ==================================== Some dynamics may involve text indications (such as "più forte" or "piano subito"). They can be produced using a `\markup' block. piuF = \markup { \italic più \dynamic f } \layout { ragged-right = ##f } \relative c'' { c2\f c-\piuF } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⼲楬祬㔭㤱㕢㍡⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Contemporary glissando ====================== A contemporary glissando without a final note can be typeset using a hidden note and cadenza timing. \relative c'' { \time 3/4 \override Glissando #'style = #'zigzag c4 c \cadenzaOn c4\glissando \hideNotes c,,4 \unHideNotes \cadenzaOff \bar "|" } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⽥楬祬㠭愱㕣㈴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Controlling the vertical ordering of scripts ============================================ The vertical ordering of scripts is controlled with the `'script-priority' property. The lower this number, the closer it will be put to the note. In this example, the `TextScript' (the sharp symbol) first has the lowest priority, so it is put lowest in the first example. In the second, the prall trill (the `Script') has the lowest, so it is on the inside. When two objects have the same priority, the order in which they are entered determines which one comes first. \relative c''' { \once \override TextScript #'script-priority = #-100 a2^\prall^\markup { \sharp } \once \override Script #'script-priority = #-100 a2^\prall^\markup { \sharp } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⽤楬祬㘭㍥㘹㘲⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating a delayed turn ======================= Creating a delayed turn, where the lower note of the turn uses the accidental, requires several overrides. The `outside-staff-priority' property must be set to `#f', as otherwise this would take precedence over the `avoid-slur property'. The value of `halign' is used to position the turn horizontally. \relative c'' { \once \override TextScript #'avoid-slur = #'inside \once \override TextScript #'outside-staff-priority = ##f c2(^\markup \tiny \override #'(baseline-skip . 1) { \halign #-4 \center-column { \sharp \musicglyph #"scripts.turn" } } d4.) c8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⽢楬祬攭〳晣っ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating arpeggios across notes in different voices =================================================== An arpeggio can be drawn across notes in different voices on the same staff if the `Span_arpeggio_engraver' is moved to the `Staff' context: \new Staff \with { \consists "Span_arpeggio_engraver" } \relative c' { \set Staff.connectArpeggios = ##t << { <e' g>4\arpeggio <d f> <d f>2 } \\ { <d, f>2\arpeggio <g b>2 } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼳楬祬〭㝤搱扦⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating cross-staff arpeggios in a piano staff =============================================== In a `PianoStaff', it is possible to let an arpeggio cross between the staves by setting the property `PianoStaff.connectArpeggios'. \new PianoStaff \relative c'' << \set PianoStaff.connectArpeggios = ##t \new Staff { <c e g c>4\arpeggio <g c e g>4\arpeggio <e g c e>4\arpeggio <c e g c>4\arpeggio } \new Staff { \clef bass \repeat unfold 4 { <c,, e g c>4\arpeggio } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼸楬祬㤭〷ㄱㅥ⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating cross-staff arpeggios in other contexts ================================================ Cross-staff arpeggios can be created in contexts other than `PianoStaff' if the `Span_arpeggio_engraver' is included in the `Score' context. \score { \new StaffGroup { \set Score.connectArpeggios = ##t << \new Voice \relative c' { <c e>2\arpeggio <d f>2\arpeggio <c e>1\arpeggio } \new Voice \relative c { \clef bass <c g'>2\arpeggio <b g'>2\arpeggio <c g'>1\arpeggio } >> } \layout { \context { \Score \consists "Span_arpeggio_engraver" } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼶楬祬搭つ扢昵⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating "real" parenthesized dynamics ====================================== Although the easiest way to add parentheses to a dynamic mark is to use a `\markup' block, this method has a downside: the created objects will behave like text markups, and not like dynamics. However, it is possible to create a similar object using the equivalent Scheme code (as described in "Markup programmer interface"), combined with the `make-dynamic-script' function. This way, the markup will be regarded as a dynamic, and therefore will remain compatible with commands such as `\dynamicUp' or `\dynamicDown'. parenF = #(make-dynamic-script (markup #:line (#:normal-text #:italic #:fontsize 2 "(" #:hspace -0.8 #:dynamic "f" #:normal-text #:italic #:fontsize 2 ")"))) \relative c'' { c4\parenF c c \dynamicUp c\parenF } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼹楬祬㘭㠲㑡㍡⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating simultaneous rehearsal marks ===================================== Unlike text scripts, rehearsal marks cannot be stacked at a particular point in a score: only one `RehearsalMark' object is created. Using an invisible measure and bar line, an extra rehearsal mark can be added, giving the appearance of two marks in the same column. This method may also prove useful for placing rehearsal marks at both the end of one system and the start of the following system. { \key a \major \set Score.markFormatter = #format-mark-box-letters \once \override Score.RehearsalMark #'outside-staff-priority = #5000 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \once \override Score.RehearsalMark #'break-align-symbols = #'(key-signature) \mark \markup { \bold { Senza denti } } % the hidden measure and bar line \once \override Score.TimeSignature #'stencil = ##f \time 1/16 s16 \bar "" \time 4/4 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \mark \markup { \box \bold Intro } d'1 \mark \default d'1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼸楬祬愭つ㐶摦⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating slurs across voices ============================ In some situations, it may be necessary to create slurs between notes from different voices. The solution is to add invisible notes to one of the voices, using `\hideNotes'. This example is measure 235 of the Ciaconna from Bach's 2nd Partita for solo violin, BWV 1004. \relative c' { << { d16( a') s a s a[ s a] s a[ s a] } \\ { \slurUp bes,16[ s e]( \hideNotes a) \unHideNotes f[( \hideNotes a) \unHideNotes fis]( \hideNotes a) \unHideNotes g[( \hideNotes a) \unHideNotes gis]( \hideNotes a) } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⽢楬祬㈭扡愹㔸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating text spanners ====================== The `\startTextSpan' and `\stopTextSpan' commands allow the creation of text spanners as easily as pedal indications or octavations. Override some properties of the `TextSpanner' object to modify its output. \paper { ragged-right = ##f } \relative c'' { \override TextSpanner #'(bound-details left text) = #"bla" \override TextSpanner #'(bound-details right text) = #"blu" a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner #'style = #'line \once \override TextSpanner #'(bound-details left stencil-align-dir-y) = #CENTER a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner #'style = #'dashed-line \override TextSpanner #'(bound-details left text) = \markup { \draw-line #'(0 . 1) } \override TextSpanner #'(bound-details right text) = \markup { \draw-line #'(0 . -2) } \once \override TextSpanner #'(bound-details right padding) = #-2 a4 \startTextSpan b4 c a4 \stopTextSpan \set Staff.middleCPosition = #-13 \override TextSpanner #'dash-period = #10 \override TextSpanner #'dash-fraction = #0.5 \override TextSpanner #'thickness = #10 a4 \startTextSpan b4 c a4 \stopTextSpan } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼳楬祬㐭㔱昶㙣⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Double glissando ================ To connect chords with glissando lines, attach a second glissando to a hidden voice. \relative c { \clef bass << { % new voice ( = \voiceOne), hidden \hideNotes % attach glissando to note heads e2\glissando g } \\ { % original voice with chords rearranged so that % glissando is attached to a & c <e a,>2\glissando <g c,> } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼰楬祬愭㔰㌱扥湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Hiding the extender line for text dynamics ========================================== Text style dynamic changes (such as cresc. and dim.) are printed with a dashed line showing their extent. This line can be suppressed in the following way: \relative c'' { \override DynamicTextSpanner #'dash-period = #-1.0 \crescTextCresc c1\< | d | b | c\! } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽡楬祬㤭㥤戱ㅣ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Horizontally aligning custom dynamics (e.g. "sempre pp", "piu f", "subito p") ============================================================================= Some dynamic expressions involve additional text, like "sempre pp". Since lilypond aligns all dynamics centered on the note, the \pp would be displayed way after the note it applies to. To correctly align the "sempre \pp" horizontally, so that it is aligned as if it were only the \pp, there are several approaches: * Simply use `\once\override DynamicText #'X-offset = #-9.2' before the note with the dynamics to manually shift it to the correct position. Drawback: This has to be done manually each time you use that dynamic markup... * Add some padding (`#:hspace 7.1') into the definition of your custom dynamic mark, so that after lilypond center-aligns it, it is already correctly aligned. Drawback: The padding really takes up that space and does not allow any other markup or dynamics to be shown in that position. * Shift the dynamic script `\once\override ... #'X-offset = ..'. Drawback: `\once\override' is needed for every invocation! * Set the dimensions of the additional text to 0 (using `#:with-dimensions '(0 . 0) '(0 . 0)'). Drawback: To lilypond "sempre" has no extent, so it might put other stuff there and create collisions (which are not detected by the collision dection!). Also, there seems to be some spacing, so it's not exactly the same alignment as without the additional text * Add an explicit shifting directly inside the scheme function for the dynamic-script. * Set an explicit alignment inside the dynamic-script. By default, this won't have any effect, only if one sets X-offset! Drawback: One needs to set `DynamicText #'X-offset', which will apply to all dynamic texts! Also, it is aligned at the right edge of the additional text, not at the center of pp. \header { title = "Horizontally aligning custom dynamics" } \paper { ragged-right = ##f } % Solution 1: Using a simple markup with a particular halign value % Drawback: It's a markup, not a dynamic command, so \dynamicDown % etc. will have no effect semppMarkup = \markup { \halign #1.4 \italic "sempre" \dynamic "pp" } % Solution 2: Using a dynamic script & shifting with % \once \override ... #'X-offset = .. % Drawback: \once \override needed for every invocation semppK = #(make-dynamic-script (markup #:line (#:normal-text #:italic "sempre" #:dynamic "pp"))) % Solution 3: Padding the dynamic script so the center-alignment % puts it at the correct position % Drawback: the padding really reserves the space, nothing else can be there semppT = #(make-dynamic-script (markup #:line (#:normal-text #:italic "sempre" #:dynamic "pp" #:hspace 7.1))) % Solution 4: Dynamic, setting the dimensions of the additional text to 0 % Drawback: To lilypond "sempre" has no extent, so it might put % other stuff there => collisions % Drawback: Also, there seems to be some spacing, so it's not exactly the % same alignment as without the additional text semppM = #(make-dynamic-script (markup #:line (#:with-dimensions '(0 . 0) '(0 . 0) #:right-align #:normal-text #:italic "sempre" #:dynamic "pp"))) % Solution 5: Dynamic with explicit shifting inside the scheme function semppG = #(make-dynamic-script (markup #:hspace 0 #:translate '(-18.85 . 0) #:line( #:normal-text #:italic "sempre" #:dynamic "pp"))) % Solution 6: Dynamic with explicit alignment. This has only effect, if one sets X-offset! % Drawback: One needs to set DynamicText #'X-offset! % Drawback: Aligned at the right edge of the additional text, not at the center of pp semppMII = #(make-dynamic-script (markup #:line(#:right-align #:normal-text #:italic "sempre" #:dynamic "pp"))) \context StaffGroup << \context Staff = "s" << \set Staff.instrumentName = "Normal" \relative c'' { \key es \major c4\pp c\p c c | c\ff c c\pp c } >> \context Staff = "sMarkup" << \set Staff.instrumentName = \markup \column { Normal markup } \relative c'' { \key es \major c4-\semppMarkup c\p c c | c\ff c c-\semppMarkup c } >> \context Staff = "sK" << \set Staff.instrumentName = \markup \column { Explicit shifting } \relative c'' { \key es \major \once \override DynamicText #'X-offset = #-9.2 c4\semppK c\p c c c4\ff c \once \override DynamicText #'X-offset = #-9.2 c4\semppK c } >> \context Staff = "sT" << \set Staff.instrumentName = \markup \column { Right padding } \relative c'' { \key es \major c4\semppT c\p c c | c\ff c c\semppT c } >> \context Staff = "sM" << \set Staff.instrumentName = \markup \column { Setting dimension "to zero" } \relative c'' { \key es \major c4\semppM c\p c c | c\ff c c\semppM c } >> \context Staff = "sG" << \set Staff.instrumentName = \markup \column { Shifting inside dynamics } \relative c'' { \key es \major c4\semppG c\p c c | c\ff c c\semppG c } >> \context Staff = "sMII" << \set Staff.instrumentName = \markup \column { Alignment inside dynamics } \relative c'' { \key es \major % Setting to ##f (false) gives the same result \override DynamicText #'X-offset = #0 c4\semppMII c\p c c | c\ff c c\semppMII c } >> >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽥楬祬搭搷㘳〵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Inserting a caesura =================== Caesura marks can be created by overriding the `'text' property of the `BreathingSign' object. A curved caesura mark is also available. \relative c'' { \override BreathingSign #'text = \markup { \musicglyph #"scripts.caesura.straight" } c8 e4. \breathe g8. e16 c4 \override BreathingSign #'text = \markup { \musicglyph #"scripts.caesura.curved" } g8 e'4. \breathe g8. e16 c4 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⽡楬祬㘭㤲㥡ㄸ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Laissez vibrer ties =================== Laissez vibrer ties have a fixed size. Their formatting can be tuned using `'tie-configuration'. \relative c' { <c e g>4\laissezVibrer r <c f g>\laissezVibrer r <c d f g>4\laissezVibrer r <c d f g>4.\laissezVibrer r8 <c d e f>4\laissezVibrer r \override LaissezVibrerTieColumn #'tie-configuration = #`((-7 . ,DOWN) (-5 . ,DOWN) (-3 . ,UP) (-1 . ,UP)) <c d e f>4\laissezVibrer r } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼶楬祬挭て昴戳⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Line arrows =========== Arrows can be applied to text-spanners and line-spanners (such as the Glissando). \relative c'' { \override TextSpanner #'bound-padding = #1.0 \override TextSpanner #'style = #'line \override TextSpanner #'(bound-details right arrow) = ##t \override TextSpanner #'(bound-details left text) = #"fof" \override TextSpanner #'(bound-details right text) = #"gag" \override TextSpanner #'(bound-details right padding) = #0.6 \override TextSpanner #'(bound-details right stencil-align-dir-y) = #CENTER \override TextSpanner #'(bound-details left stencil-align-dir-y) = #CENTER \override Glissando #'(bound-details right arrow) = ##t \override Glissando #'arrow-length = #0.5 \override Glissando #'arrow-width = #0.25 a8\startTextSpan gis a4 b\glissando b, g'4 c\stopTextSpan c2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼱楬祬攭戴晣㙡⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Modifying default values for articulation shorthand notation ============================================================ The shorthands are defined in `ly/script-init.ly', where the variables `dashHat', `dashPlus', `dashDash', `dashBar', `dashLarger', `dashDot', and `dashUnderscore' are assigned default values. The default values for the shorthands can be modified. For example, to associate the `-+' (`dashPlus') shorthand with the trill symbol instead of the default + symbol, assign the value `trill' to the variable `dashPlus': \relative c'' { c1-+ } dashPlus = "trill" \relative c'' { c1-+ } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼹楬祬㜭摡攸ち⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Piano template with centered dynamics ===================================== Many piano scores have the dynamics centered between the two staves. This requires a bit of tweaking to implement, but since the template is right here, you don't have to do the tweaking yourself. global = { \key c \major \time 4/4 } upper = \relative c'' { \clef treble a4 b c d } lower = \relative c { \clef bass a2 c } dynamics = { s2\fff\> s4 s\!\pp } pedal = { s2\sustainOn s\sustainOff } \score { \new PianoStaff = "PianoStaff_pf" << \new Staff = "Staff_pfUpper" << \global \upper >> \new Dynamics = "Dynamics_pf" \dynamics \new Staff = "Staff_pfLower" << \global \lower >> \new Dynamics = "pedal" \pedal >> \layout { % define Dynamics context \context { \type "Engraver_group" \name Dynamics \alias Voice \consists "Output_property_engraver" \consists "Piano_pedal_engraver" \consists "Script_engraver" \consists "New_dynamic_engraver" \consists "Dynamic_align_engraver" \consists "Text_engraver" \consists "Skip_event_swallow_translator" \consists "Axis_group_engraver" pedalSustainStrings = #'("Ped." "*Ped." "*") pedalUnaCordaStrings = #'("una corda" "" "tre corde") \override DynamicLineSpanner #'Y-offset = #0 \override TextScript #'font-size = #2 \override TextScript #'font-shape = #'italic \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1) } % modify PianoStaff context to accept Dynamics context \context { \PianoStaff \accepts Dynamics } } } \score { \new PianoStaff = "PianoStaff_pf" << \new Staff = "Staff_pfUpper" << \global \upper \dynamics \pedal >> \new Staff = "Staff_pfLower" << \global \lower \dynamics \pedal >> >> \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⽡楬祬㘭㥦戴㍥⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Positioning text markups inside slurs ===================================== Text markups need to have the `outside-staff-priority' property set to false in order to be printed inside slurs. \relative c'' { \override TextScript #'avoid-slur = #'inside \override TextScript #'outside-staff-priority = ##f c2(^\markup { \halign #-10 \natural } d4.) c8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼱楬祬搭㐲㘵昷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing hairpins using al niente notation ========================================== Hairpins may be printed with a circled tip (al niente notation) by setting the `circled-tip' property of the `Hairpin' object to `#t'. \relative c'' { \override Hairpin #'circled-tip = ##t c2\< c\! c4\> c\< c2\! } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼸楬祬㘭㌲扢捥湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing metronome and rehearsal marks below the staff ====================================================== By default, metronome and rehearsal marks are printed above the staff. To place them below the staff simply set the `direction' property of `MetronomeMark' or `RehearsalMark' appropriately. \layout { ragged-right = ##f } { % Metronome marks below the staff \override Score.MetronomeMark #'direction = #DOWN \tempo 8. = 120 c''1 % Rehearsal marks below the staff \override Score.RehearsalMark #'direction = #DOWN \mark \default c''1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼶楬祬搭挷愷㤷⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Setting hairpin behavior at bar lines ===================================== If the note which ends a hairpin falls on a downbeat, the hairpin stops at the bar line immediately preceding. This behavior can be controlled by overriding the `'to-barline' property. \relative c'' { e4\< e2. e1\! \override Hairpin #'to-barline = ##f e4\< e2. e1\! } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼱楬祬㜭晢㐲摢湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Setting the minimum length of hairpins ====================================== If hairpins are too short, they can be lengthened by modifying the `minimum-length' property of the `Hairpin' object. \relative c'' { c4\< c\! d\> e\! \override Hairpin #'minimum-length = #5 << f1 { s4 s\< s\> s\! } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼸楬祬昭㍣〷捡湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Snap-pizzicato markup ("Bartok pizzicato") ========================================== A snap-pizzicato (also known as "Bartok pizzicato") is a "strong pizzicato where the string is plucked vertically by snapping and rebounds off the fingerboard of the instrument" (Wikipedia). It is denoted by a cicle with a vertical line going from the center upwards outside the circle. While Lilypond does not have a pre-defined command to created this markup, it is easy to create a definition and place it directly into the lilypond file. #(define-markup-command (snappizz layout props) () (interpret-markup layout props (markup #:stencil (ly:stencil-translate-axis (ly:stencil-add (make-circle-stencil 0.7 0.1 #f) (ly:make-stencil (list 'draw-line 0.1 0 0.1 0 1) '(-0.1 . 0.1) '(0.1 . 1))) 0.7 X)))) snapPizzicato = \markup \snappizz % now it can be used as \snappizzicato after the note/chord % Note that a direction (-, ^ or _) is required. \relative c' { c4^\snapPizzicato % This does NOT work: %<c e g>\snapPizzicato <c' e g>-\snapPizzicato <c' e g>^\snapPizzicato <c, e g>_\snapPizzicato } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽢楬祬昭ㅥ愱晢⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Using double slurs for legato chords ==================================== Some composers write two slurs when they want legato chords. This can be achieved by setting `doubleSlurs'. \relative c' { \set doubleSlurs = ##t <c e>4( <d f> <c e> <d f>) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⼲楬祬戭ㄱ摣づ⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vertical line as a baroque articulation mark ============================================ This short vertical line placed above the note is commonly used in baroque music. Its meaning can vary, but generally indicates notes that should be played with more "weight". The following example demonstrates how to achieve such a notation. upline = #(let* ((m (make-music 'ArticulationEvent 'articulation-type "stopped" 'direction 1))) (ly:music-set-property! m 'tweaks (acons 'font-size 3 (acons 'text (markup #:postscript " .15 setlinewidth 0 -1 0 1.5 lineto stroke") (acons 'stencil ly:text-interface::print (ly:music-property m 'tweaks))))) m) \relative c' { a'^\upline a( c a) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼴楬祬愭㐹攷ㄱ⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vertically aligning dynamics across multiple notes ================================================== Dynamics that occur at, begin on, or end on the same note will be vertically aligned. To ensure that dynamics are aligned when they do not occur on the same note, increase the `staff-padding' property of the `DynamicLineSpanner' object. \relative c' { \override DynamicLineSpanner #'staff-padding = #4 c2\p f\mf g2\< b4\> c\! } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼲楬祬㘭㉢㠸㥡⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Repeats, Next: Simultaneous notes, Prev: Expressive marks, Up: Top Repeats ******* These snippets illustrate *note Repeats: (lilypond)Repeats. Adding volta brackets to additional staves ========================================== The `Volta_engraver' by default resides in the `Score' context, and brackets for the repeat are thus normally only printed over the topmost staff. This can be adjusted by adding the `Volta_engraver' to the `Staff' context where the brackets should appear; see also the "Volta multi staff" snippet. << \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } \new Staff \with { \consists "Volta_engraver" } { c'2 g' e' a' } \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼵楬祬㐭㥢愳愸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Engraving tremolos with floating beams ====================================== If a tremolo's total duration is less than a quarter-note, or exactly a half-note, or between a half-note and a whole-note, it is normally typeset with all beams touching the stems. Certain engraving styles typeset some of these beams as centered floating beams that do not touch the stems. The number of floating beams in this type of tremolo is controlled with the `'gap-count ' property of the `Beam' object, and the size of the gaps between beams and stems is set with the `'gap' property. \relative c'' { \repeat tremolo 8 { a32 f } \override Beam #'gap-count = #1 \repeat tremolo 8 { a32 f } \override Beam #'gap-count = #2 \repeat tremolo 8 { a32 f } \override Beam #'gap-count = #3 \repeat tremolo 8 { a32 f } \override Beam #'gap-count = #3 \override Beam #'gap = #1.33 \repeat tremolo 8 { a32 f } \override Beam #'gap = #1 \repeat tremolo 8 { a32 f } \override Beam #'gap = #0.67 \repeat tremolo 8 { a32 f } \override Beam #'gap = #0.33 \repeat tremolo 8 { a32 f } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼷楬祬攭㉣攴慥⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Isolated percent repeats ======================== Isolated percents can also be printed. This is done by entering a multi-measure rest with a different print function: \relative c'' { \override MultiMeasureRest #'stencil = #ly:multi-measure-rest::percent \override MultiMeasureRest #'thickness = #0.48 R1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⽦楬祬昭摢挵㍥⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Measure counter =============== This snippet provides a workaround for emitting measure counters using transparent percent repeats. << \context Voice = "foo" { \clef bass c4 r g r c4 r g r c4 r g r c4 r g r } \context Voice = "foo" { \set countPercentRepeats = ##t \override PercentRepeat #'transparent = ##t \override PercentRepeatCounter #'staff-padding = #1 \repeat percent 4 { s1 } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⽤楬祬搭㜸摢㕦⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Percent repeat count visibility =============================== Percent repeat counters can be shown at regular intervals by setting the context property `repeatCountVisibility'. \relative c'' { \set countPercentRepeats = ##t \set repeatCountVisibility = #(every-nth-repeat-count-visible 5) \repeat percent 10 { c1 } \break \set repeatCountVisibility = #(every-nth-repeat-count-visible 2) \repeat percent 6 { c1 d1 } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽦楬祬昭戳㈶っ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Percent repeat counter ====================== Measure repeats of more than two repeats can get a counter when the convenient property is switched, as shown in this example: \relative c'' { \set countPercentRepeats = ##t \repeat percent 4 { c1 } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼲楬祬攭㔳㑡㥥⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Positioning segno and coda (with line break) ============================================ If you want to place an exiting segno sign and add text like "D.S. al Coda" next to it where usually the staff lines are you can use this snippet. The coda will resume in a new line. There is a variation documented in this snippet, where the coda will remain on the same line. { \clef treble \key g \major \time 4/4 \relative c'' { \repeat unfold 2 { | c4 c c c } % Set segno sign as rehearsal mark and adjust size if needed % \once \override Score.RehearsalMark #'font-size = #3 \mark \markup { \musicglyph #"scripts.segno" } \repeat unfold 2 { | c4 c c c } % Set coda sign as rehearsal mark and adjust size if needed \once \override Score.RehearsalMark #'font-size = #4 \mark \markup { \musicglyph #"scripts.coda" } \repeat unfold 2 { | c4 c c c } % Should Coda be on anew line? % Coda NOT on new line: use \nobreak % Coda on new line: DON'T use \nobreak % \noBreak \bar "||" % Set segno sign as rehearsal mark and adjust size if needed \once \override Score.RehearsalMark #'break-visibility = #begin-of-line-invisible % \once \override Score.RehearsalMark #'font-size = #3 \mark \markup { \musicglyph #"scripts.segno" } % Here begins the trickery! % \cadenzaOn will suppress the bar count and \stopStaff removes the staff lines. \cadenzaOn \stopStaff % Some examples of possible text-displays % text line-aligned % ================== % Move text to the desired position % \once \override TextScript #'extra-offset = #'( 2 . -3.5 ) % | s1*0^\markup { D.S. al Coda } } % text center-aligned % ==================== % Move text to the desired position % \once \override TextScript #'extra-offset = #'( 6 . -5.0 ) % | s1*0^\markup { \center-column { D.S. "al Coda" } } % text and symbols center-aligned % =============================== % Move text to the desired position and tweak spacing for optimum text alignment %\once \override TextScript #'extra-offset = #'( 8 . -5.5 ) \once \override TextScript #'word-space = #1.5 \once \override TextScript #'X-offset = #8 \once \override TextScript #'Y-offset = #1.5 | s1*0^\markup { \center-column { "D.S. al Coda" \line { \musicglyph #"scripts.coda" \musicglyph #"scripts.tenuto" \musicglyph #"scripts.coda"} } } % Increasing the unfold counter will expand the staff-free space \repeat unfold 4 { s4 s4 s4 s4 \bar "" } % Resume bar count and show staff lines again \startStaff \cadenzaOff % Should Coda be on new line? % Coda NOT on new line: DON'T use \break % Coda on new line: use \break \break % Show up, you clef and key! \once \override Staff.KeySignature #'break-visibility = #end-of-line-invisible \once \override Staff.Clef #'break-visibility = #end-of-line-invisible % Set coda sign as rehearsal mark and adjust size and position % Put the coda sign ontop of the (treble-)clef dependend on coda's line-position % Coda NOT on new line, use this: % \once \override Score.RehearsalMark #'extra-offset = #'( -2 . 1.75 ) % Coda on new line, use this: \once \override Score.RehearsalMark #'extra-offset = #'( -8.42 . 1.75 ) \once \override Score.RehearsalMark #'font-size = #5 \mark \markup { \musicglyph #"scripts.coda" } % The coda \repeat unfold 5 { | c4 c c c } \bar"|." } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼶楬祬愭挹挲㌲⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing a repeat sign at the beginning of a piece ================================================== A `|:' bar line can be printed at the beginning of a piece, by overriding the relevant property: \relative c'' { \once \override Score.BreakAlignment #'break-align-orders = #(make-vector 3 '(instrument-name left-edge ambitus span-bar breathing-sign clef key-signature time-signature staff-bar custos span-bar)) \bar "|:" c1 d1 d4 e f g } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼷楬祬攭搲㌴〲⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Shortening volta brackets ========================= By default, the volta brackets will be drawn over all of the alternative music, but it is possible to shorten them by setting `voltaSpannerDuration'. In the next example, the bracket only lasts one measure, which is a duration of 3/4. \relative c'' { \time 3/4 c4 c c \set Score.voltaSpannerDuration = #(ly:make-moment 3 4) \repeat volta 5 { d4 d d } \alternative { { e4 e e f4 f f } { g4 g g } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽥楬祬挭㕥㠹㕣⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Volta below chords ================== By adding the `Volta_engraver' to the relevant staff, volte can be put under chords. \score { << \chords { c1 c1 } \new Staff \with { \consists "Volta_engraver" } { \repeat volta 2 { c'1 } \alternative { c' } } >> \layout { \context { \Score \remove "Volta_engraver" } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⽡楬祬攭昹㈴搲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Volta multi staff ================= By adding the `Volta_engraver' to the relevant staff, volte can be put over staves other than the topmost one in a score. voltaMusic = \relative c'' { \repeat volta 2 { c1 } \alternative { d1 e } } << \new StaffGroup << \new Staff \voltaMusic \new Staff \voltaMusic >> \new StaffGroup << \new Staff \with { \consists "Volta_engraver" } \voltaMusic \new Staff \voltaMusic >> >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⽢楬祬㐭㐴ㅣ扥⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Volta text markup using repeatCommands ====================================== Though volte are best specified using `\repeat volta', the context property `repeatCommands' must be used in cases where the volta text needs more advanced formatting with `\markup'. Since `repeatCommands' takes a list, the simplest method of including markup is to use an identifier for the text and embed it in the command list using the Scheme syntax `#(list (list 'volta textIdentifier))'. Start- and end-repeat commands can be added as separate list elements: voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } } \relative c'' { c1 \set Score.repeatCommands = #(list (list 'volta voltaAdLib) 'start-repeat) c4 b d e \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat) f1 \set Score.repeatCommands = #'((volta #f)) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽥楬祬㌭㥣攳愱⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Simultaneous notes, Next: Staff notation, Prev: Repeats, Up: Top Simultaneous notes ****************** These snippets illustrate *note Simultaneous notes: (lilypond)Simultaneous notes. Additional voices to avoid collisions ===================================== In some instances of complex polyphonic music, additional voices are necessary to prevent collisions between notes. If more than four parallel voices are needed, additional voices can be added by defining a variable using the Scheme function `context-spec-music'. voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice) \relative c'' { \time 3/4 \key d \minor \partial 2 << { \voiceOne a4. a8 e'4 e4. e8 f4 d4. c8 } \\ { \voiceThree f,2 bes4 a2 a4 s2 } \\ { \voiceFive s2 g4 g2 f4 f2 } \\ { \voiceTwo d2 d4 cis2 d4 bes2 } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼶楬祬挭㘷〵昷⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing a single note's size in a chord ======================================== Individual note heads in a chord can be modified with the `\tweak' command inside a chord, by altering the `font-size' property. Inside the chord (within the brackets `< >'), before the note to be altered, place the `\tweak' command, followed by `#'font-size' and define the proper size like `#-2' (a tiny notehead). \relative { <\tweak #'font-size #+2 c e g c \tweak #'font-size #-2 e>1^\markup { A tiny e }_\markup { A big c } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼸楬祬㜭㔲敢ㄴ⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing partcombine texts ========================== When using the automatic part combining feature, the printed text for the solo and unison sections may be changed: \new Staff << \set Staff.soloText = #"girl" \set Staff.soloIIText = #"boy" \set Staff.aDueText = #"together" \partcombine \relative c'' { g4 g r r a2 g } \relative c'' { r4 r a( b) a2 g } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼴楬祬㈭昳㙦扡⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Clusters ======== Clusters are a device to denote that a complete range of notes is to be played. fragment = \relative c' { c4 f <e d'>4 <g a>8 <e a> a4 c2 <d b>4 e2 c } << \new Staff \fragment \new Staff \makeClusters \fragment >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽡楬祬挭戲戶挹⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Combining two parts on the same staff ===================================== The part combiner tool ( `\partcombine' command ) allows the combination of several different parts on the same staff. Text directions such as "solo" or "a2" are added by default; to remove them, simply set the property `printPartCombineTexts' to "false". For vocal scores (hymns), there is no need to add "solo"/"a2" texts, so they should be switched off. However, it might be better not to use it if there are any solos, as they won't be indicated. In such cases, standard polyphonic notation may be preferable. This snippet presents the three ways two parts can be printed on a same staff: standard polyphony, `\partcombine' without texts, and `\partcombine' with texts. musicUp = \relative c'' { \time 4/4 a4 c4.( g8) a4 | g4 e' g,( a8 b) | c b a2. } musicDown = \relative c'' { g4 e4.( d8) c4 | r2 g'4( f8 e) | d2 \stemDown a } \score { << << \new Staff { \set Staff.instrumentName = "Standard polyphony " << \musicUp \\ \musicDown >> } \new Staff \with { printPartCombineTexts = ##f } { \set Staff.instrumentName = "PartCombine without texts " \partcombine \musicUp \musicDown } \new Staff { \set Staff.instrumentName = "PartCombine with texts " \partcombine \musicUp \musicDown } >> >> \layout { indent = 6.0\cm \context { \Score \override SystemStartBar #'collapse-height = #30 } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⼸楬祬攭慤愶㔹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Displaying complex chords ========================= Here is a way to display a chord where the same note is played twice with different accidentals. fixA = { \once \override Stem #'length = #9 \once \override Accidental #'extra-offset = #'(0.3 . 0) } fixB = { \once \override NoteHead #'extra-offset = #'(1.7 . 0) \once \override Stem #'rotation = #'(45 0 0) \once \override Stem #'extra-offset = #'(-0.2 . -0.2) \once \override Stem #'flag-style = #'no-flag \once \override Accidental #'extra-offset = #'(3.1 . 0) } \relative c' { << { \fixA <b d!>8 } \\ { \voiceThree \fixB dis } >> s } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼹楬祬昭收㈴晡湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Double glissando ================ To connect chords with glissando lines, attach a second glissando to a hidden voice. \relative c { \clef bass << { % new voice ( = \voiceOne), hidden \hideNotes % attach glissando to note heads e2\glissando g } \\ { % original voice with chords rearranged so that % glissando is attached to a & c <e a,>2\glissando <g c,> } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼰楬祬愭㔰㌱扥湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Forcing horizontal shift of notes ================================= When the typesetting engine cannot cope, the following syntax can be used to override typesetting decisions. The units of measure used here are staff spaces. \relative c' << { <d g>2 <d g> } \\ { <b f'>2 \once \override NoteColumn #'force-hshift = #1.7 <b f'>2 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⽦楬祬㘭㘰慢〲⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Making an object invisible with the 'transparent property ========================================================= Setting the `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. This 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'' { \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 g8 ~ g\noBeam } \\ { b8 g g e } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽥楬祬愭ㄵ换慢湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Suppressing warnings for clashing note columns ============================================== If notes from two voices with stems in the same direction are placed at the same position, and both voices have no shift or the same shift specified, the error message "warning: ignoring too many clashing note columns" will appear when compiling the LilyPond file. This message can be suppressed by setting the `'ignore-collision' property of the `NoteColumn' object to `#t'. ignore = \override NoteColumn #'ignore-collision = ##t \relative c' { << \ignore { \stemDown f2 g } \\ { c2 c, } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽦楬祬㤭㌸㌵⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Staff notation, Next: Editorial annotations, Prev: Simultaneous notes, Up: Top Staff notation ************** These snippets illustrate *note Staff notation: (lilypond)Staff notation. Adding ambitus per voice ======================== Ambitus can be added per voice. In this case, the ambitus must be moved manually to prevent collisions. \new Staff << \new Voice \with { \consists "Ambitus_engraver" } \relative c'' { \override Ambitus #'X-offset = #2.0 \voiceOne c4 a d e f1 } \new Voice \with { \consists "Ambitus_engraver" } \relative c' { \voiceTwo es4 f g as b1 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼲楬祬㤭㙦㉣ㄴ⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Adding an extra staff at a line break ===================================== When adding a new staff at a line break, some extra space is unfortunately added at the end of the line before the break (to fit in a key signature change, which will never be printed anyway). The workaround is to add a setting of `Staff.explicitKeySignatureVisibility' as is shown in the example. In versions 2.10 and earlier, a similar setting for the time signatures is also required (see the example). \score { \new StaffGroup \relative c'' { \new Staff \key f \major c1 c^"Unwanted extra space" \break << { c1 | c } \new Staff { \key f \major \once \override Staff.TimeSignature #'stencil = ##f c1 | c } >> c1 | c^"Fixed here" \break << { c1 | c } \new Staff { \once \set Staff.explicitKeySignatureVisibility = #end-of-line-invisible % The next line is not needed in 2.11.x or later: \once \override Staff.TimeSignature #'break-visibility = #end-of-line-invisible \key f \major \once \override Staff.TimeSignature #'stencil = ##f c1 | c } >> } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼸楬祬㠭捤攵㜵⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Adding an extra staff ===================== An extra staff can be added (possibly temporarily) after the start of a piece. \score { << \new Staff \relative c'' { c1 | c | c | c | c } \new StaffGroup \relative c'' { \new Staff { c1 | c << c1 \new Staff { \once \override Staff.TimeSignature #'stencil = ##f c1 } >> c1 } } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⽥楬祬㌭〷慣㤰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the number of lines in a staff ======================================= The number of lines in a staff may changed by overriding the `StaffSymbol' property `line-count'. upper = \relative c'' { c4 d e f } lower = \relative c { \clef bass c4 b a g } \score { \context PianoStaff << \new Staff { \upper } \new Staff { \override Staff.StaffSymbol #'line-count = #4 \lower } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼱楬祬攭ㄱ㙥户⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the staff size ======================= Though the simplest way to resize staves is to use `#(set-global-staff-size xx)', an individual staff's size can be changed by scaling the properties `'staff-space' and `fontSize'. << \new Staff { \relative c'' { \dynamicDown c8\ff c c c c c c c } } \new Staff \with { fontSize = #-3 \override StaffSymbol #'staff-space = #(magstep -3) } { \clef bass c8 c c c c\f c c c } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼴楬祬㐭㠴㉢㔰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the tempo without a metronome mark =========================================== To change the tempo in MIDI output without printing anything, make the metronome mark invisible. \score { \new Staff \relative c' { \tempo 4 = 160 c4 e g b c4 b d c \set Score.tempoHideNote = ##t \tempo 4 = 96 d,4 fis a cis d4 cis e d } \layout { } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼲楬祬㤭㘰〶㜵⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating blank staves ===================== To create blank staves, generate empty measures then remove the `Bar_number_engraver' from the `Score' context, and the `Time_signature_engraver', `Clef_engraver' and `Bar_engraver' from the `Staff' context. #(set-global-staff-size 20) \score { { \repeat unfold 12 { s1 \break } } \layout { indent = 0\in \context { \Staff \remove "Time_signature_engraver" \remove "Clef_engraver" \remove "Bar_engraver" } \context { \Score \remove "Bar_number_engraver" } } } \paper { #(set-paper-size "letter") ragged-last-bottom = ##f line-width = 7.5\in left-margin = 0.5\in bottom-margin = 0.25\in top-margin = 0.25\in } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼱楬祬ㄭ〶摦㐳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating metronome marks in markup mode ======================================= New metronome marks can be created in markup mode, but they will not change the tempo in MIDI output. \relative c' { \tempo \markup { \concat { ( \smaller \general-align #Y #DOWN \note #"16." #1 " = " \smaller \general-align #Y #DOWN \note #"8" #1 ) } } c1 c4 c' c,2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼵楬祬㠭ㄳ慥昲⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Display bracket with only one staff in a system =============================================== If there is only one staff in one of the staff types `ChoirStaff' or `StaffGroup', the bracket and the starting bar line will not be displayed as standard behavior. This can be changed by overriding the relevant properties. Note that in contexts such as `PianoStaff' and `GrandStaff' where the systems begin with a brace instead of a bracket, another property has to be set, as shown on the second system in the example. \markup \left-column { \score { \new StaffGroup << % Must be lower than the actual number of staff lines \override StaffGroup.SystemStartBracket #'collapse-height = #1 \override Score.SystemStartBar #'collapse-height = #1 \new Staff { c'1 } >> \layout { } } \null \score { \new PianoStaff << \override PianoStaff.SystemStartBrace #'collapse-height = #1 \override Score.SystemStartBar #'collapse-height = #1 \new Staff { c'1 } >> \layout { } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼲楬祬㜭㘴ㅣ㠲⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Incipit ======= Incipits can be added using the instrument name grob, but keeping separate the instrument name definition and the incipit definition. incipit = #(define-music-function (parser location incipit-music) (ly:music?) #{ \once \override Staff.InstrumentName #'self-alignment-X = #RIGHT \once \override Staff.InstrumentName #'self-alignment-Y = #UP \once \override Staff.InstrumentName #'Y-offset = #4 \once \override Staff.InstrumentName #'padding = #0.3 \once \override Staff.InstrumentName #'stencil = #(lambda (grob) (let* ((instrument-name (ly:grob-property grob 'long-text)) (layout (ly:output-def-clone (ly:grob-layout grob))) (music (make-music 'SequentialMusic 'elements (list (make-music 'ContextSpeccedMusic 'context-type 'MensuralStaff 'element (make-music 'PropertySet 'symbol 'instrumentName 'value instrument-name)) $incipit-music))) (score (ly:make-score music)) (mm (ly:output-def-lookup layout 'mm)) (indent (ly:output-def-lookup layout 'indent)) (width (ly:output-def-lookup layout 'incipit-width)) (incipit-width (if (number? width) (* width mm) (* indent 0.5)))) (ly:output-def-set-variable! layout 'indent (- indent incipit-width)) (ly:output-def-set-variable! layout 'line-width indent) (ly:output-def-set-variable! layout 'ragged-right #f) (ly:output-def-set-variable! layout 'ragged-last #f) (ly:output-def-set-variable! layout 'system-count 1) (ly:score-add-output-def! score layout) (ly:grob-set-property! grob 'long-text (markup #:score score)) (ly:system-start-text::print grob))) #}) %%%%%%%%%%%%%%%%%%%%%%%%% global = { \set Score.skipBars = ##t \key g \major \time 4/4 % the actual music \skip 1*8 % let finis bar go through all staves \override Staff.BarLine #'transparent = ##f % finis bar \bar "|." } discantusIncipit = << \new MensuralVoice = "discantusIncipit" << \repeat unfold 9 { s1 \noBreak } { \clef "neomensural-c1" \key f \major \time 2/2 c''1. } >> \new Lyrics \lyricsto discantusIncipit { IV- } >> discantusNotes = { \transpose c' c'' { \clef "treble" d'2. d'4 | b e' d'2 | c'4 e'4.( d'8 c' b | a4) b a2 | b4.( c'8 d'4) c'4 | \once \override NoteHead #'transparent = ##t c'1 | b\breve | } } discantusLyrics = \lyricmode { Ju -- bi -- | la -- te De -- | o, om -- nis ter -- | ra, __ om- | "..." | -us. | } altusIncipit = << \new MensuralVoice = "altusIncipit" << \repeat unfold 9 { s1 \noBreak } { \clef "neomensural-c3" \key f \major \time 2/2 r1 f'1. } >> \new Lyrics \lyricsto altusIncipit { IV- } >> altusNotes = { \transpose c' c'' { \clef "treble" % two measures r2 g2. e4 fis g | a2 g4 e | fis g4.( fis16 e fis4) | g1 | \once \override NoteHead #'transparent = ##t g1 | g\breve | } } altusLyrics = \lyricmode { % two measures Ju -- bi -- la -- te | De -- o, om -- | nis ter -- ra, | "..." | -us. | } tenorIncipit = << \new MensuralVoice = "tenorIncipit" << \repeat unfold 9 { s1 \noBreak } { \clef "neomensural-c4" \key f \major \time 2/2 r\longa r\breve r1 c'1. } >> \new Lyrics \lyricsto tenorIncipit { IV- } >> tenorNotes = { \transpose c' c' { \once \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-6 . 3) \clef "treble_8" R1 | R1 | R1 | % two measures r2 d'2. d'4 b e' | \once \override NoteHead #'transparent = ##t e'1 | d'\breve | } } tenorLyrics = \lyricmode { % two measures Ju -- bi -- la -- te | "..." | -us. } bassusIncipit = << \new MensuralVoice = "bassusIncipit" << \repeat unfold 9 { s1 \noBreak } { \clef "bass" \key f \major \time 2/2 %% incipit r\maxima f1. } >> \new Lyrics \lyricsto bassusIncipit { IV- } >> bassusNotes = { \transpose c' c' { \clef "bass" R1 | R1 | R1 | R1 | g2. e4 | \once \override NoteHead #'transparent = ##t e1 | g\breve | } } bassusLyrics = \lyricmode { Ju -- bi- | "..." | -us. } \score { << \new StaffGroup = choirStaff << \new Voice = "discantusNotes" << \global \set Staff.instrumentName = #"Discantus" \incipit \discantusIncipit \discantusNotes >> \new Lyrics = "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics } \new Voice = "altusNotes" << \global \set Staff.instrumentName = #"Altus" \incipit \altusIncipit \altusNotes >> \new Lyrics = "altusLyrics" \lyricsto altusNotes { \altusLyrics } \new Voice = "tenorNotes" << \global \set Staff.instrumentName = #"Tenor" \incipit \tenorIncipit \tenorNotes >> \new Lyrics = "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics } \new Voice = "bassusNotes" << \global \set Staff.instrumentName = #"Bassus" \incipit \bassusIncipit \bassusNotes >> \new Lyrics = "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics } >> >> \layout { \context { \Score %% no bar lines in staves or lyrics \override BarLine #'transparent = ##t } %% the next two instructions keep the lyrics between the bar lines \context { \Lyrics \consists "Bar_engraver" \consists "Separating_line_group_engraver" } \context { \Voice %% no slurs \override Slur #'transparent = ##t %% Comment in the below "\remove" command to allow line %% breaking also at those bar lines where a note overlaps %% into the next measure. The command is commented out in this %% short example score, but especially for large scores, you %% will typically yield better line breaking and thus improve %% overall spacing if you comment in the following command. %%\remove "Forbid_line_break_engraver" } indent = 6\cm incipit-width = 4\cm } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼷楬祬㜭㠴〵昵⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Inserting score fragments above a staff, as markups =================================================== The `\markup' command is quite versatile. In this snippet, it contains a `\score' block instead of texts or marks. tuning = \markup { \score { \new Staff \with { \remove "Time_signature_engraver" } { \clef bass <c, g, d g>1 } \layout { ragged-right = ##t } } } \header { title = "Solo Cello Suites" subtitle = "Suite IV" subsubtitle = \markup { Originalstimmung: \general-align #Y #CENTER \tuning } } \layout { ragged-right = ##f } \relative c'' { \time 4/8 \times 2/3 { c8 d e } \times 2/3 { c d e } \times 2/3 { c8 d e } \times 2/3 { c d e } g8 a g a g8 a g a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⼵楬祬〭㙣㐷㍤湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Letter tablature formatting =========================== Tablature can be formatted using letters instead of numbers. #(define (letter-tablature-format str context event) (let ((tuning (ly:context-property context 'stringTunings)) (pitch (ly:event-property event 'pitch))) (make-whiteout-markup (make-vcenter-markup (string (integer->char (+ (char->integer #\a) (- (ly:pitch-semitones pitch) (list-ref tuning (- str 1)))))))))) music = \relative c { c4 d e f g4 a b c d4 e f g } << \new Staff { \clef "G_8" \music } \new TabStaff \with { tablatureFormat = #letter-tablature-format } { \music } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⽥楬祬㔭㠰㍢摥⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Making some staff lines thicker than the others =============================================== For pedagogical purposes, a staff line can be thickened (e.g., the middle line, or to emphasize the line of the G clef). This can be achieved by adding extra lines very close to the line that should be emphasized, using the `line-positions' property of the `StaffSymbol' object. { \override Staff.StaffSymbol #'line-positions = #'(-4 -2 -0.2 0 0.2 2 4) d'4 e' f' g' } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼱楬祬㌭㕢㌵㌳⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Measure counter =============== This snippet provides a workaround for emitting measure counters using transparent percent repeats. << \context Voice = "foo" { \clef bass c4 r g r c4 r g r c4 r g r c4 r g r } \context Voice = "foo" { \set countPercentRepeats = ##t \override PercentRepeat #'transparent = ##t \override PercentRepeatCounter #'staff-padding = #1 \repeat percent 4 { s1 } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⽤楬祬搭㜸摢㕦⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Mensurstriche layout (bar lines between the staves) =================================================== The mensurstriche-layout where the bar lines do not show on the staves but between staves can be achieved with a `StaffGroup' instead of a `ChoirStaff'. The bar line on staves is blanked out by setting the `transparent' property. global = { \override Staff.BarLine #'transparent = ##t s1 s % the final bar line is not interrupted \revert Staff.BarLine #'transparent \bar "|." } \new StaffGroup \relative c'' { << \new Staff { << \global { c1 c } >> } \new Staff { << \global { c c } >> } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⽢楬祬㈭㤶㜰昲⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Modern TAB text clef ==================== Use a markup text to replace the (TAB) clef glyph with a modern font. TAB = \markup { \raise #1.5 \sans \bold \huge \override #'(baseline-skip . 2.5) \left-align \center-column { T A B } } \new TabStaff { \override Staff.Clef #'stencil = #(lambda (grob) (grob-interpret-markup grob TAB)) a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽤楬祬㘭捡挴昴⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Nesting staves ============== The property `systemStartDelimiterHierarchy' can be used to make more complex nested staff groups. The command `\set StaffGroup.systemStartDelimiterHierarchy' takes an alphabetical list of the number of staves produced. Before each staff a system start delimiter can be given. It has to be enclosed in brackets and takes as much staves as the brackets enclose. Elements in the list can be omitted, but the first bracket takes always the complete number of staves. The possibilities are `SystemStartBar', `SystemStartBracket', `SystemStartBrace', and `SystemStartSquare'. \new StaffGroup \relative c'' << \set StaffGroup.systemStartDelimiterHierarchy = #'(SystemStartSquare (SystemStartBrace (SystemStartBracket a (SystemStartSquare b) ) c ) d) \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽢楬祬昭〳敤ㄳ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Non-traditional key signatures ============================== The commonly used `\key' command sets the `keySignature' property, in the `Staff' context. To create non-standard key signatures, set this property directly. The format of this command is a list: ` \set Staff.keySignature = #`(((octave . step) . alter) ((octave . step) . alter) ...) ' where, for each element in the list, `octave' specifies the octave (0 being the octave from middle C to the B above), `step' specifies the note within the octave (0 means C and 6 means B), and `alter' is `,SHARP ,FLAT ,DOUBLE-SHARP' etc. (Note the leading comma.) The accidentals in the key signature will appear in the reverse order to that in which they are specified. Alternatively, for each item in the list, using the more concise format `(step . alter)' specifies that the same alteration should hold in all octaves. For microtonal scales where a "sharp" is not 100 cents, `alter' refers to the alteration as a proportion of a 200-cent whole tone. Here is an example of a possible key signature for generating a whole-tone scale: \relative c' { \set Staff.keySignature = #`(((0 . 3) . ,SHARP) ((0 . 5) . ,FLAT) ((0 . 6) . ,FLAT)) c4 d e fis aes4 bes c2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⼶楬祬〭昱㔳愸⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing metronome and rehearsal marks below the staff ====================================================== By default, metronome and rehearsal marks are printed above the staff. To place them below the staff simply set the `direction' property of `MetronomeMark' or `RehearsalMark' appropriately. \layout { ragged-right = ##f } { % Metronome marks below the staff \override Score.MetronomeMark #'direction = #DOWN \tempo 8. = 120 c''1 % Rehearsal marks below the staff \override Score.RehearsalMark #'direction = #DOWN \mark \default c''1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼶楬祬搭挷愷㤷⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Quoting another voice with transposition ======================================== Quotations take into account the transposition of both 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 `\transpose'. In this case, all the pitches (including the quoted ones) are transposed. \addQuote clarinet { \transposition bes \repeat unfold 8 { d'16 d' d'8 } } \addQuote sax { \transposition es' \repeat unfold 16 { a8 } } quoteTest = { % french horn \transposition f g'4 << \quoteDuring #"clarinet" { \skip 4 } s4^"clar." >> << \quoteDuring #"sax" { \skip 4 } s4^"sax." >> g'4 } { \set Staff.instrumentName = \markup { \center-column { Horn \line { in F } } } \quoteTest \transpose c' d' << \quoteTest s4_"up a tone" >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼷楬祬昭㌷捣㉢⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Quoting another voice ===================== The `quotedEventTypes' property determines the music event types that are quoted. The default value is `(note-event rest-event)', which means that only notes and rests of the quoted voice appear in the `\quoteDuring' expression. In the following example, a 16th rest is not quoted since `rest-event' is not in `quotedEventTypes'. quoteMe = \relative c' { fis4 r16 a8.-> b4\ff c } \addQuote quoteMe \quoteMe original = \relative c'' { c8 d s2 \once \override NoteColumn #'ignore-collision = ##t es8 gis8 } << \new Staff { \set Staff.instrumentName = #"quoteMe" \quoteMe } \new Staff { \set Staff.instrumentName = #"orig" \original } \new Staff \relative c'' << \set Staff.instrumentName = #"orig+quote" \set Staff.quotedEventTypes = #'(note-event articulation-event) \original \new Voice { s4 \set fontSize = #-4 \override Stem #'length-fraction = #(magstep -4) \quoteDuring #"quoteMe" { \skip 2. } } >> >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼴楬祬攭㌱挶ㄳ⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Removing the first empty line ============================= The first empty staff can also be removed from the score by setting the `VerticalAxisGroup' property `remove-first'. This can be done globally inside the `\layout' block, or locally inside the specific staff that should be removed. In the latter case, you have to specify the context (`Staff' applies only to the current staff) in front of the property. The lower staff of the second staff group is not removed, because the setting applies only to the specific staff inside of which it is written. \layout { \context { \RemoveEmptyStaffContext % To use the setting globally, uncomment the following line: % \override VerticalAxisGroup #'remove-first = ##t } } \new StaffGroup << \new Staff \relative c' { e4 f g a \break c1 } \new Staff { % To use the setting globally, comment this line, % uncomment the line in the \layout block above \override Staff.VerticalAxisGroup #'remove-first = ##t R1 \break R } >> \new StaffGroup << \new Staff \relative c' { e4 f g a \break c1 } \new Staff { R1 \break R } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼸楬祬愭㐸昴㐵⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Tick bar lines ============== 'Tick' bar lines are often used in music where the bar line is used only for coordination and is not meant to imply any rhythmic stress. \relative c' { \set Score.defaultBarType = #"'" c4 d e f g4 f e d c4 d e f g4 f e d \bar "|." } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼴楬祬搭㙣〷挰⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Time signature in parentheses ============================= The time signature can be enclosed within parentheses. \relative c'' { \override Staff.TimeSignature #'stencil = #(lambda (grob) (bracketify-stencil (ly:time-signature::print grob) Y 0.1 0.2 0.1)) \time 2/4 a4 b8 c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⼷楬祬搭㜸攷敦湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Tweaking clef properties ======================== The command `\clef "treble_8"' is equivalent to setting `clefGlyph', `clefPosition' (which controls the vertical position of the clef), `middleCPosition' and `clefOctavation'. A clef is printed when any of the properties except `middleCPosition' are changed. Note that changing the glyph, the position of the clef, or the octavation does not in itself change the position of subsequent notes on the staff: the position of middle C must also be specified to do this. The positional parameters are relative to the staff center line, positive numbers displacing upwards, counting one for each line and space. The `clefOctavation' value would normally be set to 7, -7, 15 or -15, but other values are valid. When a clef change takes place at a line break the new clef symbol is printed at both the end of the previous line and the beginning of the new line by default. If the warning clef at the end of the previous line is not required it can be suppressed by setting the `Staff' property `explicitClefVisibility' to the value `end-of-line-invisible'. The default behavior can be recovered with `\unset Staff.explicitClefVisibility'. The following examples show the possibilities when setting these properties manually. On the first line, the manual changes preserve the standard relative positioning of clefs and notes, whereas on the second line, they do not. \layout { ragged-right = ##t } { % The default treble clef c'1 % The standard bass clef \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 \set Staff.middleCPosition = #6 c'1 % The baritone clef \set Staff.clefGlyph = #"clefs.C" \set Staff.clefPosition = #4 \set Staff.middleCPosition = #4 c'1 % The standard choral tenor clef \set Staff.clefGlyph = #"clefs.G" \set Staff.clefPosition = #-2 \set Staff.clefOctavation = #-7 \set Staff.middleCPosition = #1 c'1 % A non-standard clef \set Staff.clefPosition = #0 \set Staff.clefOctavation = #0 \set Staff.middleCPosition = #-4 c'1 \break % The following clef changes do not preserve % the normal relationship between notes and clefs: \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 c'1 \set Staff.clefGlyph = #"clefs.G" c'1 \set Staff.clefGlyph = #"clefs.C" c'1 \set Staff.clefOctavation = #7 c'1 \set Staff.clefOctavation = #0 \set Staff.clefPosition = #0 c'1 % Return to the normal clef: \set Staff.middleCPosition = #0 c'1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽢楬祬戭挳㈹㑤湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Use square bracket at the start of a staff group ================================================ The system start delimiter `SystemStartSquare' can be used by setting it explicitly in a `StaffGroup' or `ChoirStaffGroup' context. \score { \new StaffGroup { << \set StaffGroup.systemStartDelimiter = #'SystemStartSquare \new Staff { c'4 d' e' f' } \new Staff { c'4 d' e' f' } >> } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽣楬祬ㄭ㝥㌸晤⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Volta below chords ================== By adding the `Volta_engraver' to the relevant staff, volte can be put under chords. \score { << \chords { c1 c1 } \new Staff \with { \consists "Volta_engraver" } { \repeat volta 2 { c'1 } \alternative { c' } } >> \layout { \context { \Score \remove "Volta_engraver" } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⽡楬祬攭昹㈴搲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Volta multi staff ================= By adding the `Volta_engraver' to the relevant staff, volte can be put over staves other than the topmost one in a score. voltaMusic = \relative c'' { \repeat volta 2 { c1 } \alternative { d1 e } } << \new StaffGroup << \new Staff \voltaMusic \new Staff \voltaMusic >> \new StaffGroup << \new Staff \with { \consists "Volta_engraver" } \voltaMusic \new Staff \voltaMusic >> >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⽢楬祬㐭㐴ㅣ扥⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Editorial annotations, Next: Text, Prev: Staff notation, Up: Top Editorial annotations ********************* These snippets illustrate *note Editorial annotations: (lilypond)Editorial annotations. Adding fingerings to a score ============================ Fingering instructions can be entered using a simple syntax. \relative c'' { c4-1 d-2 f-4 e-3 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⼲楬祬ㄭ摥㘷㥢湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Allowing fingerings to be printed inside the staff ================================================== By default, vertically oriented fingerings are positioned outside the staff. However, this behavior can be canceled. \relative c' { <c-1 e-2 g-3 b-5>2 \once \override Fingering #'staff-padding = #'() <c-1 e-2 g-3 b-5>2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼲楬祬攭㍤㤹㐴⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Analysis brackets above the staff ================================= Simple horizontal analysis brackets are added below the staff by default. The following example shows a way to place them above the staff instead. \layout { \context { \Voice \consists "Horizontal_bracket_engraver" } } \relative c'' { \once \override HorizontalBracket #'direction = #UP c2\startGroup d2\stopGroup } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⽢楬祬愭㌲戹㈱⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Applying note head styles depending on the step of the scale ============================================================ The `shapeNoteStyles' property can be used to define various note head styles for each step of the scale (as set by the key signature or the "tonic" property). This property requires a set of symbols, which can be purely arbitrary (geometrical expressions such as `triangle', `cross', and `xcircle' are allowed) or based on old American engraving tradition (some latin note names are also allowed). That said, to imitate old American song books, there are several predefined note head styles available through shortcut commands such as `\aikenHeads' or `\sacredHarpHeads'. This example shows different ways to obtain shape note heads, and demonstrates the ability to transpose a melody without losing the correspondence between harmonic functions and note head styles. fragment = { \key c \major c2 d e2 f g2 a b2 c } \score { \new Staff { \transpose c d \relative c' { \set shapeNoteStyles = #'#(do re mi fa #f la ti) \fragment } \break \relative c' { \set shapeNoteStyles = #'#(cross triangle fa #f mensural xcircle diamond) \fragment } } \layout { ragged-right = ##t } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼸楬祬〭昶愲㝢湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Avoiding collisions with chord fingerings ========================================= Fingerings and string numbers applied to individual notes will automatically avoid beams and stems, but this is not true by default for fingerings and string numbers applied to the individual notes of chords. The following example shows how this default behavior can be overridden. \relative c' { \set fingeringOrientations = #'(up) \set stringNumberOrientations = #'(up) \set strokeFingerOrientations = #'(up) % Default behavior r8 <f c'-5>8 <f c'\5>8 <f c'-\rightHandFinger #2 >8 % Corrected to avoid collisions r8 \override Fingering #'add-stem-support = ##t <f c'-5>8 \override StringNumber #'add-stem-support = ##t <f c'\5>8 \override StrokeFinger #'add-stem-support = ##t <f c'-\rightHandFinger #2 >8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼱楬祬㤭㈵挸㙥⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Blanking staff lines using the \whiteout command ================================================ The `\whiteout' command underlays a markup with a white box. Since staff lines are in a lower layer than most other grobs, this white box will not overlap any other grob. \layout { ragged-right = ##f } \relative c' { \override TextScript #'extra-offset = #'(2 . 4) c2-\markup { \whiteout \pad-markup #0.5 "middle C" } c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽢楬祬㌭㌷㔵㔱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing a single note's size in a chord ======================================== Individual note heads in a chord can be modified with the `\tweak' command inside a chord, by altering the `font-size' property. Inside the chord (within the brackets `< >'), before the note to be altered, place the `\tweak' command, followed by `#'font-size' and define the proper size like `#-2' (a tiny notehead). \relative { <\tweak #'font-size #+2 c e g c \tweak #'font-size #-2 e>1^\markup { A tiny e }_\markup { A big c } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼸楬祬㜭㔲敢ㄴ⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the appearance of a slur from solid to dotted or dashed ================================================================ The appearance of slurs may be changed from solid to dotted or dashed. \relative c' { c4( d e c) \slurDotted c4( d e c) \slurSolid c4( d e c) \slurDashed c4( d e c) \slurSolid c4( d e c) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽥楬祬〭㉡㜹㕦⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Coloring notes depending on their pitch ======================================= It is possible to color note heads depending on their pitch and/or their names: the function used in this example even makes it possible to distinguish enharmonics. %Association list of pitches to colors. #(define color-mapping (list (cons (ly:make-pitch 0 0 0) (x11-color 'red)) (cons (ly:make-pitch 0 0 1/2) (x11-color 'green)) (cons (ly:make-pitch 0 1 -1/2) (x11-color 'green)) (cons (ly:make-pitch 0 2 0) (x11-color 'red)) (cons (ly:make-pitch 0 2 1/2) (x11-color 'green)) (cons (ly:make-pitch 0 3 -1/2) (x11-color 'red)) (cons (ly:make-pitch 0 3 0) (x11-color 'green)) (cons (ly:make-pitch 0 4 1/2) (x11-color 'red)) (cons (ly:make-pitch 0 5 0) (x11-color 'green)) (cons (ly:make-pitch 0 5 -1/2) (x11-color 'red)) (cons (ly:make-pitch 0 6 1/2) (x11-color 'red)) (cons (ly:make-pitch 0 1 0) (x11-color 'blue)) (cons (ly:make-pitch 0 3 1/2) (x11-color 'blue)) (cons (ly:make-pitch 0 4 -1/2) (x11-color 'blue)) (cons (ly:make-pitch 0 5 1/2) (x11-color 'blue)) (cons (ly:make-pitch 0 6 -1/2) (x11-color 'blue)))) %Compare pitch and alteration (not octave). #(define (pitch-equals? p1 p2) (and (= (ly:pitch-alteration p1) (ly:pitch-alteration p2)) (= (ly:pitch-notename p1) (ly:pitch-notename p2)))) #(define (pitch-to-color pitch) (let ((color (assoc pitch color-mapping pitch-equals?))) (if color (cdr color)))) #(define (color-notehead grob) (pitch-to-color (ly:event-property (event-cause grob) 'pitch))) \score { \new Staff \relative c' { \override NoteHead #'color = #color-notehead c8 b d dis ees f g aes } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⽦楬祬㜭攱㠹ㅥ⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Controlling the placement of chord fingerings ============================================= The placement of fingering numbers can be controlled precisely. \relative c' { \set fingeringOrientations = #'(left) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(down) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(down right up) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(up) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(left) <c-1>2 \set fingeringOrientations = #'(down) <e-3>2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⼳楬祬挭㜲敢㈶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating a delayed turn ======================= Creating a delayed turn, where the lower note of the turn uses the accidental, requires several overrides. The `outside-staff-priority' property must be set to `#f', as otherwise this would take precedence over the `avoid-slur property'. The value of `halign' is used to position the turn horizontally. \relative c'' { \once \override TextScript #'avoid-slur = #'inside \once \override TextScript #'outside-staff-priority = ##f c2(^\markup \tiny \override #'(baseline-skip . 1) { \halign #-4 \center-column { \sharp \musicglyph #"scripts.turn" } } d4.) c8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⽢楬祬攭〳晣っ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating blank staves ===================== To create blank staves, generate empty measures then remove the `Bar_number_engraver' from the `Score' context, and the `Time_signature_engraver', `Clef_engraver' and `Bar_engraver' from the `Staff' context. #(set-global-staff-size 20) \score { { \repeat unfold 12 { s1 \break } } \layout { indent = 0\in \context { \Staff \remove "Time_signature_engraver" \remove "Clef_engraver" \remove "Bar_engraver" } \context { \Score \remove "Bar_number_engraver" } } } \paper { #(set-paper-size "letter") ragged-last-bottom = ##f line-width = 7.5\in left-margin = 0.5\in bottom-margin = 0.25\in top-margin = 0.25\in } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼱楬祬ㄭ〶摦㐳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Default direction of stems on the center line of the staff ========================================================== The default direction of stems on the center line of the staff is set by the `Stem' property `neutral-direction'. \relative c'' { a4 b c b \override Stem #'neutral-direction = #up a4 b c b \override Stem #'neutral-direction = #down a4 b c b } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽡楬祬昭㘴改㈱⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Drawing boxes around grobs ========================== The `print-function' can be overridden to draw a box around an arbitrary grob. \relative c'' { \override TextScript #'stencil = #(make-stencil-boxer 0.1 0.3 ly:text-interface::print) c'4^"foo" \override Stem #'stencil = #(make-stencil-boxer 0.05 0.25 ly:stem::print) \override Score.RehearsalMark #'stencil = #(make-stencil-boxer 0.15 0.3 ly:text-interface::print) b8 \revert Stem #'stencil c4. c4 \mark "F" c1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼷楬祬昭㔸捡戸⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Drawing circles around various objects ====================================== The `\circle' markup command draws circles around various objects, for example fingering indications. For other objects, specific tweaks may be required: this example demonstrates two strategies for rehearsal marks and measure numbers. \relative c' { c1 \set Score.markFormatter = #(lambda (mark context) (make-circle-markup (format-mark-numbers mark context))) \mark \default c2 d^\markup { \override #'(thickness . 3) { \circle \finger 2 } } \override Score.BarNumber #'break-visibility = #all-visible \override Score.BarNumber #'stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⽢楬祬㤭愱慥㔱⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Embedding native PostScript in a \markup block ============================================== PostScript code can be directly inserted inside a `\markup' block. % PostScript is a registered trademark of Adobe Systems Inc. \relative c'' { a4-\markup { \postscript #"3 4 moveto 5 3 rlineto stroke" } -\markup { \postscript #"[ 0 1 ] 0 setdash 3 5 moveto 5 -3 rlineto stroke " } b4-\markup { \postscript #"3 4 moveto 0 0 1 2 8 4 20 3.5 rcurveto stroke" } s2 a'1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⽣楬祬〭攸ㅥㅡ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Grid lines: changing their appearance ===================================== The appearance of grid lines can be changed by overriding some of their properties. \score { \new ChoirStaff << \new Staff { \relative c'' { \stemUp c'4. d8 e8 f g4 } } \new Staff { \relative c { % this moves them up one staff space from the default position \override Score.GridLine #'extra-offset = #'(0.0 . 1.0) \stemDown \clef bass \once \override Score.GridLine #'thickness = #5.0 c4 \once \override Score.GridLine #'thickness = #1.0 g'4 \once \override Score.GridLine #'thickness = #3.0 f4 \once \override Score.GridLine #'thickness = #5.0 e4 } } >> \layout { \context { \Staff % set up grids \consists "Grid_point_engraver" % set the grid interval to one quarter note gridInterval = #(ly:make-moment 1 4) } \context { \Score \consists "Grid_line_span_engraver" % this moves them to the right half a staff space \override NoteColumn #'X-offset = #-0.5 } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⼵楬祬㠭㕤㥣㐲⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Grid lines: emphasizing rhythms and notes synchronization ========================================================= Regular vertical lines can be drawn between staves to show note synchronization; however, in case of monophonic music, you may want to make the second stave invisible, and make the lines shorter like in this snippet. \score { \new ChoirStaff { \relative c'' << \new Staff { \time 12/8 \stemUp c4. d8 e8 f g4 f8 e8. d16 c8 } \new Staff { % hides staff and notes so that only the grid lines are visible \hideNotes \override Staff.BarLine #'transparent = ##t \override Staff.StaffSymbol #'line-count = #0 \override Staff.TimeSignature #'transparent = ##t \override Staff.Clef #'transparent = ##t % dummy notes to force regular note spacing \once \override Score.GridLine #'thickness = #4.0 c8 c c \once \override Score.GridLine #'thickness = #3.0 c8 c c \once \override Score.GridLine #'thickness = #4.0 c8 c c \once \override Score.GridLine #'thickness = #3.0 c8 c c } >> } \layout { \context { \Score \consists "Grid_line_span_engraver" % center grid lines horizontally below note heads \override NoteColumn #'X-offset = #-0.5 } \context { \Staff \consists "Grid_point_engraver" gridInterval = #(ly:make-moment 1 8) % set line length and positioning: % two staff spaces above center line on hidden staff % to four spaces below center line on visible staff \override GridPoint #'Y-extent = #'(2 . -4) } ragged-right = ##t } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼴楬祬㔭ㄸ㤱愳⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Making some staff lines thicker than the others =============================================== For pedagogical purposes, a staff line can be thickened (e.g., the middle line, or to emphasize the line of the G clef). This can be achieved by adding extra lines very close to the line that should be emphasized, using the `line-positions' property of the `StaffSymbol' object. { \override Staff.StaffSymbol #'line-positions = #'(-4 -2 -0.2 0 0.2 2 4) d'4 e' f' g' } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼱楬祬㌭㕢㌵㌳⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Marking notes of spoken parts with a cross on the stem ====================================================== This example shows how to put crosses on stems. Mark the beginning of a spoken section with the `\speakOn' keyword, and end it with the `\speakOff' keyword. speakOn = { \override Stem #'stencil = #(lambda (grob) (let* ((x-parent (ly:grob-parent grob X)) (is-rest? (ly:grob? (ly:grob-object x-parent 'rest)))) (if is-rest? empty-stencil (ly:stencil-combine-at-edge (ly:stem::print grob) Y (- (ly:grob-property grob 'direction)) (grob-interpret-markup grob (markup #:hspace -1.025 #:fontsize -4 #:musicglyph "noteheads.s2cross")) -2.3 0)))) } speakOff = { \revert Stem #'stencil } \score { \new Staff { \relative c'' { a4 b a c \speakOn g4 f r g b4 r d e \speakOff c4 a g f } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼹楬祬挭㘴捡昳⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Measure counter =============== This snippet provides a workaround for emitting measure counters using transparent percent repeats. << \context Voice = "foo" { \clef bass c4 r g r c4 r g r c4 r g r c4 r g r } \context Voice = "foo" { \set countPercentRepeats = ##t \override PercentRepeat #'transparent = ##t \override PercentRepeatCounter #'staff-padding = #1 \repeat percent 4 { s1 } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⽤楬祬搭㜸摢㕦⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Positioning fingering indications precisely =========================================== Generally the options available for positioning the fingering of chords work well by default, but if one of the indications needs to positioned more precisely the following tweak may be used. This is particularly useful for correcting the positioning when intervals of a second are involved. \relative c' { \set fingeringOrientations = #'(left) <c-1 d-2 a'-5>4 <c-1 d-\tweak #'extra-offset #'(0 . 0.7)-2 a'-5>4 \set fingeringOrientations = #'(down) <c-1 d-2 a'-5>4 <c-1 d-\tweak #'extra-offset #'(-1.2 . 0)-2 a'-5>4 \set fingeringOrientations = #'(down right up) <c-1 d-2 a'-5>4 <c-1 d-\tweak #'extra-offset #'(-1 . 1.2)-2 a'-5>4 \set fingeringOrientations = #'(up) <c-1 d-2 a'-5>4 <c-1 d-\tweak #'extra-offset #'(-1.2 . 0)-2 a'-5>4 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼸楬祬昭〲㥡〴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Positioning text markups inside slurs ===================================== Text markups need to have the `outside-staff-priority' property set to false in order to be printed inside slurs. \relative c'' { \override TextScript #'avoid-slur = #'inside \override TextScript #'outside-staff-priority = ##f c2(^\markup { \halign #-10 \natural } d4.) c8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼱楬祬搭㐲㘵昷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing text from right to left ================================ It is possible to print text from right to left in a markup object, as demonstrated here. { b1^\markup { \line { i n g i r u m i m u s n o c t e } } f'_\markup { \override #'(text-direction . -1) \line { i n g i r u m i m u s n o c t e } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼳楬祬㈭ㄲ㤴㌲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Using PostScript to generate special note head shapes ===================================================== When a note head with a special shape cannot easily be generated with graphic markup, PostScript code can be used to generate the shape. This example shows how a parallelogram-shaped note head is generated. parallelogram = #(ly:make-stencil (list 'embedded-ps "gsave currentpoint translate newpath 0 0.25 moveto 1.3125 0.75 lineto 1.3125 -0.25 lineto 0 -0.75 lineto closepath fill grestore" ) (cons 0 1.3125) (cons 0 0)) myNoteHeads = \override NoteHead #'stencil = \parallelogram normalNoteHeads = \revert NoteHead #'stencil \relative c'' { \myNoteHeads g4 d' \normalNoteHeads <f, \tweak #'stencil \parallelogram b e>4 d } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼷楬祬戭㔸㐹㙢⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Text, Next: Vocal music, Prev: Editorial annotations, Up: Top Text **** These snippets illustrate *note Text: (lilypond)Text. Adding the current date to a score ================================== With a little Scheme code, the current date can easily be added to a score. % first, define a variable to hold the formatted date: date = #(strftime "%d-%m-%Y" (localtime (current-time))) % use it in the title block: \header { title = "Including the date!" subtitle = \date } \score { \relative c'' { c4 c c c } } % and use it in a \markup block: \markup { \date } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼲楬祬搭敡戹愸⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Adjusting lyrics vertical spacing ================================= This snippet shows how to bring the lyrics line closer to the staff. % Default layout: << \new Staff \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \lyricsto melody { aa aa aa aa aa aa aa aa aa } % Reducing the minimum space below the staff and above the lyrics: \new Staff \with { \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 4) } \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \with { \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.2 . 1) } \lyricsto melody { aa aa aa aa aa aa aa aa aa } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼶楬祬㔭㉡㘵攵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Aligning and centering instrument names ======================================= The horizontal alignment of instrument names is tweaked by changing the `Staff.InstrumentName #'self-alignment-X' property. The `\layout' variables `indent' and `short-indent' define the space in which the instrument names are aligned before the first and the following systems, respectively. \paper { left-margin = 3\cm } \score { \new StaffGroup << \new Staff { \override Staff.InstrumentName #'self-alignment-X = #LEFT \set Staff.instrumentName = \markup \left-column { "Left aligned" "instrument name" } \set Staff.shortInstrumentName = #"Left" c''1 \break c''1 } \new Staff { \override Staff.InstrumentName #'self-alignment-X = #CENTER \set Staff.instrumentName = \markup \center-column { Centered "instrument name" } \set Staff.shortInstrumentName = #"Centered" g'1 g'1 } \new Staff { \override Staff.InstrumentName #'self-alignment-X = #RIGHT \set Staff.instrumentName = \markup \right-column { "Right aligned" "instrument name" } \set Staff.shortInstrumentName = #"Right" e'1 e'1 } >> \layout { ragged-right = ##t indent = 4\cm short-indent = 2\cm } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼸楬祬〭慥〹づ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Aligning marks with various notation objects ============================================ If specified, text marks may be aligned with notation objects other than bar lines. These objects include `ambitus', `breathing-sign', `clef', `custos', `staff-bar', `left-edge', `key-cancellation', `key-signature', and `time-signature'. In such cases, text marks will be horizontally centered above the object. However this can be changed, as demonstrated on the second line of this example (in a score with multiple staves, this setting should be done for all the staves). \relative c' { e1 % the RehearsalMark will be centered above the Clef \override Score.RehearsalMark #'break-align-symbols = #'(clef) \key a \major \clef treble \mark "â" e1 % the RehearsalMark will be centered above the TimeSignature \override Score.RehearsalMark #'break-align-symbols = #'(time-signature) \key a \major \clef treble \time 3/4 \mark "â" e2. % the RehearsalMark will be centered above the KeySignature \override Score.RehearsalMark #'break-align-symbols = #'(key-signature) \key a \major \clef treble \time 4/4 \mark "â" e1 \break e1 % the RehearsalMark will be aligned with the left edge of the KeySignature \once \override Score.KeySignature #'break-align-anchor-alignment = #LEFT \mark "â" \key a \major e1 % the RehearsalMark will be aligned with the right edge of the KeySignature \once \override Score.KeySignature #'break-align-anchor-alignment = #RIGHT \key a \major \mark "â" e1 % the RehearsalMark will be aligned with the left edge of the KeySignature % and then shifted right by one unit. \once \override Score.KeySignature #'break-align-anchor = #1 \key a \major \mark "â" e1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼴楬祬㠭っ㌶晥湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Aligning objects created with the \mark command =============================================== By default the `\mark' command centers objects over a bar line. This behavior can be modified to align at right or left. \relative c' { c1 \mark "(Center)" c1 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \mark "(Left)" c4 c c c c4 c c c \once \override Score.RehearsalMark #'self-alignment-X = #RIGHT \mark "(Right)" c1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⼹楬祬戭收㤶〶⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Blanking staff lines using the \whiteout command ================================================ The `\whiteout' command underlays a markup with a white box. Since staff lines are in a lower layer than most other grobs, this white box will not overlap any other grob. \layout { ragged-right = ##f } \relative c' { \override TextScript #'extra-offset = #'(2 . 4) c2-\markup { \whiteout \pad-markup #0.5 "middle C" } c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽢楬祬㌭㌷㔵㔱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Center text below hairpin dynamics ================================== This example provides a function to typeset a hairpin (de)crescendo with some additional text below it, such as "molto" or "poco". The example also illustrates how to modify the way an object is normally printed, using some Scheme code. hairpinWithCenteredText = #(define-music-function (parser location text) (markup?) #{ \override Voice.Hairpin #'stencil = #(lambda (grob) (ly:stencil-aligned-to (ly:stencil-combine-at-edge (ly:stencil-aligned-to (ly:hairpin::print grob) X CENTER) Y DOWN (ly:stencil-aligned-to (grob-interpret-markup grob $text) X CENTER)) X LEFT)) #}) hairpinMolto = \hairpinWithCenteredText \markup { \italic molto } hairpinMore = \hairpinWithCenteredText \markup { \larger moltissimo } \layout { ragged-right = ##f } \relative c' { \hairpinMolto c2\< c\f \hairpinMore c2\< c\f } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼰楬祬㜭ㄹ搹ㅤ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the default text font family ===================================== The default font families for text can be overridden with `make-pango-font-tree'. \paper { % change for other default global staff size. myStaffSize = #20 %{ run lilypond -dshow-available-fonts blabla to show all fonts available in the process log. %} #(define fonts (make-pango-font-tree "Times New Roman" "Nimbus Sans" "Luxi Mono" ;; "Helvetica" ;; "Courier" (/ myStaffSize 20))) } \relative c'' { c4^\markup { roman: foo \bold bla \italic bar \italic \bold baz } c'4_\markup { \override #'(font-family . sans) { sans: foo \bold bla \italic bar \italic \bold baz } } c'2^\markup { \override #'(font-family . typewriter) { mono: foo \bold bla \italic bar \italic \bold baz } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⼸楬祬攭㜴㜶戹⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Combining dynamics with markup texts ==================================== Some dynamics may involve text indications (such as "più forte" or "piano subito"). They can be produced using a `\markup' block. piuF = \markup { \italic più \dynamic f } \layout { ragged-right = ##f } \relative c'' { c2\f c-\piuF } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⼲楬祬㔭㤱㕢㍡⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Combining two parts on the same staff ===================================== The part combiner tool ( `\partcombine' command ) allows the combination of several different parts on the same staff. Text directions such as "solo" or "a2" are added by default; to remove them, simply set the property `printPartCombineTexts' to "false". For vocal scores (hymns), there is no need to add "solo"/"a2" texts, so they should be switched off. However, it might be better not to use it if there are any solos, as they won't be indicated. In such cases, standard polyphonic notation may be preferable. This snippet presents the three ways two parts can be printed on a same staff: standard polyphony, `\partcombine' without texts, and `\partcombine' with texts. musicUp = \relative c'' { \time 4/4 a4 c4.( g8) a4 | g4 e' g,( a8 b) | c b a2. } musicDown = \relative c'' { g4 e4.( d8) c4 | r2 g'4( f8 e) | d2 \stemDown a } \score { << << \new Staff { \set Staff.instrumentName = "Standard polyphony " << \musicUp \\ \musicDown >> } \new Staff \with { printPartCombineTexts = ##f } { \set Staff.instrumentName = "PartCombine without texts " \partcombine \musicUp \musicDown } \new Staff { \set Staff.instrumentName = "PartCombine with texts " \partcombine \musicUp \musicDown } >> >> \layout { indent = 6.0\cm \context { \Score \override SystemStartBar #'collapse-height = #30 } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⼸楬祬攭慤愶㔹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating "real" parenthesized dynamics ====================================== Although the easiest way to add parentheses to a dynamic mark is to use a `\markup' block, this method has a downside: the created objects will behave like text markups, and not like dynamics. However, it is possible to create a similar object using the equivalent Scheme code (as described in "Markup programmer interface"), combined with the `make-dynamic-script' function. This way, the markup will be regarded as a dynamic, and therefore will remain compatible with commands such as `\dynamicUp' or `\dynamicDown'. parenF = #(make-dynamic-script (markup #:line (#:normal-text #:italic #:fontsize 2 "(" #:hspace -0.8 #:dynamic "f" #:normal-text #:italic #:fontsize 2 ")"))) \relative c'' { c4\parenF c c \dynamicUp c\parenF } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼹楬祬㘭㠲㑡㍡⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating simultaneous rehearsal marks ===================================== Unlike text scripts, rehearsal marks cannot be stacked at a particular point in a score: only one `RehearsalMark' object is created. Using an invisible measure and bar line, an extra rehearsal mark can be added, giving the appearance of two marks in the same column. This method may also prove useful for placing rehearsal marks at both the end of one system and the start of the following system. { \key a \major \set Score.markFormatter = #format-mark-box-letters \once \override Score.RehearsalMark #'outside-staff-priority = #5000 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \once \override Score.RehearsalMark #'break-align-symbols = #'(key-signature) \mark \markup { \bold { Senza denti } } % the hidden measure and bar line \once \override Score.TimeSignature #'stencil = ##f \time 1/16 s16 \bar "" \time 4/4 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \mark \markup { \box \bold Intro } d'1 \mark \default d'1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼸楬祬愭つ㐶摦⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating text spanners ====================== The `\startTextSpan' and `\stopTextSpan' commands allow the creation of text spanners as easily as pedal indications or octavations. Override some properties of the `TextSpanner' object to modify its output. \paper { ragged-right = ##f } \relative c'' { \override TextSpanner #'(bound-details left text) = #"bla" \override TextSpanner #'(bound-details right text) = #"blu" a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner #'style = #'line \once \override TextSpanner #'(bound-details left stencil-align-dir-y) = #CENTER a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner #'style = #'dashed-line \override TextSpanner #'(bound-details left text) = \markup { \draw-line #'(0 . 1) } \override TextSpanner #'(bound-details right text) = \markup { \draw-line #'(0 . -2) } \once \override TextSpanner #'(bound-details right padding) = #-2 a4 \startTextSpan b4 c a4 \stopTextSpan \set Staff.middleCPosition = #-13 \override TextSpanner #'dash-period = #10 \override TextSpanner #'dash-fraction = #0.5 \override TextSpanner #'thickness = #10 a4 \startTextSpan b4 c a4 \stopTextSpan } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼳楬祬㐭㔱昶㙣⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Demonstrating all headers ========================= All header fields with special meanings. \header { copyright = "copyright" title = "title" subtitle = "subtitle" composer = "composer" arranger = "arranger" instrument = "instrument" metre = "metre" opus = "opus" piece = "piece" poet = "poet" texidoc = "All header fields with special meanings." copyright = "public domain" enteredby = "jcn" source = "urtext" } \layout { ragged-right = ##f } \score { \relative c'' { c1 | c | c | c } } \score { \relative c'' { c1 | c | c | c } \header { title = "localtitle" subtitle = "localsubtitle" composer = "localcomposer" arranger = "localarranger" instrument = "localinstrument" metre = "localmetre" opus = "localopus" piece = "localpiece" poet = "localpoet" copyright = "localcopyright" } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼰楬祬昭攷㍥捥⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Embedding native PostScript in a \markup block ============================================== PostScript code can be directly inserted inside a `\markup' block. % PostScript is a registered trademark of Adobe Systems Inc. \relative c'' { a4-\markup { \postscript #"3 4 moveto 5 3 rlineto stroke" } -\markup { \postscript #"[ 0 1 ] 0 setdash 3 5 moveto 5 -3 rlineto stroke " } b4-\markup { \postscript #"3 4 moveto 0 0 1 2 8 4 20 3.5 rcurveto stroke" } s2 a'1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⽣楬祬〭攸ㅥㅡ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Formatting lyrics syllables =========================== To format individual syllables in lyrics, use `\markup { .... }' on these lyrics. % Tip taken from http://lists.gnu.org/archive/html/lilypond-user/2007-12/msg00215.html \header { title = "Markup can be used inside lyrics!" } mel = \relative c'' { c4 c c c } lyr = \lyricmode { Lyrics \markup { \italic "can" } \markup {\with-color #red "contain" } \markup {\fontsize #8 \bold "Markup!" } } << \context Voice = melody \mel \context Lyrics \lyricsto melody \lyr >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼹楬祬㈭〰㘵㐶⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 How to put ties between syllables in lyrics =========================================== This can be achieved by separating those syllables by tildes. \lyrics { wa~o~a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼸楬祬〭ㅦ晣㌲⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Lyrics alignment ================ Horizontal alignment for lyrics cam be set by overriding the `self-alignment-X' property of the `LyricText' object. `#-1' is left, `#0' is center and `#1' is right; however, you can use `#LEFT', `#CENTER' and `#RIGHT' as well. \layout { ragged-right = ##f } \relative c'' { c1 c1 c1 } \addlyrics { \once \override LyricText #'self-alignment-X = #LEFT "This is left-aligned" \once \override LyricText #'self-alignment-X = #CENTER "This is centered" \once \override LyricText #'self-alignment-X = #1 "This is right-aligned" } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⽢楬祬攭㉡〸㡣湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Markup lines ============ Text that can spread over pages is entered with the `\markuplines' command. #(set-default-paper-size "a6") #(define-markup-list-command (paragraph layout props args) (markup-list?) (interpret-markup-list layout props (make-justified-lines-markup-list (cons (make-hspace-markup 2) args)))) % Candide, Voltaire \markuplines { \override-lines #'(baseline-skip . 2.5) { \paragraph { Il y avait en Westphalie, dans le château de M. le baron de Thunder-ten-tronckh, un jeune garçon à qui la nature avait donné les mÅurs les plus douces. Sa physionomie annonçait son âme. Il avait le jugement assez droit, avec l'esprit le plus simple ; c'est, je crois, pour cette raison qu'on le nommait Candide. Les anciens domestiques de la maison soupçonnaient qu'il était fils de la sÅur de monsieur le baron et d'un bon et honnête gentilhomme du voisinage, que cette demoiselle ne voulut jamais épouser parce qu'il n'avait pu prouver que soixante et onze quartiers, et que le reste de son arbre généalogique avait été perdu par l'injure du temps. } \paragraph { Monsieur le baron était un des plus puissants seigneurs de la Westphalie, car son château avait une porte et des fenêtres. Sa grande salle même était ornée d'une tapisserie. Tous les chiens de ses basses-cours composaient une meute dans le besoin ; ses palefreniers étaient ses piqueurs; le vicaire du village était son grand-aumônier. Ils l'appelaient tous monseigneur, et ils riaient quand il faisait des contes. } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⽣楬祬㐭愶扢敦⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Multi-measure rest markup ========================= Markups attached to a multi-measure rest will be centered above or below it. Long markups attached to multi-measure rests do not cause the measure to expand. To expand a multi-measure rest to fit the markup, use a spacer rest with an attached markup before the multi-measure rest. Note that the spacer rest causes a bar line to be inserted. Text attached to a spacer rest in this way is left-aligned to the position where the note would be placed in the measure, but if the measure length is determined by the length of the text, the text will appear to be centered. \relative c' { \compressFullBarRests \textLengthOn s1*0^\markup { [MAJOR GENERAL] } R1*19 s1*0_\markup { \italic { Cue: ... it is yours } } s1*0^\markup { A } R1*30^\markup { [MABEL] } \textLengthOff c4^\markup { CHORUS } d f c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼶楬祬戭捣搷捡⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Ottava text =========== Internally, `\ottava' sets the properties `ottavation' (for example, to `"8va"' or `"8vb"') and `middleCPosition'. To override the text of the bracket, set `ottavation' after invoking `\ottava'. { \ottava #1 \set Staff.ottavation = #"8" c''1 \ottava #0 c'1 \ottava #1 \set Staff.ottavation = #"Text" c''1 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼶楬祬愭㙦搳攲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Outputting the version number ============================= By putting the output of `lilypond-version' into a lyric, it is possible to print the version number of LilyPond in a score, or in a document generated with `lilypond-book'. Another possibility is to append the version number to the doc-string, in this manner: \score { \new Lyrics { \override Score.RehearsalMark #'self-alignment-X = #LEFT \mark #(string-append "Processed with LilyPond version " (lilypond-version)) s2 } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼷楬祬㘭㥥㝤摣⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Piano template with centered lyrics =================================== Instead of having a full staff for the melody and lyrics, lyrics can be centered between the staves of a piano staff. upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } text = \lyricmode { Aaa Bee Cee Dee } \score { \new GrandStaff << \new Staff = upper { \new Voice = "singer" \upper } \new Lyrics \lyricsto "singer" \text \new Staff = lower { \lower } >> \layout { \context { \GrandStaff \accepts "Lyrics" } \context { \Lyrics \consists "Bar_engraver" } } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼹楬祬ㄭ㕤㌸愳⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing marks at the end of a line or a score ============================================== Marks can be printed at the end of the current line, instead of the beginning of the following line. This is particularly useful when a mark has to be added at the end of a score - when there is no next line. In such cases, the right end of the mark has to be aligned with the final bar line, as demonstrated on the second line of this example. \relative c'' { \override Score.RehearsalMark #'break-visibility = #begin-of-line-invisible g2 c d,2 a' \mark \default \break g2 b, c1 \bar "||" \override Score.RehearsalMark #'self-alignment-X = #RIGHT \mark "D.C. al Fine" } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼷楬祬〭㡤戳户湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing marks on every staff ============================= Although text marks are normally only printed above the topmost staff, they may also be printed on every staff. \score { << \new Staff { c''1 \mark "molto" c'' } \new Staff { c'1 \mark "molto" c' } >> \layout { \context { \Score \remove "Mark_engraver" \remove "Staff_collecting_engraver" } \context { \Staff \consists "Mark_engraver" \consists "Staff_collecting_engraver" } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼵楬祬〭㤴㡡〸⸰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing text from right to left ================================ It is possible to print text from right to left in a markup object, as demonstrated here. { b1^\markup { \line { i n g i r u m i m u s n o c t e } } f'_\markup { \override #'(text-direction . -1) \line { i n g i r u m i m u s n o c t e } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼳楬祬㈭ㄲ㤴㌲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Stand-alone two-column markup ============================= Stand-alone text may be arranged in several columns using `\markup' commands: \markup { \fill-line { \hspace #1 \column { \line { O sacrum convivium } \line { in quo Christus sumitur, } \line { recolitur memoria passionis ejus, } \line { mens impletur gratia, } \line { futurae gloriae nobis pignus datur. } \line { Amen. } } \hspace #2 \column { \line { \italic { O sacred feast } } \line { \italic { in which Christ is received, } } \line { \italic { the memory of His Passion is renewed, } } \line { \italic { the mind is filled with grace, } } \line { \italic { and a pledge of future glory is given to us. } } \line { \italic { Amen. } } } \hspace #1 } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼰楬祬㔭挴〶攴⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Three-sided box =============== This example shows how to add a markup command to get a three sided box around some text (or other markup). % New command to add a three sided box, with sides north, west and south % Based on the box-stencil command defined in scm/stencil.scm % Note that ";" is used to comment a line in Scheme #(define-public (NWS-box-stencil stencil thickness padding) "Add a box around STENCIL, producing a new stencil." (let* ((x-ext (interval-widen (ly:stencil-extent stencil 0) padding)) (y-ext (interval-widen (ly:stencil-extent stencil 1) padding)) (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext)) (x-rule (make-filled-box-stencil (interval-widen x-ext thickness) (cons 0 thickness)))) ; (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil X -1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil Y 1 x-rule 0.0)) (set! stencil (ly:stencil-combine-at-edge stencil Y -1 x-rule 0.0)) stencil)) % The corresponding markup command, based on the \box command defined % in scm/define-markup-commands.scm #(define-markup-command (NWS-box layout props arg) (markup?) "Draw a box round @var{arg}. Looks at @code{thickness}, @code{box-padding} and @code{font-size} properties to determine line thickness and padding around the markup." (let* ((th (chain-assoc-get 'thickness props 0.1)) (size (chain-assoc-get 'font-size props 0)) (pad (* (magstep size) (chain-assoc-get 'box-padding props 0.2))) (m (interpret-markup layout props arg))) (NWS-box-stencil m th pad))) % Test it: \layout { ragged-right = ##f } \relative c' { c2^\markup { \NWS-box ABCD } c2^\markup { \NWS-box \note #"4" #1.0 } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⽢楬祬㘭㔸㔸㠱⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 UTF-8 ===== Various scripts may be used for texts (like titles and lyrics) by entering them in UTF-8 encoding, and using a Pango based backend. Depending on the fonts installed, this fragment will render Bulgarian (Cyrillic), Hebrew, Japanese and Portuguese. % end verbatim - this comment is a hack to prevent texinfo.tex % from choking on non-European UTF-8 subsets %% Edit this file using a Unicode aware editor, such as GVIM, GEDIT, Emacs %{ You may have to install additional fonts. Red Hat Fedora taipeifonts fonts-xorg-truetype ttfonts-ja fonts-arabic \ ttfonts-zh_CN fonts-ja fonts-hebrew Debian GNU/Linux apt-get install emacs-intl-fonts xfonts-intl-.* \ ttf-kochi-gothic ttf-kochi-mincho \ xfonts-bolkhov-75dpi xfonts-cronyx-100dpi xfonts-cronyx-75dpi %} % Cyrillic font bulgarian = \lyricmode { ÐÑлÑаÑа дÑÐ»Ñ Ð±ÐµÑе ÑаÑÑлива, Ñе пÑÑ ÑÑ, койÑо ÑÑÑна, замÑÑзна каÑо гÑон. } hebrew = \lyricmode { ×× ×××£ ×¡×ª× ×ש×××¢ ××× ×ª× ×¦× ×§×¨×¤× ×¢×¥ ××× ×××. } japanese = \lyricmode { ããã¯ã«ã»ã¸ã© ã¡ãã¬ãã ãããããã ã¤ããªãã ããã®ããã ã¾ããµãã㦠ãããããã¿ã ãã²ããã } % "a legal song to you" portuguese = \lyricmode { à vo -- cê uma can -- ção legal } \relative c' { c2 d e2 f g2 f e1 } \addlyrics { \bulgarian } \addlyrics { \hebrew } \addlyrics { \japanese } \addlyrics { \portuguese } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼲楬祬㜭搲攱昰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vocal ensemble template with lyrics aligned below and above the staves ====================================================================== This template is basically the same as the simple "Vocal ensemble" template, with the exception that here all the lyrics lines are placed using `alignAboveContext' and `alignBelowContext'. global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords = \lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { \new ChoirStaff << \new Staff = women << \new Voice = "sopranos" { \voiceOne << \global \sopMusic >> } \new Voice = "altos" { \voiceTwo << \global \altoMusic >> } >> \new Lyrics \with { alignAboveContext = women } \lyricsto sopranos \sopWords \new Lyrics \with { alignBelowContext = women } \lyricsto altos \altoWords % we could remove the line about this with the line below, since we want % the alto lyrics to be below the alto Voice anyway. % \new Lyrics \lyricsto altos \altoWords \new Staff = men << \clef bass \new Voice = "tenors" { \voiceOne << \global \tenorMusic >> } \new Voice = "basses" { \voiceTwo << \global \bassMusic >> } >> \new Lyrics \with { alignAboveContext = men } \lyricsto tenors \tenorWords \new Lyrics \with { alignBelowContext = men } \lyricsto basses \bassWords % again, we could replace the line above this with the line below. % \new Lyrics \lyricsto basses \bassWords >> \layout { \context { % a little smaller so lyrics % can be closer to the staff \Staff \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼵楬祬戭〶戸㘱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Volta text markup using repeatCommands ====================================== Though volte are best specified using `\repeat volta', the context property `repeatCommands' must be used in cases where the volta text needs more advanced formatting with `\markup'. Since `repeatCommands' takes a list, the simplest method of including markup is to use an identifier for the text and embed it in the command list using the Scheme syntax `#(list (list 'volta textIdentifier))'. Start- and end-repeat commands can be added as separate list elements: voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } } \relative c'' { c1 \set Score.repeatCommands = #(list (list 'volta voltaAdLib) 'start-repeat) c4 b d e \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat) f1 \set Score.repeatCommands = #'((volta #f)) } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽥楬祬㌭㥣攳愱⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Vocal music, Next: Chords, Prev: Text, Up: Top Vocal music *********** These snippets illustrate *note Vocal music: (lilypond)Vocal music. Adding ambitus per voice ======================== Ambitus can be added per voice. In this case, the ambitus must be moved manually to prevent collisions. \new Staff << \new Voice \with { \consists "Ambitus_engraver" } \relative c'' { \override Ambitus #'X-offset = #2.0 \voiceOne c4 a d e f1 } \new Voice \with { \consists "Ambitus_engraver" } \relative c' { \voiceTwo es4 f g as b1 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼲楬祬㤭㙦㉣ㄴ⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Adjusting lyrics vertical spacing ================================= This snippet shows how to bring the lyrics line closer to the staff. % Default layout: << \new Staff \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \lyricsto melody { aa aa aa aa aa aa aa aa aa } % Reducing the minimum space below the staff and above the lyrics: \new Staff \with { \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 4) } \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \with { \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.2 . 1) } \lyricsto melody { aa aa aa aa aa aa aa aa aa } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼶楬祬㔭㉡㘵攵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Ambitus with multiple voices ============================ Adding the `Ambitus_engraver' to the `Staff' context creates a single ambitus per staff, even in the case of staves with multiple voices. \new Staff \with { \consists "Ambitus_engraver" } << \new Voice \relative c'' { \voiceOne c4 a d e f1 } \new Voice \relative c' { \voiceTwo es4 f g as b1 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⼱楬祬ㄭ挲㉤㠰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Ambitus ======= Ambitus indicate pitch ranges for voices. Accidentals only show up if they are not part of the key signature. `AmbitusNoteHead' grobs also have ledger lines. \layout { \context { \Voice \consists "Ambitus_engraver" } } << \new Staff { \relative c' { \time 2/4 c4 f' } } \new Staff { \relative c' { \time 2/4 \key d \major cis4 as' } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⽦楬祬㤭攴㔶㝤湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing stanza fonts ===================== Fonts can be changed independently for each stanza, including the font used for printing the stanza number. \new Voice { \time 3/4 g2 e4 a2 f4 g2. } \addlyrics { \set stanza = #"1. " Hi, my name is Bert. } \addlyrics { \override StanzaNumber #'font-name = #"DejaVu" \set stanza = #"2. " \override LyricText #'font-family = #'typewriter Oh, ché -- ri, je t'aime } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼸楬祬㠭㔸㙦昸⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Chant or psalms notation ======================== This form of notation is used for the chant of the Psalms, where verses aren't always the same length. stemOn = { \revert Staff.Stem #'transparent } stemOff = { \override Staff.Stem #'transparent = ##t } \score { \new Staff \with { \remove "Time_signature_engraver" } { \key g \minor \cadenzaOn \stemOff a'\breve bes'4 g'4 \stemOn a'2 \bar "||" \stemOff a'\breve g'4 a'4 \stemOn f'2 \bar "||" \stemOff a'\breve^\markup { \italic flexe } \stemOn g'2 \bar "||" } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⽢楬祬挭攵㉣㕢⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Formatting lyrics syllables =========================== To format individual syllables in lyrics, use `\markup { .... }' on these lyrics. % Tip taken from http://lists.gnu.org/archive/html/lilypond-user/2007-12/msg00215.html \header { title = "Markup can be used inside lyrics!" } mel = \relative c'' { c4 c c c } lyr = \lyricmode { Lyrics \markup { \italic "can" } \markup {\with-color #red "contain" } \markup {\fontsize #8 \bold "Markup!" } } << \context Voice = melody \mel \context Lyrics \lyricsto melody \lyr >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼹楬祬㈭〰㘵㐶⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 How to put ties between syllables in lyrics =========================================== This can be achieved by separating those syllables by tildes. \lyrics { wa~o~a } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼸楬祬〭ㅦ晣㌲⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Lyrics alignment ================ Horizontal alignment for lyrics cam be set by overriding the `self-alignment-X' property of the `LyricText' object. `#-1' is left, `#0' is center and `#1' is right; however, you can use `#LEFT', `#CENTER' and `#RIGHT' as well. \layout { ragged-right = ##f } \relative c'' { c1 c1 c1 } \addlyrics { \once \override LyricText #'self-alignment-X = #LEFT "This is left-aligned" \once \override LyricText #'self-alignment-X = #CENTER "This is centered" \once \override LyricText #'self-alignment-X = #1 "This is right-aligned" } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴ㄯ⽢楬祬攭㉡〸㡣湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Marking notes of spoken parts with a cross on the stem ====================================================== This example shows how to put crosses on stems. Mark the beginning of a spoken section with the `\speakOn' keyword, and end it with the `\speakOff' keyword. speakOn = { \override Stem #'stencil = #(lambda (grob) (let* ((x-parent (ly:grob-parent grob X)) (is-rest? (ly:grob? (ly:grob-object x-parent 'rest)))) (if is-rest? empty-stencil (ly:stencil-combine-at-edge (ly:stem::print grob) Y (- (ly:grob-property grob 'direction)) (grob-interpret-markup grob (markup #:hspace -1.025 #:fontsize -4 #:musicglyph "noteheads.s2cross")) -2.3 0)))) } speakOff = { \revert Stem #'stencil } \score { \new Staff { \relative c'' { a4 b a c \speakOn g4 f r g b4 r d e \speakOff c4 a g f } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼹楬祬挭㘴捡昳⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Piano template with melody and lyrics ===================================== Here is a typical song format: one staff with the melody and lyrics, with piano accompaniment underneath. melody = \relative c'' { \clef treble \key c \major \time 4/4 a b c d } text = \lyricmode { Aaa Bee Cee Dee } upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } \score { << \new Voice = "mel" { \autoBeamOff \melody } \new Lyrics \lyricsto mel \text \new PianoStaff << \new Staff = "upper" \upper \new Staff = "lower" \lower >> >> \layout { \context { \RemoveEmptyStaffContext } } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼲楬祬挭收㈴捦⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Single staff template with notes, lyrics, and chords ==================================================== This template allows the preparation of a song with melody, words, and chords. melody = \relative c' { \clef treble \key c \major \time 4/4 a4 b c d } text = \lyricmode { Aaa Bee Cee Dee } harmonies = \chordmode { a2 c } \score { << \new ChordNames { \set chordChanges = ##t \harmonies } \new Voice = "one" { \autoBeamOff \melody } \new Lyrics \lyricsto "one" \text >> \layout { } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽥楬祬ㄭ戱㔶ㅢ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Single staff template with notes, lyrics, chords and frets ========================================================== Here is a simple lead sheet template with melody, lyrics, chords and fret diagrams. verseI = \lyricmode { \set stanza = #"1." This is the first verse } verseII = \lyricmode { \set stanza = #"2." This is the second verse. } theChords = \chordmode { % insert chords for chordnames and fretboards here c2 g4 c } staffMelody = \relative c' { \key c \major \clef treble % Type notes for melody here c4 d8 e f4 g \bar "|." } \score { << \context ChordNames { \theChords } \context FretBoards { \theChords } \new Staff { \context Voice = "voiceMelody" { \staffMelody } } \new Lyrics = "lyricsI" { \lyricsto "voiceMelody" \verseI } \new Lyrics = "lyricsII" { \lyricsto "voiceMelody" \verseII } >> \layout { } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼵楬祬〭㥥㈱挷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Single staff template with notes and lyrics =========================================== This small template demonstrates a simple melody with lyrics. Cut and paste, add notes, then words for the lyrics. This example turns off automatic beaming, which is common for vocal parts. To use automatic beaming, change or comment out the relevant line. melody = \relative c' { \clef treble \key c \major \time 4/4 a4 b c d } text = \lyricmode { Aaa Bee Cee Dee } \score{ << \new Voice = "one" { \autoBeamOff \melody } \new Lyrics \lyricsto "one" \text >> \layout { } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⽣楬祬〭晤昰㡢⸱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Skips in lyric mode (2) ======================= Although `s' skips cannot be used in `\lyricmode' (it is taken to be a literal "s", not a space), double quotes (`""') or underscores (`_') are available.So for example: << \relative c'' { a4 b c d } \new Lyrics \lyricmode { a4 "" _ gap } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼸楬祬㈭ㅥ收㥣湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Skips in lyric mode =================== The `s' syntax for skips is only available in note mode and chord mode. In other situations, for example, when entering lyrics, using the `\skip' command is recommended. << \relative { a'1 a } \new Lyrics \lyricmode { \skip 1 bla1 } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⼰楬祬㐭㔶ㄷ扦湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vertically aligning ossias and lyrics ===================================== This snippet demonstrates the use of the context properties `alignBelowContext' and `alignAboveContext' to control the positioning of lyrics and ossias. \paper { ragged-right = ##t } \relative c' << \new Staff = "1" { c4 c s2 } \new Staff = "2" { c4 c s2 } \new Staff = "3" { c4 c s2 } { \skip 2 << \lyrics { \set alignBelowContext = #"1" lyrics4 below } \new Staff \with { alignAboveContext = #"3" fontSize = #-2 \override StaffSymbol #'staff-space = #(magstep -2) \remove "Time_signature_engraver" } { \times 4/6 { \override TextScript #'padding = #3 c8[^"ossia above" d e d e f] } } >> } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⽤楬祬ㄭ㈹ㅡ搹⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vertically centered common lyrics ================================= In a vocal piece where there are several (two,four or more) lines of lyrics, and common lyrics for all voices at some point, these common lyrics may be vertically centered regardingly, as shown in the following example: \include "english.ly" leftbrace = \markup { \override #'(font-encoding . fetaBraces) \lookup #"brace240" } rightbrace = \markup { \rotate #180 \leftbrace } dropLyrics = { \override LyricText #'extra-offset = #'(0 . -5) \override LyricHyphen #'extra-offset = #'(0 . -5) \override LyricExtender #'extra-offset = #'(0 . -5) } raiseLyrics = { \revert LyricText #'extra-offset \revert LyricHyphen #'extra-offset \revert LyricExtender #'extra-offset } skipFour = \repeat unfold 4 { \skip 8 } lyricsA = \lyricmode { The first verse has \dropLyrics the com -- mon __ words \raiseLyrics used in all four. } lyricsB = \lyricmode { In stan -- za two, \skipFour al -- so ap -- pear. } lyricsC = \lyricmode { By the third verse, \skipFour are get -- ting dull. } lyricsD = \lyricmode { Last stan -- za, and \skipFour get used once more. } melody = \relative c' { c4 d e f g f e8( e f) d4 c e d c } \score { << \new Voice = m \melody \new Lyrics \lyricsto m \lyricsA \new Lyrics \lyricsto m \lyricsB \new Lyrics \lyricsto m \lyricsC \new Lyrics \lyricsto m \lyricsD >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼳楬祬㐭ㅢ捣捣⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vocal ensemble template with automatic piano reduction ====================================================== This template adds an automatic piano reduction to the standard SATB vocal score demonstrated in "Vocal ensemble template". This demonstrates one of the strengths of LilyPond â you can use a music definition more than once. If any changes are made to the vocal notes (say, `tenorMusic'), then the changes will also apply to the piano reduction. global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords =\lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { << \new ChoirStaff << \new Lyrics = sopranos { s1 } \new Staff = women << \new Voice = sopranos { \voiceOne << \global \sopMusic >> } \new Voice = altos { \voiceTwo << \global \altoMusic >> } >> \new Lyrics = altos { s1 } \new Lyrics = tenors { s1 } \new Staff = men << \clef bass \new Voice = tenors { \voiceOne <<\global \tenorMusic >> } \new Voice = basses { \voiceTwo <<\global \bassMusic >> } >> \new Lyrics = basses { s1 } \context Lyrics = sopranos \lyricsto sopranos \sopWords \context Lyrics = altos \lyricsto altos \altoWords \context Lyrics = tenors \lyricsto tenors \tenorWords \context Lyrics = basses \lyricsto basses \bassWords >> \new PianoStaff << \new Staff << \set Staff.printPartCombineTexts = ##f \partcombine << \global \sopMusic >> << \global \altoMusic >> >> \new Staff << \clef bass \set Staff.printPartCombineTexts = ##f \partcombine << \global \tenorMusic >> << \global \bassMusic >> >> >> >> \layout { \context { % a little smaller so lyrics % can be closer to the staff \Staff \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⽡楬祬搭㡢㠳晤湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vocal ensemble template with lyrics aligned below and above the staves ====================================================================== This template is basically the same as the simple "Vocal ensemble" template, with the exception that here all the lyrics lines are placed using `alignAboveContext' and `alignBelowContext'. global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords = \lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { \new ChoirStaff << \new Staff = women << \new Voice = "sopranos" { \voiceOne << \global \sopMusic >> } \new Voice = "altos" { \voiceTwo << \global \altoMusic >> } >> \new Lyrics \with { alignAboveContext = women } \lyricsto sopranos \sopWords \new Lyrics \with { alignBelowContext = women } \lyricsto altos \altoWords % we could remove the line about this with the line below, since we want % the alto lyrics to be below the alto Voice anyway. % \new Lyrics \lyricsto altos \altoWords \new Staff = men << \clef bass \new Voice = "tenors" { \voiceOne << \global \tenorMusic >> } \new Voice = "basses" { \voiceTwo << \global \bassMusic >> } >> \new Lyrics \with { alignAboveContext = men } \lyricsto tenors \tenorWords \new Lyrics \with { alignBelowContext = men } \lyricsto basses \bassWords % again, we could replace the line above this with the line below. % \new Lyrics \lyricsto basses \bassWords >> \layout { \context { % a little smaller so lyrics % can be closer to the staff \Staff \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⼵楬祬戭〶戸㘱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vocal ensemble template ======================= Here is a standard four-part SATB vocal score. With larger ensembles, it is often useful to include a section which is included in all parts. For example, the time signature and key signature are almost always the same for all parts. Like in the "Hymn" template, the four voices are regrouped on only two staves. global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords = \lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { \new ChoirStaff << \new Lyrics = sopranos { s1 } \new Staff = women << \new Voice = "sopranos" { \voiceOne << \global \sopMusic >> } \new Voice = "altos" { \voiceTwo << \global \altoMusic >> } >> \new Lyrics = "altos" { s1 } \new Lyrics = "tenors" { s1 } \new Staff = men << \clef bass \new Voice = "tenors" { \voiceOne << \global \tenorMusic >> } \new Voice = "basses" { \voiceTwo << \global \bassMusic >> } >> \new Lyrics = basses { s1 } \context Lyrics = sopranos \lyricsto sopranos \sopWords \context Lyrics = altos \lyricsto altos \altoWords \context Lyrics = tenors \lyricsto tenors \tenorWords \context Lyrics = basses \lyricsto basses \bassWords >> \layout { \context { % a little smaller so lyrics % can be closer to the staff \Staff \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽦楬祬攭㌹㘳㍡⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Chords, Next: Keyboards, Prev: Vocal music, Up: Top Chords ****** These snippets illustrate *note Chord notation: (lilypond)Chord notation. Adding a figured bass above or below the notes ============================================== When writing a figured bass, here's a way to specify if you want your figures to be placed above or below the bass notes, by defining the `BassFigureAlignmentPositioning #'direction' property (exclusively in a `Staff' context). Choices are `#UP' (or `#1'), `#CENTER' (or `#0') and `#DOWN' (or `#-1'). As you can see here, this property can be changed as many times as you wish. Use `\once \override' if you don't want the tweak to apply to the whole score. bass = { \clef bass g4 b, c d e d8 c d2 } continuo = \figuremode { <_>4 <6>8 \once \override Staff.BassFigureAlignmentPositioning #'direction = #CENTER <5/>8 <_>4 \override Staff.BassFigureAlignmentPositioning #'direction = #UP <_+>4 <6> \set Staff.useBassFigureExtenders = ##t \override Staff.BassFigureAlignmentPositioning #'direction = #DOWN <4>4. <4>8 <_+>4 } \score { << \new Staff = bassStaff \bass \context Staff = bassStaff \continuo >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⽦楬祬搭搵㔷攵⸵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Adding bar lines to ChordNames context ====================================== To add bar line indications in the `ChordNames' context, add the `Bar_engraver'. \new ChordNames \with { \override BarLine #'bar-size = #4 \consists "Bar_engraver" } \chordmode { f1:maj7 f:7 bes:7 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼴楬祬㜭㤳戵㐵湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Avoiding collisions with chord fingerings ========================================= Fingerings and string numbers applied to individual notes will automatically avoid beams and stems, but this is not true by default for fingerings and string numbers applied to the individual notes of chords. The following example shows how this default behavior can be overridden. \relative c' { \set fingeringOrientations = #'(up) \set stringNumberOrientations = #'(up) \set strokeFingerOrientations = #'(up) % Default behavior r8 <f c'-5>8 <f c'\5>8 <f c'-\rightHandFinger #2 >8 % Corrected to avoid collisions r8 \override Fingering #'add-stem-support = ##t <f c'-5>8 \override StringNumber #'add-stem-support = ##t <f c'\5>8 \override StrokeFinger #'add-stem-support = ##t <f c'-\rightHandFinger #2 >8 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼱楬祬㤭㈵挸㙥⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing chord separator ======================== The separator between different parts of a chord name can be set to any markup. \chords { c:7sus4 \set chordNameSeparator = \markup { \typewriter | } c:7sus4 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼰楬祬戭搴㍣挷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the chord names to German or semi-German notation ========================================================== The english naming of chords (default) can be changed to german (`\germanChords' replaces B and Bes to H and B) or semi-german (`\semiGermanChords' replaces B and Bes to H and Bb). music = \chordmode { c1/c cis/cis b/b bis/bis bes/bes } %% The following is only here to print the names of the %% chords styles; it can be removed if you do not need to %% print them. \layout { \context {\ChordNames \consists Instrument_name_engraver } } << \new ChordNames { \set ChordNames.instrumentName = #"default" \music } \new ChordNames { \set ChordNames.instrumentName = #"german" \germanChords \music } \new ChordNames { \set ChordNames.instrumentName = #"semi-german" \semiGermanChords \music } \context Voice { \music } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼴楬祬㘭㤶㙤㈷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Changing the positions of figured bass alterations ================================================== Accidentals and plus signs can appear before or after the numbers, depending on the `figuredBassAlterationDirection' and `figuredBassPlusDirection' properties. \figures { <6\+> <5+> <6 4-> r \set figuredBassAlterationDirection = #RIGHT <6\+> <5+> <6 4-> r \set figuredBassPlusDirection = #RIGHT <6\+> <5+> <6 4-> r \set figuredBassAlterationDirection = #LEFT <6\+> <5+> <6 4-> r } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼸楬祬㌭㙣摣愱湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Chord name exceptions ===================== The property `chordNameExceptions' can be used to store a list of special notations for specific chords. % modify maj9 and 6(add9) % Exception music is chords with markups chExceptionMusic = { <c e g b d'>1-\markup { \super "maj9" } <c e g a d'>1-\markup { \super "6(add9)" } } % Convert music to list and prepend to existing exceptions. chExceptions = #( append ( sequential-music-to-chord-exceptions chExceptionMusic #t) ignatzekExceptions) theMusic = \chordmode { g1:maj9 g1:6.9 \set chordNameExceptions = #chExceptions g1:maj9 g1:6.9 } \layout { ragged-right = ##t } << \context ChordNames \theMusic \context Voice \theMusic >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⼵楬祬㐭攳摡㜵⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 chord name major7 ================= The layout of the major 7 can be tuned with `majorSevenSymbol'. \chords { c:7+ \set majorSevenSymbol = \markup { j7 } c:7+ } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⼷楬祬㠭〱㐲搰⸸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Clusters ======== Clusters are a device to denote that a complete range of notes is to be played. fragment = \relative c' { c4 f <e d'>4 <g a>8 <e a> a4 c2 <d b>4 e2 c } << \new Staff \fragment \new Staff \makeClusters \fragment >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽡楬祬挭戲戶挹⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Controlling the placement of chord fingerings ============================================= The placement of fingering numbers can be controlled precisely. \relative c' { \set fingeringOrientations = #'(left) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(down) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(down right up) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(up) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(left) <c-1>2 \set fingeringOrientations = #'(down) <e-3>2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⼳楬祬挭㜲敢㈶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Displaying complex chords ========================= Here is a way to display a chord where the same note is played twice with different accidentals. fixA = { \once \override Stem #'length = #9 \once \override Accidental #'extra-offset = #'(0.3 . 0) } fixB = { \once \override NoteHead #'extra-offset = #'(1.7 . 0) \once \override Stem #'rotation = #'(45 0 0) \once \override Stem #'extra-offset = #'(-0.2 . -0.2) \once \override Stem #'flag-style = #'no-flag \once \override Accidental #'extra-offset = #'(3.1 . 0) } \relative c' { << { \fixA <b d!>8 } \\ { \voiceThree \fixB dis } >> s } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼹楬祬昭收㈴晡湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Manually break figured bass extenders for only some numbers =========================================================== Figured bass often uses extenders to indicate continuation of the corresponding step. However, in this case lilypond is in greedy-mode and uses extenders whenever possible. To break individual extenders, one can simply use a modifier \! to a number, which breaks any extender attributed to that number right before the number. bassfigures = \figuremode { \set useBassFigureExtenders = ##t <6 4>4 <6 4\!> <6 4\!> <6 4\!> | <6\! 4\!> <6 4> <6 4\!> <6 4> } << \new Staff \relative c'' { c1 c1 } \new FiguredBass \bassfigures >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼵楬祬ㄭ昳扡っ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Showing chords at changes ========================= Chord names can be displayed only at the start of lines and when the chord changes. harmonies = \chordmode { c1:m c:m \break c:m c:m d } << \new ChordNames { \set chordChanges = ##t \harmonies } \new Staff { \relative c' { \harmonies } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴搯⼸楬祬㌭㔳㉥〰⸷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Simple lead sheet ================= When put together, chord names, a melody, and lyrics form a lead sheet: << \chords { c2 g:sus4 f e } \relative c'' { a4 e c8 e r4 b2 c4( d) } \addlyrics { One day this shall be free __ } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㈯⽤楬祬搭㍤㌰㥣⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Single staff template with notes, lyrics, and chords ==================================================== This template allows the preparation of a song with melody, words, and chords. melody = \relative c' { \clef treble \key c \major \time 4/4 a4 b c d } text = \lyricmode { Aaa Bee Cee Dee } harmonies = \chordmode { a2 c } \score { << \new ChordNames { \set chordChanges = ##t \harmonies } \new Voice = "one" { \autoBeamOff \melody } \new Lyrics \lyricsto "one" \text >> \layout { } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⽥楬祬ㄭ戱㔶ㅢ湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Single staff template with notes, lyrics, chords and frets ========================================================== Here is a simple lead sheet template with melody, lyrics, chords and fret diagrams. verseI = \lyricmode { \set stanza = #"1." This is the first verse } verseII = \lyricmode { \set stanza = #"2." This is the second verse. } theChords = \chordmode { % insert chords for chordnames and fretboards here c2 g4 c } staffMelody = \relative c' { \key c \major \clef treble % Type notes for melody here c4 d8 e f4 g \bar "|." } \score { << \context ChordNames { \theChords } \context FretBoards { \theChords } \new Staff { \context Voice = "voiceMelody" { \staffMelody } } \new Lyrics = "lyricsI" { \lyricsto "voiceMelody" \verseI } \new Lyrics = "lyricsII" { \lyricsto "voiceMelody" \verseII } >> \layout { } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㠯⼵楬祬〭㥥㈱挷湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Single staff template with notes and chords =========================================== Want to prepare a lead sheet with a melody and chords? Look no further! melody = \relative c' { \clef treble \key c \major \time 4/4 f4 e8[ c] d4 g a2 ~ a } harmonies = \chordmode { c4:m f:min7 g:maj c:aug d2:dim b:sus } \score { << \new ChordNames { \set chordChanges = ##t \harmonies } \new Staff \melody >> \layout{ } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⽣楬祬攭扥愱攴⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Volta below chords ================== By adding the `Volta_engraver' to the relevant staff, volte can be put under chords. \score { << \chords { c1 c1 } \new Staff \with { \consists "Volta_engraver" } { \repeat volta 2 { c'1 } \alternative { c' } } >> \layout { \context { \Score \remove "Volta_engraver" } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⽡楬祬攭昹㈴搲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Keyboards, Next: Percussion, Prev: Chords, Up: Top Keyboards ********* These snippets illustrate *note Keyboard and other multi-staff instruments: (lilypond)Keyboard and other multi-staff instruments. Accordion-discant symbols ========================= Accordion discant-specific symbols are added using `\markup'. The vertical placement of the symbols can be tweaked by changing the `\raise' arguments. discant = \markup { \musicglyph #"accordion.accDiscant" } dot = \markup { \musicglyph #"accordion.accDot" } \layout { ragged-right = ##t } % 16 voets register accBasson = ^\markup { \combine \discant \raise #0.5 \dot } % een korig 8 en 16 voets register accBandon = ^\markup { \combine \discant \combine \raise #0.5 \dot \raise #1.5 \dot } accVCello = ^\markup { \combine \discant \combine \raise #0.5 \dot \combine \raise #1.5 \dot \translate #'(1 . 0) \raise #1.5 \dot } % 4-8-16 voets register accHarmon = ^\markup { \combine \discant \combine \raise #0.5 \dot \combine \raise #1.5 \dot \raise #2.5 \dot } accTrombon = ^\markup { \combine \discant \combine \raise #0.5 \dot \combine \raise #1.5 \dot \combine \translate #'(1 . 0) \raise #1.5 \dot \translate #'(-1 . 0) \raise #1.5 \dot } % eenkorig 4 en 16 voets register accOrgan = ^\markup { \combine \discant \combine \raise #0.5 \dot \raise #2.5 \dot } accMaster = ^\markup { \combine \discant \combine \raise #0.5 \dot \combine \raise #1.5 \dot \combine \translate #'(1 . 0) \raise #1.5 \dot \combine \translate #'(-1 . 0) \raise #1.5 \dot \raise #2.5 \dot } accAccord = ^\markup { \combine \discant \combine \raise #1.5 \dot \combine \translate #'(1 . 0) \raise #1.5 \dot \combine \translate #'(-1 . 0) \raise #1.5 \dot \raise #2.5 \dot } accMusette = ^\markup { \combine \discant \combine \raise #1.5 \dot \combine \translate #'(1 . 0) \raise #1.5 \dot \translate #'(-1 . 0) \raise #1.5 \dot } accCeleste = ^\markup { \combine \discant \combine \raise #1.5 \dot \translate #'(-1 . 0) \raise #1.5 \dot } accOboe = ^\markup { \combine \discant \combine \raise #1.5 \dot \raise #2.5 \dot } accClarin = ^\markup { \combine \discant \raise #1.5 \dot } accPiccolo = ^\markup { \combine \discant \raise #2.5 \dot } accViolin = ^\markup { \combine \discant \combine \raise #1.5 \dot \combine \translate #'(1 . 0) \raise #1.5 \dot \raise #2.5 \dot } \relative c'' { c4 d\accBasson e f c4 d\accBandon e f c4 d\accVCello e f c4 d\accHarmon e f c4 d\accTrombon e f \break c4 d\accOrgan e f c4 d\accMaster e f c4 d\accAccord e f c4 d\accMusette e f c4 d\accCeleste e f \break c4 d\accOboe e f c4 d\accClarin e f c4 d\accPiccolo e f c4 d\accViolin e f } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴戯⼸楬祬㠭〲㑣晥湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Clusters ======== Clusters are a device to denote that a complete range of notes is to be played. fragment = \relative c' { c4 f <e d'>4 <g a>8 <e a> a4 c2 <d b>4 e2 c } << \new Staff \fragment \new Staff \makeClusters \fragment >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㌯⽡楬祬挭戲戶挹⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Controlling the placement of chord fingerings ============================================= The placement of fingering numbers can be controlled precisely. \relative c' { \set fingeringOrientations = #'(left) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(down) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(down right up) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(up) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(left) <c-1>2 \set fingeringOrientations = #'(down) <e-3>2 } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㜯⼳楬祬挭㜲敢㈶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Creating slurs across voices ============================ In some situations, it may be necessary to create slurs between notes from different voices. The solution is to add invisible notes to one of the voices, using `\hideNotes'. This example is measure 235 of the Ciaconna from Bach's 2nd Partita for solo violin, BWV 1004. \relative c' { << { d16( a') s a s a[ s a] s a[ s a] } \\ { \slurUp bes,16[ s e]( \hideNotes a) \unHideNotes f[( \hideNotes a) \unHideNotes fis]( \hideNotes a) \unHideNotes g[( \hideNotes a) \unHideNotes gis]( \hideNotes a) } >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⽢楬祬㈭扡愹㔸湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Fine-tuning pedal brackets ========================== The appearance of pedal brackets may be altered in different ways. \paper { ragged-right = ##f } \relative c'' { c2\sostenutoOn c c2\sostenutoOff c \once \override Staff.PianoPedalBracket #'shorten-pair = #'(-7 . -2) c2\sostenutoOn c c2\sostenutoOff c \once \override Staff.PianoPedalBracket #'edge-height = #'(0 . 3) c2\sostenutoOn c c2\sostenutoOff c } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⼲楬祬㠭㠱搵慥⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Indicating cross-staff chords with arpeggio bracket =================================================== An arpeggio bracket can indicate that notes on two different staves are to be played with the same hand. In order to do this, the `PianoStaff' must be set to accept cross-staff arpeggios and the arpeggios must be set to the bracket shape in the `PianoStaff' context. (Debussy, Les collines dâAnacapri, m. 65) \new PianoStaff << \set PianoStaff.connectArpeggios = ##t \override PianoStaff.Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket \new Staff { \relative c' { \key b \major \time 6/8 b8-.(\arpeggio fis'-.\> cis-. e-. gis-. b-.)\!\fermata^\laissezVibrer \bar "||" } } \new Staff { \relative c' { \clef bass \key b \major << { <a e cis>2.\arpeggio } \\ { <a, e a,>2. } >> } } >> 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㔯⽦楬祬㠭敢ㄲ㕦⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Jazz combo template =================== This is quite an advanced template, for a jazz ensemble. Note that all instruments are notated in `\key c \major'. This refers to the key in concert pitch; the key will be automatically transposed if the music is within a `\transpose' section. \header { title = "Song" subtitle = "(tune)" composer = "Me" meter = "moderato" piece = "Swing" tagline = \markup { \column { "LilyPond example file by Amelie Zapf," "Berlin 07/07/2003" } } } %#(set-global-staff-size 16) \include "english.ly" %%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%% sl = { \override NoteHead #'style = #'slash \override Stem #'transparent = ##t } nsl = { \revert NoteHead #'style \revert Stem #'transparent } crOn = \override NoteHead #'style = #'cross crOff = \revert NoteHead #'style %% insert chord name style stuff here. jazzChords = { } %%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%% global = { \time 4/4 } Key = { \key c \major } % ############ Horns ############ % ------ Trumpet ------ trpt = \transpose c d \relative c'' { \Key c1 | c | c | } trpHarmony = \transpose c' d { \jazzChords } trumpet = { \global \set Staff.instrumentName = #"Trumpet" \clef treble << \trpt >> } % ------ Alto Saxophone ------ alto = \transpose c a \relative c' { \Key c1 | c | c | } altoHarmony = \transpose c' a { \jazzChords } altoSax = { \global \set Staff.instrumentName = #"Alto Sax" \clef treble << \alto >> } % ------ Baritone Saxophone ------ bari = \transpose c a' \relative c { \Key c1 c1 \sl d4^"Solo" d d d \nsl } bariHarmony = \transpose c' a \chordmode { \jazzChords s1 s d2:maj e:m7 } bariSax = { \global \set Staff.instrumentName = #"Bari Sax" \clef treble << \bari >> } % ------ Trombone ------ tbone = \relative c { \Key c1 | c | c } tboneHarmony = \chordmode { \jazzChords } trombone = { \global \set Staff.instrumentName = #"Trombone" \clef bass << \tbone >> } % ############ Rhythm Section ############# % ------ Guitar ------ gtr = \relative c'' { \Key c1 \sl b4 b b b \nsl c1 } gtrHarmony = \chordmode { \jazzChords s1 c2:min7+ d2:maj9 } guitar = { \global \set Staff.instrumentName = #"Guitar" \clef treble << \gtr >> } %% ------ Piano ------ rhUpper = \relative c'' { \voiceOne \Key c1 | c | c } rhLower = \relative c' { \voiceTwo \Key e1 | e | e } lhUpper = \relative c' { \voiceOne \Key g1 | g | g } lhLower = \relative c { \voiceTwo \Key c1 | c | c } PianoRH = { \clef treble \global \set Staff.midiInstrument = #"acoustic grand" << \new Voice = "one" \rhUpper \new Voice = "two" \rhLower >> } PianoLH = { \clef bass \global \set Staff.midiInstrument = "acoustic grand" << \new Voice = "one" \lhUpper \new Voice = "two" \lhLower >> } piano = { << \set PianoStaff.instrumentName = #"Piano" \new Staff = "upper" \PianoRH \new Staff = "lower" \PianoLH >> } % ------ Bass Guitar ------ Bass = \relative c { \Key c1 | c | c } bass = { \global \set Staff.instrumentName = #"Bass" \clef bass << \Bass >> } % ------ Drums ------ up = \drummode { \voiceOne hh4 <hh sn> hh <hh sn> hh4 <hh sn> hh <hh sn> hh4 <hh sn> hh <hh sn> } down = \drummode { \voiceTwo bd4 s bd s bd4 s bd s bd4 s bd s } drumContents = { \global << \set DrumStaff.instrumentName = #"Drums" \new DrumVoice \up \new DrumVoice \down >> } %%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%% \score { << \new StaffGroup = "horns" << \new Staff = "trumpet" \trumpet \new Staff = "altosax" \altoSax \new ChordNames = "barichords" \bariHarmony \new Staff = "barisax" \bariSax \new Staff = "trombone" \trombone >> \new StaffGroup = "rhythm" << \new ChordNames = "chords" \gtrHarmony \new Staff = "guitar" \guitar \new PianoStaff = "piano" \piano \new Staff = "bass" \bass \new DrumStaff \drumContents >> >> \layout { \context { \RemoveEmptyStaffContext } \context { \Score \override BarNumber #'padding = #3 \override RehearsalMark #'padding = #2 skipBars = ##t } } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⽥楬祬㈭㌰㐵ち湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Laissez vibrer ties =================== Laissez vibrer ties have a fixed size. Their formatting can be tuned using `'tie-configuration'. \relative c' { <c e g>4\laissezVibrer r <c f g>\laissezVibrer r <c d f g>4\laissezVibrer r <c d f g>4.\laissezVibrer r8 <c d e f>4\laissezVibrer r \override LaissezVibrerTieColumn #'tie-configuration = #`((-7 . ,DOWN) (-5 . ,DOWN) (-3 . ,UP) (-1 . ,UP)) <c d e f>4\laissezVibrer r } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴支⼶楬祬挭て昴戳⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Piano template (simple) ======================= Here is a simple piano staff with some notes. upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } \score { \new PianoStaff << \set PianoStaff.instrumentName = #"Piano " \new Staff = "upper" \upper \new Staff = "lower" \lower >> \layout { } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㤯⼲楬祬昭㝦〴㜰湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Piano template with centered dynamics ===================================== Many piano scores have the dynamics centered between the two staves. This requires a bit of tweaking to implement, but since the template is right here, you don't have to do the tweaking yourself. global = { \key c \major \time 4/4 } upper = \relative c'' { \clef treble a4 b c d } lower = \relative c { \clef bass a2 c } dynamics = { s2\fff\> s4 s\!\pp } pedal = { s2\sustainOn s\sustainOff } \score { \new PianoStaff = "PianoStaff_pf" << \new Staff = "Staff_pfUpper" << \global \upper >> \new Dynamics = "Dynamics_pf" \dynamics \new Staff = "Staff_pfLower" << \global \lower >> \new Dynamics = "pedal" \pedal >> \layout { % define Dynamics context \context { \type "Engraver_group" \name Dynamics \alias Voice \consists "Output_property_engraver" \consists "Piano_pedal_engraver" \consists "Script_engraver" \consists "New_dynamic_engraver" \consists "Dynamic_align_engraver" \consists "Text_engraver" \consists "Skip_event_swallow_translator" \consists "Axis_group_engraver" pedalSustainStrings = #'("Ped." "*Ped." "*") pedalUnaCordaStrings = #'("una corda" "" "tre corde") \override DynamicLineSpanner #'Y-offset = #0 \override TextScript #'font-size = #2 \override TextScript #'font-shape = #'italic \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1) } % modify PianoStaff context to accept Dynamics context \context { \PianoStaff \accepts Dynamics } } } \score { \new PianoStaff = "PianoStaff_pf" << \new Staff = "Staff_pfUpper" << \global \upper \dynamics \pedal >> \new Staff = "Staff_pfLower" << \global \lower \dynamics \pedal >> >> \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⽡楬祬㘭㥦戴㍥⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Piano template with centered lyrics =================================== Instead of having a full staff for the melody and lyrics, lyrics can be centered between the staves of a piano staff. upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } text = \lyricmode { Aaa Bee Cee Dee } \score { \new GrandStaff << \new Staff = upper { \new Voice = "singer" \upper } \new Lyrics \lyricsto "singer" \text \new Staff = lower { \lower } >> \layout { \context { \GrandStaff \accepts "Lyrics" } \context { \Lyrics \consists "Bar_engraver" } } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⼹楬祬ㄭ㕤㌸愳⸳湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Piano template with melody and lyrics ===================================== Here is a typical song format: one staff with the melody and lyrics, with piano accompaniment underneath. melody = \relative c'' { \clef treble \key c \major \time 4/4 a b c d } text = \lyricmode { Aaa Bee Cee Dee } upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } \score { << \new Voice = "mel" { \autoBeamOff \melody } \new Lyrics \lyricsto mel \text \new PianoStaff << \new Staff = "upper" \upper \new Staff = "lower" \lower >> >> \layout { \context { \RemoveEmptyStaffContext } } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㘯⼲楬祬挭收㈴捦⸹湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Vocal ensemble template with automatic piano reduction ====================================================== This template adds an automatic piano reduction to the standard SATB vocal score demonstrated in "Vocal ensemble template". This demonstrates one of the strengths of LilyPond â you can use a music definition more than once. If any changes are made to the vocal notes (say, `tenorMusic'), then the changes will also apply to the piano reduction. global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords =\lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { << \new ChoirStaff << \new Lyrics = sopranos { s1 } \new Staff = women << \new Voice = sopranos { \voiceOne << \global \sopMusic >> } \new Voice = altos { \voiceTwo << \global \altoMusic >> } >> \new Lyrics = altos { s1 } \new Lyrics = tenors { s1 } \new Staff = men << \clef bass \new Voice = tenors { \voiceOne <<\global \tenorMusic >> } \new Voice = basses { \voiceTwo <<\global \bassMusic >> } >> \new Lyrics = basses { s1 } \context Lyrics = sopranos \lyricsto sopranos \sopWords \context Lyrics = altos \lyricsto altos \altoWords \context Lyrics = tenors \lyricsto tenors \tenorWords \context Lyrics = basses \lyricsto basses \bassWords >> \new PianoStaff << \new Staff << \set Staff.printPartCombineTexts = ##f \partcombine << \global \sopMusic >> << \global \altoMusic >> >> \new Staff << \clef bass \set Staff.printPartCombineTexts = ##f \partcombine << \global \tenorMusic >> << \global \bassMusic >> >> >> >> \layout { \context { % a little smaller so lyrics % can be closer to the staff \Staff \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴是⽡楬祬搭㡢㠳晤湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 File: lilypond-snippets.info, Node: Percussion, Next: Fretted strings, Prev: Keyboards, Up: Top Percussion ********** These snippets illustrate *note Percussion: (lilypond)Percussion. Adding drum parts ================= Using the powerful pre-configured tools such as the `\drummode' function and the `DrumStaff' context, inputting drum parts is quite easy: drums are placed at their own staff positions (with a special clef symbol) and have note heads according to the drum. Attaching an extra symbol to the drum or restricting the number of lines is possible. drh = \drummode { cymc4.^"crash" hhc16^"h.h." hh hhc8 hho hhc8 hh16 hh hhc4 r4 r2 } drl = \drummode { bd4 sn8 bd bd4 << bd ss >> bd8 tommh tommh bd toml toml bd tomfh16 tomfh } timb = \drummode { timh4 ssh timl8 ssh r timh r4 ssh8 timl r4 cb8 cb } \score { << \new DrumStaff \with { drumStyleTable = #timbales-style \override StaffSymbol #'line-count = #2 \override BarLine #'bar-size = #2 } << \set Staff.instrumentName = #"timbales" \timb >> \new DrumStaff << \set Staff.instrumentName = #"drums" \new DrumVoice { \stemUp \drh } \new DrumVoice { \stemDown \drl } >> >> \layout { } \midi { \context { \Score tempoWholesPerMinute = #(ly:make-moment 120 4) } } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼴楬祬㈭㝤㉥㙣⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Heavily customized polymetric time signatures ============================================= Though the polymetric time signature shown was not the most essential item here, it has been included to show the beat of this piece (which is the template of a real Balkan song!). #(define plus (markup #:vcenter "+")) #(define ((custom-time-signature one two three four five six seven eight nine ten eleven num) grob) (grob-interpret-markup grob (markup #:override '(baseline-skip . 0) #:number (#:line ( (#:column (one num)) plus (#:column (two num)) plus (#:column (three num)) plus (#:column (four num)) plus (#:column (five num)) plus (#:column (six num)) plus (#:column (seven num)) plus (#:column (eight num)) plus (#:column (nine num)) plus (#:column (ten num)) plus (#:column (eleven num))))))) melody = \relative c'' { \set Staff.instrumentName = #"Bb Sop." \key g \major #(set-time-signature 25 8 '(3 2 2 3 2 2 2 2 3 2 2)) \override Staff.TimeSignature #'stencil = #(custom-time-signature "3" "2" "2" "3" "2" "2" "2" "2" "3" "2" "2" "8") c8 c c d4 c8 c b c b a4 g fis8 e d c b' c d e4-^ fis8 g \break c,4. d4 c4 d4. c4 d c2 d4. e4-^ d4 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break } drum = \new DrumStaff \drummode { \bar "|:" bd4.^\markup { "Drums" } sn4 bd \bar ":" sn4. bd4 sn \bar ":" bd sn bd4. sn4 bd \bar ":|" } { \melody \drum } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴〯⼳楬祬㈭つ㡥づ⸲湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Jazz combo template =================== This is quite an advanced template, for a jazz ensemble. Note that all instruments are notated in `\key c \major'. This refers to the key in concert pitch; the key will be automatically transposed if the music is within a `\transpose' section. \header { title = "Song" subtitle = "(tune)" composer = "Me" meter = "moderato" piece = "Swing" tagline = \markup { \column { "LilyPond example file by Amelie Zapf," "Berlin 07/07/2003" } } } %#(set-global-staff-size 16) \include "english.ly" %%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%% sl = { \override NoteHead #'style = #'slash \override Stem #'transparent = ##t } nsl = { \revert NoteHead #'style \revert Stem #'transparent } crOn = \override NoteHead #'style = #'cross crOff = \revert NoteHead #'style %% insert chord name style stuff here. jazzChords = { } %%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%% global = { \time 4/4 } Key = { \key c \major } % ############ Horns ############ % ------ Trumpet ------ trpt = \transpose c d \relative c'' { \Key c1 | c | c | } trpHarmony = \transpose c' d { \jazzChords } trumpet = { \global \set Staff.instrumentName = #"Trumpet" \clef treble << \trpt >> } % ------ Alto Saxophone ------ alto = \transpose c a \relative c' { \Key c1 | c | c | } altoHarmony = \transpose c' a { \jazzChords } altoSax = { \global \set Staff.instrumentName = #"Alto Sax" \clef treble << \alto >> } % ------ Baritone Saxophone ------ bari = \transpose c a' \relative c { \Key c1 c1 \sl d4^"Solo" d d d \nsl } bariHarmony = \transpose c' a \chordmode { \jazzChords s1 s d2:maj e:m7 } bariSax = { \global \set Staff.instrumentName = #"Bari Sax" \clef treble << \bari >> } % ------ Trombone ------ tbone = \relative c { \Key c1 | c | c } tboneHarmony = \chordmode { \jazzChords } trombone = { \global \set Staff.instrumentName = #"Trombone" \clef bass << \tbone >> } % ############ Rhythm Section ############# % ------ Guitar ------ gtr = \relative c'' { \Key c1 \sl b4 b b b \nsl c1 } gtrHarmony = \chordmode { \jazzChords s1 c2:min7+ d2:maj9 } guitar = { \global \set Staff.instrumentName = #"Guitar" \clef treble << \gtr >> } %% ------ Piano ------ rhUpper = \relative c'' { \voiceOne \Key c1 | c | c } rhLower = \relative c' { \voiceTwo \Key e1 | e | e } lhUpper = \relative c' { \voiceOne \Key g1 | g | g } lhLower = \relative c { \voiceTwo \Key c1 | c | c } PianoRH = { \clef treble \global \set Staff.midiInstrument = #"acoustic grand" << \new Voice = "one" \rhUpper \new Voice = "two" \rhLower >> } PianoLH = { \clef bass \global \set Staff.midiInstrument = "acoustic grand" << \new Voice = "one" \lhUpper \new Voice = "two" \lhLower >> } piano = { << \set PianoStaff.instrumentName = #"Piano" \new Staff = "upper" \PianoRH \new Staff = "lower" \PianoLH >> } % ------ Bass Guitar ------ Bass = \relative c { \Key c1 | c | c } bass = { \global \set Staff.instrumentName = #"Bass" \clef bass << \Bass >> } % ------ Drums ------ up = \drummode { \voiceOne hh4 <hh sn> hh <hh sn> hh4 <hh sn> hh <hh sn> hh4 <hh sn> hh <hh sn> } down = \drummode { \voiceTwo bd4 s bd s bd4 s bd s bd4 s bd s } drumContents = { \global << \set DrumStaff.instrumentName = #"Drums" \new DrumVoice \up \new DrumVoice \down >> } %%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%% \score { << \new StaffGroup = "horns" << \new Staff = "trumpet" \trumpet \new Staff = "altosax" \altoSax \new ChordNames = "barichords" \bariHarmony \new Staff = "barisax" \bariSax \new Staff = "trombone" \trombone >> \new StaffGroup = "rhythm" << \new ChordNames = "chords" \gtrHarmony \new Staff = "guitar" \guitar \new PianoStaff = "piano" \piano \new Staff = "bass" \bass \new DrumStaff \drumContents >> >> \layout { \context { \RemoveEmptyStaffContext } \context { \Score \override BarNumber #'padding = #3 \override RehearsalMark #'padding = #2 skipBars = ##t } } \midi { } } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴㐯⽥楬祬㈭㌰㐵ち湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Percussion beaters ================== Graphic symbols for percussion instruments are not natively supported; however it is possible to include such symbols, either as an external EPS file or as embedded PostScript code inside a markup, as demonstrated in this example. stick = \markup { \with-dimensions #'(0 . 5) #'(0 . 5) \postscript #" 0 6 translate 0.8 -0.8 scale 0 0 0 setrgbcolor [] 0 setdash 1 setlinewidth 0 setlinejoin 0 setlinecap gsave [1 0 0 1 0 0] concat gsave [1 0 0 1 -3.5406095 -199.29342] concat gsave 0 0 0 setrgbcolor newpath 7.1434065 200.94354 moveto 7.2109628 200.90454 7.2785188 200.86554 7.3460747 200.82654 curveto 8.2056347 202.31535 9.0651946 203.80414 9.9247546 205.29295 curveto 9.8571989 205.33195 9.7896429 205.37095 9.7220864 205.40996 curveto 8.8625264 203.92115 8.0029664 202.43233 7.1434065 200.94354 curveto closepath eofill grestore gsave 0 0 0 setrgbcolor newpath 4.9646672 203.10444 moveto 5.0036707 203.03688 5.0426744 202.96933 5.0816777 202.90176 curveto 6.5704792 203.76133 8.0592809 204.6209 9.5480824 205.48045 curveto 9.5090791 205.54801 9.4700754 205.61556 9.4310717 205.68311 curveto 7.94227 204.82356 6.4534687 203.96399 4.9646672 203.10444 curveto closepath eofill grestore gsave << /ShadingType 3 /ColorSpace /DeviceRGB /Coords [113.13708 207.87465 0 113.13708 207.87465 16.162441] /Extend [true true] /Domain [0 1] /Function << /FunctionType 3 /Functions [ << /FunctionType 2 /Domain [0 1] /C0 [1 1 1] /C1 [0.72941178 0.72941178 0.72941178] /N 1 >> ] /Domain [0 1] /Bounds [ ] /Encode [ 0 1 ] >> >> newpath 7.6422017 200.76488 moveto 7.6505696 201.02554 7.3905363 201.24867 7.1341335 201.20075 curveto 6.8759501 201.16916 6.6949602 200.87978 6.7801462 200.63381 curveto 6.8480773 200.39155 7.1438307 200.25377 7.3728389 200.35861 curveto 7.5332399 200.42458 7.6444521 200.59122 7.6422017 200.76488 curveto closepath clip gsave [0.052859054 0.063089841 -0.020912282 0.017521108 5.7334261 189.76443] concat shfill grestore grestore 0 0 0 setrgbcolor [] 0 setdash 0.027282091 setlinewidth 0 setlinejoin 0 setlinecap newpath 7.6422017 200.76488 moveto 7.6505696 201.02554 7.3905363 201.24867 7.1341335 201.20075 curveto 6.8759501 201.16916 6.6949602 200.87978 6.7801462 200.63381 curveto 6.8480773 200.39155 7.1438307 200.25377 7.3728389 200.35861 curveto 7.5332399 200.42458 7.6444521 200.59122 7.6422017 200.76488 curveto closepath stroke gsave << /ShadingType 3 /ColorSpace /DeviceRGB /Coords [113.13708 207.87465 0 113.13708 207.87465 16.162441] /Extend [true true] /Domain [0 1] /Function << /FunctionType 3 /Functions [ << /FunctionType 2 /Domain [0 1] /C0 [1 1 1] /C1 [0.72941178 0.72941178 0.72941178] /N 1 >> ] /Domain [0 1] /Bounds [ ] /Encode [ 0 1 ] >> >> newpath 5.2721217 202.83181 moveto 5.2804896 203.09247 5.0204563 203.3156 4.7640539 203.26768 curveto 4.5058701 203.23609 4.3248803 202.94671 4.4100662 202.70074 curveto 4.4779975 202.45848 4.7737511 202.3207 5.0027593 202.42554 curveto 5.1631598 202.49149 5.2743721 202.65813 5.2721217 202.83181 curveto closepath clip gsave [0.052859054 0.063089841 -0.020912282 0.017521108 3.363346 191.83136] concat shfill grestore grestore 0 0 0 setrgbcolor [] 0 setdash 0.027282091 setlinewidth 0 setlinejoin 0 setlinecap newpath 5.2721217 202.83181 moveto 5.2804896 203.09247 5.0204563 203.3156 4.7640539 203.26768 curveto 4.5058701 203.23609 4.3248803 202.94671 4.4100662 202.70074 curveto 4.4779975 202.45848 4.7737511 202.3207 5.0027593 202.42554 curveto 5.1631598 202.49149 5.2743721 202.65813 5.2721217 202.83181 curveto closepath stroke grestore grestore " } \score { b1^\stick } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴愯⽥楬祬㜭㉢㘹㌰⸶湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Printing music with different time signatures ============================================= In the following snippet, two parts have a completely different time signature, yet remain synchronized. The bar lines can no longer be printed at the `Score' level; to allow independent bar lines in each part, the `Default_barline_engraver' and `Timing_translator' are moved from the `Score' context to the `Staff' context. \paper { indent = #0 ragged-right = ##t } global = { \time 3/4 { s2.*3 } \bar "" \break { s2.*3 } } \layout { \context { \Score \remove "Timing_translator" \remove "Time_signature_engraver" \remove "Default_bar_line_engraver" \override SpacingSpanner #'uniform-stretching = ##t \override SpacingSpanner #'strict-note-spacing = ##t proportionalNotationDuration = #(ly:make-moment 1 64) } \context { \Staff \consists "Timing_translator" \consists "Default_bar_line_engraver" \consists "Time_signature_engraver" } \context { \Voice \remove "Forbid_line_break_engraver" tupletFullLength = ##t } } Bassklarinette = \new Staff << \global { \bar "|" \clef treble \time 3/8 d''4. \bar "|" \time 3/4 r8 des''2( c''8) \bar "|" \time 7/8 r4. ees''2 ~ \bar "|" \time 2/4 \tupletUp \times 2/3 { ees''4 r4 d''4 ~ } \bar "|" \time 3/8 \tupletUp \times 3/4 { d''4 r4 } \bar "|" \time 2/4 e''2 \bar "|" \time 3/8 es''4. \bar "|" \time 3/4 r8 d''2 r8 \bar "|" } >> Perkussion = \new StaffGroup << \new Staff << \global { \bar "|" \clef percussion \time 3/4 r4 c'2 ~ \bar "|" c'2. \bar "|" R2. \bar "|" r2 g'4 ~ \bar "|" g'2. ~ \bar "|" g'2. } >> \new Staff << \global { \bar "|" \clef percussion \time 3/4 R2. \bar "|" g'2. ~ \bar "|" g'2. \bar "|" r4 g'2 ~ \bar "|" g'2 r4 \bar "|" g'2. } >> >> \score { << \Bassklarinette \Perkussion >> } 嬈浩条牳㵣氢汩灹湯ⵤ湳灩数獴振⼸楬祬㘭搲㔵⸴湰≧愠瑬∽楛慭敧漠畭楳嵣•整瑸∽楛慭敧漠畭楳嵣"崈 Local Variables: coding: utf-8 End: