Staff notation
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation ] | [ Up : Staff notation ] | [ Staff notation: Adding an extra staff at a line break > ] |
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 } >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Adding ambitus per voice ] | [ Up : Staff notation ] | [ Staff notation: Adding an extra staff > ] |
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.
\score { \new StaffGroup \relative c'' { \new Staff \key f \major c1 c^"Unwanted extra space" \break << { c1 | c } \new Staff { \key f \major \once \omit Staff.TimeSignature c1 | c } >> c1 | c^"Fixed here" \break << { c1 | c } \new Staff { \once \set Staff.explicitKeySignatureVisibility = #end-of-line-invisible \key f \major \once \omit Staff.TimeSignature 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 | d } \new Staff { \once \omit Staff.TimeSignature c1 | b } >> c1 } } >> }
Adding indicators to staves which get split after a break
This snippet defines the \splitStaffBarLine
command, which adds
arrows in north-east and south-east directions at a bar line, to denote
that several voices sharing a staff will each continue on a staff of
their own in the next system.
#(define-markup-command (arrow-at-angle layout props angle-deg length fill) (number? number? boolean?) (let* ( ;; PI-OVER-180 and degrees->radians are taken from flag-styles.scm (PI-OVER-180 (/ (atan 1 1) 45)) (degrees->radians (lambda (degrees) (* degrees PI-OVER-180))) (angle-rad (degrees->radians angle-deg)) (target-x (* length (cos angle-rad))) (target-y (* length (sin angle-rad)))) (interpret-markup layout props (markup #:translate (cons (/ target-x 2) (/ target-y 2)) #:rotate angle-deg #:translate (cons (/ length -2) 0) #:concat (#:draw-line (cons length 0) #:arrow-head X RIGHT fill))))) splitStaffBarLineMarkup = \markup \with-dimensions #'(0 . 0) #'(0 . 0) { \combine \arrow-at-angle #45 #(sqrt 8) ##f \arrow-at-angle #-45 #(sqrt 8) ##f } splitStaffBarLine = { \once \override Staff.BarLine.stencil = #(lambda (grob) (ly:stencil-combine-at-edge (ly:bar-line::print grob) X RIGHT (grob-interpret-markup grob splitStaffBarLineMarkup) 0)) \break } \paper { ragged-right = ##t short-indent = 5\mm } \score { << \new ChoirStaff << \new Staff \with { instrumentName = #"High I + II" } { << \repeat unfold 4 f''1 \\ \repeat unfold 4 d''1 >> \splitStaffBarLine } \new Staff \with { instrumentName = #"Low" } { << \repeat unfold 4 b'1 \\ \repeat unfold 4 g'1 >> } \new Staff \with { shortInstrumentName = #"H I" } { R1*4 \repeat unfold 2 { r4 f''2 r4 } \repeat unfold 2 e''1 } \new Staff \with { shortInstrumentName = #"H II" } { R1*4 \repeat unfold 4 b'2 \repeat unfold 2 c''1 } \new Staff \with { shortInstrumentName = #"L" } { R1*4 << \repeat unfold 4 g'1 \\ \repeat unfold 4 c'1 >> } >> >> \layout { \context { \Staff \RemoveEmptyStaves \override VerticalAxisGroup.remove-first = ##t } } }
Adding orchestral cues to a vocal score
This shows one approach to simplify adding many orchestral cues to the
piano reduction in a vocal score. The music function \cueWhile
takes four arguments: the music from which the cue is to be taken, as
defined by \addQuote
, the name to be inserted before the cue
notes, then either #UP
or #DOWN
to specify either
\voiceOne
with the name above the staff or \voiceTwo
with the name below the staff, and finally the piano music in parallel
with which the cue notes are to appear. The name of the cued
instrument is positioned to the left of the cued notes. Many passages
can be cued, but they cannot overlap each other in time.
cueWhile = #(define-music-function (parser location instrument name dir music) (string? string? ly:dir? ly:music?) #{ \cueDuring $instrument #dir { \once \override TextScript.self-alignment-X = #RIGHT \once \override TextScript.direction = $dir <>-\markup { \tiny #name } $music } #}) flute = \relative c'' { \transposition c' s4 s4 e g } \addQuote "flute" { \flute } clarinet = \relative c' { \transposition bes fis4 d d c } \addQuote "clarinet" { \clarinet } singer = \relative c'' { c4. g8 g4 bes4 } words = \lyricmode { here's the lyr -- ics } pianoRH = \relative c'' { \transposition c' \cueWhile "clarinet" "Clar." #DOWN { c4. g8 } \cueWhile "flute" "Flute" #UP { g4 bes4 } } pianoLH = \relative c { c4 <c' e> e, <g c> } \score { << \new Staff { \new Voice = "singer" { \singer } } \new Lyrics { \lyricsto "singer" \words } \new PianoStaff << \new Staff { \new Voice { \pianoRH } } \new Staff { \clef "bass" \pianoLH } >> >> }
Adding timing marks to long glissandi
Skipped beats in very long glissandi are sometimes indicated by timing marks, often consisting of stems without noteheads. Such stems can also be used to carry intermediate expression markings.
If the stems do not align well with the glissando, they may need to be repositioned slightly.
glissandoSkipOn = { \override NoteColumn.glissando-skip = ##t \hide NoteHead \override NoteHead.no-ledgers = ##t } glissandoSkipOff = { \revert NoteColumn.glissando-skip \undo \hide NoteHead \revert NoteHead.no-ledgers } \relative c'' { r8 f8\glissando \glissandoSkipOn f4 g a a8\noBeam \glissandoSkipOff a8 r8 f8\glissando \glissandoSkipOn g4 a8 \glissandoSkipOff a8 | r4 f\glissando \< \glissandoSkipOn a4\f \> \glissandoSkipOff b8\! r | }
Alternative bar numbering
Two alternative methods for bar numbering can be set, especially for when using repeated music.
\relative c'{ \set Score.alternativeNumberingStyle = #'numbers \repeat volta 3 { c4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 \break \set Score.alternativeNumberingStyle = #'numbers-with-letters \repeat volta 3 { c,4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 }
Centered measure numbers
Scores of large ensemble works often have bar numbers placed beneath the
system, centered horizontally on the measure’s extent. This snippet shows
how the Measure_counter_engraver
may be used to simulate this
notational practice. Here, the engraver has been added to a Dynamics
context.
\layout { \context { \Dynamics \consists #Measure_counter_engraver \override MeasureCounter.direction = #DOWN \override MeasureCounter.font-encoding = #'latin1 \override MeasureCounter.font-shape = #'italic % to control the distance of the Dynamics context from the staff: \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding = #2 } \context { \Score \remove "Bar_number_engraver" } } pattern = \repeat unfold 7 { c'4 d' e' f' } \new StaffGroup << \new Staff { \pattern } \new Staff { \pattern } \new Dynamics { \startMeasureCount s1*7 \stopMeasureCount } >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Centered measure numbers ] | [ Up : Staff notation ] | [ Staff notation: Changing the staff size > ] |
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 } >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Changing the staff size ] | [ Up : Staff notation ] | [ Staff notation: Creating double-digit fingerings > ] |
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 }
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Creating blank staves ] | [ Up : Staff notation ] | [ Staff notation: Cross staff stems > ] |
Creating double-digit fingerings
Creating fingerings larger than 5 is possible.
\relative c' { c1-10 c1-50 c1-36 c1-29 }
Cross staff stems
This snippet shows the use of the Span_stem_engraver
and \crossStaff
to connect stems across staves automatically.
The stem length need not be specified, as the variable distance
between noteheads and staves is calculated automatically.
\layout { \context { \PianoStaff \consists #Span_stem_engraver } } { \new PianoStaff << \new Staff { <b d'>4 r d'16\> e'8. g8 r\! e'8 f' g'4 e'2 } \new Staff { \clef bass \voiceOne \autoBeamOff \crossStaff { <e g>4 e, g16 a8. c8} d \autoBeamOn g8 f g4 c2 } >> }
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Cross staff stems ] | [ Up : Staff notation ] | [ Staff notation: Extending glissandi across repeats > ] |
Display bracket with only one staff in a system
If there is only one staff in one of the staff types ChoirStaff
or StaffGroup
, by default the bracket and the starting bar line
will not be displayed. This can be changed by overriding
collapse-height
to set its value to be less than the number of
staff lines in the staff.
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.
\score { \new StaffGroup << % Must be lower than the actual number of staff lines \override StaffGroup.SystemStartBracket.collapse-height = #4 \override Score.SystemStartBar.collapse-height = #4 \new Staff { c'1 } >> } \score { \new PianoStaff << \override PianoStaff.SystemStartBrace.collapse-height = #4 \override Score.SystemStartBar.collapse-height = #4 \new Staff { c'1 } >> }
Extending glissandi across repeats
A glissando which extends into several \alternative
blocks
can be simulated by adding a hidden grace note with a glissando
at the start of each \alternative
block. The grace note
should be at the same pitch as the note which starts the initial
glissando. This is implemented here with a music function which
takes the pitch of the grace note as its argument.
Note that in polyphonic music the grace note must be matched with corresponding grace notes in all other voices.
repeatGliss = #(define-music-function (parser location grace) (ly:pitch?) #{ % the next two lines ensure the glissando is long enough % to be visible \once \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods \once \override Glissando.minimum-length = #3.5 \once \hideNotes \grace $grace \glissando #}) \score { \relative c'' { \repeat volta 3 { c4 d e f\glissando } \alternative { { g2 d } { \repeatGliss f g2 e } { \repeatGliss f e2 d } } } } music = \relative c' { \voiceOne \repeat volta 2 { g a b c\glissando } \alternative { { d1 } { \repeatGliss c e1 } } } \score { \new StaffGroup << \new Staff << \context Voice { \clef "G_8" \music } >> \new TabStaff << \context TabVoice { \clef "moderntab" \music } >> >> }
Forcing measure width to adapt to MetronomeMark’s width
By default, metronome marks do not influence horizontal spacing. This has one downside: when using compressed rests, some metronome marks may be too close and therefore are printed vertically stacked, as demonstrated in the first part of this example. This can be solved through a simple override, as shown in the second half of the example.
example = { \tempo "Allegro" R1*6 \tempo "Rall." R1*2 \tempo "A tempo" R1*8 } { \compressFullBarRests \example R1 R1 \override Score.MetronomeMark.extra-spacing-width = #'(0 . 0) \example }
Glissandi can skip grobs
NoteColumn
grobs can be skipped over by glissandi.
\relative c' { a2 \glissando \once \override NoteColumn.glissando-skip = ##t f''4 d, }
How to print two rehearsal marks above and below the same barline (method 1)
This method prints two ’rehearsal marks’, one on top of the other. It shifts the lower rehearsal mark below the staff and then adds padding above it in order to place the upper rehearsal mark above the staff.
By adjusting the extra-offset and baseline-skip values you can increase or decrease the overall space between the rehearsal mark and the staff.
Because nearly every type of glyph or string can be made to behave like a rehearsal mark it is possible to centre those above and below a bar line.
Adding the appropriate ’break visibility’ as shown in snippet 1 will allow you to position two marks at the end of a line as well.
Note: Method 1 is less complex than Method 2 but does not really allow
for fine tuning of placement of one of the rehearsal marks without
affecting the other. It may also give some problems with vertical
spacing, since using extra-offset
does not change the bounding
box of the mark from its original value.
\relative c'{ c d e f | \once \override Score.RehearsalMark.extra-offset = #'(0 . -8.5) \once \override Score.RehearsalMark.baseline-skip = #9 \mark \markup \center-column { \circle 1 \box A } g f e d | \once \override Score.RehearsalMark.extra-offset = #'(0 . -8.5) \once \override Score.RehearsalMark.baseline-skip = #9 \mark \markup \center-column { \flat { \bold \small \italic Fine. } } g f e d | \once \override Score.RehearsalMark.extra-offset = #'(0 . -8.5) \once \override Score.RehearsalMark.baseline-skip = #9 \override Score.RehearsalMark.break-visibility = #begin-of-line-invisible \mark \markup \center-column { \fermata \box z } }
How to print two rehearsal marks above and below the same barline (method 2)
This method prints two ’rehearsal marks’ - one above the stave and one below, by creating two voices, adding the Rehearsal Mark engraver to each voice - without this no rehearsal mark is printed - and then placing each rehearsal mark UP and DOWN in each voice respectively.
This method (as opposed to method 1) is more complex, but allows for more flexibility, should it be needed to tweak each rehearsal mark independently of the other.
\score { \relative c' << \new Staff { << \new Voice \with { \consists Mark_engraver \consists "Staff_collecting_engraver" } { c4 d e f \mark \markup { \box A } c4 d e f } \new Voice \with { \consists Mark_engraver \consists "Staff_collecting_engraver" \override RehearsalMark.direction = #DOWN } { s4 s s s \mark \markup { \circle 1 } s4 s s s } >> } >> \layout { \context { \Score \remove "Mark_engraver" \remove "Staff_collecting_engraver" } } }
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 = ##f \once \override Staff.InstrumentName.padding = #0.3 \once \override Staff.InstrumentName.stencil = #(lambda (grob) (let* ((instrument-name (ly:grob-property grob 'long-text))) (set! (ly:grob-property grob 'long-text) #{ \markup \score { { \context MensuralStaff \with { instrumentName = #instrument-name } $incipit-music } \layout { $(ly:grob-layout grob) line-width = \indent indent = % primitive-eval is probably easiest for % escaping lexical closure and evaluating % everything respective to (current-module). #(primitive-eval '(or (false-if-exception (- indent incipit-width)) (* 0.5 indent))) ragged-right = ##f ragged-last = ##f system-count = #1 } } #}) (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 \hide NoteHead 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 \hide NoteHead 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' { \clef "treble_8" R1 | R1 | R1 | % two measures r2 d'2. d'4 b e' | \once \hide NoteHead 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 \hide NoteHead 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 \hide BarLine } %% 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 \hide Slur %% 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 } }
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Incipit ] | [ Up : Staff notation ] | [ Staff notation: Letter tablature formatting > ] |
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 indent = 0\cm } } } \header { title = "Solo Cello Suites" subtitle = "Suite IV" subsubtitle = \markup { Originalstimmung: \raise #0.5 \tuning } } \layout { ragged-right = ##f } \relative c'' { \time 4/8 \tuplet 3/2 { c8 d e } \tuplet 3/2 { c d e } \tuplet 3/2 { c8 d e } \tuplet 3/2 { c d e } g8 a g a g8 a g a }
Letter tablature formatting
Tablature can be formatted using letters instead of numbers.
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 = #fret-letter-tablature-format } { \music } >>
Making glissandi breakable
Setting the breakable
property to #t
in combination with
after-line-breaking
allows a glissando to break if it occurs
at a line break:
glissandoSkipOn = { \override NoteColumn.glissando-skip = ##t \hide NoteHead \override NoteHead.no-ledgers = ##t } \relative c'' { \override Glissando.breakable = ##t \override Glissando.after-line-breaking = ##t f1\glissando | \break a4 r2. | f1\glissando \once \glissandoSkipOn \break a2 a4 r4 | }
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Making glissandi breakable ] | [ Up : Staff notation ] | [ Staff notation: Measure counter > ] |
Making some staff lines thicker than the others
For educational 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 \hide PercentRepeat \override PercentRepeatCounter.staff-padding = #1 \repeat percent 4 { s1 } } >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Measure counter ] | [ Up : Staff notation ] | [ Staff notation: Nesting staves > ] |
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 = { \hide Staff.BarLine s1 s % the final bar line is not interrupted \undo \hide Staff.BarLine \bar "|." } \new StaffGroup \relative c'' { << \new Staff { << \global { c1 c } >> } \new Staff { << \global { c c } >> } >> }
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 } >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Nesting staves ] | [ Up : Staff notation ] | [ Staff notation: Numbering groups of measures > ] |
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 . 6) . ,FLAT) ((0 . 5) . ,FLAT) ((0 . 3) . ,SHARP)) c4 d e fis aes4 bes c2 }
Numbering groups of measures
This snippet demonstrates the use of the Measure_counter_engraver
to
number groups of successive measures. Any stretch of measures may be numbered,
whether consisting of repetitions or not.
The engraver must be added to the appropriate context. Here, a Staff
context is used; another possibility is a Dynamics
context.
The counter is begun with \startMeasureCount
and ended with
\stopMeasureCount
. Numbering will start by default with 1
, but
this behavior may be modified by overriding the count-from
property.
When a measure extends across a line break, the number will appear twice, the second time in parentheses.
\layout { \context { \Staff \consists #Measure_counter_engraver } } \new Staff { \startMeasureCount \repeat unfold 7 { c'4 d' e' f' } \stopMeasureCount \bar "||" g'4 f' e' d' \override Staff.MeasureCounter.count-from = #2 \startMeasureCount \repeat unfold 5 { g'4 f' e' d' } g'4 f' \bar "" \break e'4 d' \repeat unfold 7 { g'4 f' e' d' } \stopMeasureCount }
Orchestra choir and piano template
This template demonstrates the use of nested StaffGroup
and
GrandStaff
contexts to sub-group instruments of the same type
together, and a way to use \transpose
so that variables hold
music for transposing instruments at concert pitch.
#(set-global-staff-size 17) \paper { indent = 3.0\cm % space for instrumentName short-indent = 1.5\cm % space for shortInstrumentName } fluteMusic = \relative c' { \key g \major g'1 b } % Pitches as written on a manuscript for Clarinet in A % are transposed to concert pitch. clarinetMusic = \transpose c' a \relative c'' { \key bes \major bes1 d } trumpetMusic = \relative c { \key g \major g''1 b } % Key signature is often omitted for horns hornMusic = \transpose c' f \relative c { d'1 fis } percussionMusic = \relative c { \key g \major g1 b } sopranoMusic = \relative c'' { \key g \major g'1 b } sopranoLyrics = \lyricmode { Lyr -- ics } altoIMusic = \relative c' { \key g \major g'1 b } altoIIMusic = \relative c' { \key g \major g'1 b } altoILyrics = \sopranoLyrics altoIILyrics = \lyricmode { Ah -- ah } tenorMusic = \relative c' { \clef "treble_8" \key g \major g1 b } tenorLyrics = \sopranoLyrics pianoRHMusic = \relative c { \key g \major g''1 b } pianoLHMusic = \relative c { \clef bass \key g \major g1 b } violinIMusic = \relative c' { \key g \major g'1 b } violinIIMusic = \relative c' { \key g \major g'1 b } violaMusic = \relative c { \clef alto \key g \major g'1 b } celloMusic = \relative c { \clef bass \key g \major g1 b } bassMusic = \relative c { \clef "bass_8" \key g \major g,1 b } \score { << \new StaffGroup = "StaffGroup_woodwinds" << \new Staff = "Staff_flute" { \set Staff.instrumentName = #"Flute" % shortInstrumentName, midiInstrument, etc. % may be set here as well \fluteMusic } \new Staff = "Staff_clarinet" { \set Staff.instrumentName = \markup { \concat { "Clarinet in B" \flat } } % Declare that written Middle C in the music % to follow sounds a concert B flat, for % output using sounded pitches such as MIDI. \transposition bes % Print music for a B-flat clarinet \transpose bes c' \clarinetMusic } >> \new StaffGroup = "StaffGroup_brass" << \new Staff = "Staff_hornI" { \set Staff.instrumentName = #"Horn in F" \transposition f \transpose f c' \hornMusic } \new Staff = "Staff_trumpet" { \set Staff.instrumentName = #"Trumpet in C" \trumpetMusic } >> \new RhythmicStaff = "RhythmicStaff_percussion" << \set RhythmicStaff.instrumentName = #"Percussion" \percussionMusic >> \new PianoStaff << \set PianoStaff.instrumentName = #"Piano" \new Staff { \pianoRHMusic } \new Staff { \pianoLHMusic } >> \new ChoirStaff = "ChoirStaff_choir" << \new Staff = "Staff_soprano" { \set Staff.instrumentName = #"Soprano" \new Voice = "soprano" \sopranoMusic } \new Lyrics \lyricsto "soprano" { \sopranoLyrics } \new GrandStaff = "GrandStaff_altos" \with { \accepts Lyrics } << \new Staff = "Staff_altoI" { \set Staff.instrumentName = #"Alto I" \new Voice = "altoI" \altoIMusic } \new Lyrics \lyricsto "altoI" { \altoILyrics } \new Staff = "Staff_altoII" { \set Staff.instrumentName = #"Alto II" \new Voice = "altoII" \altoIIMusic } \new Lyrics \lyricsto "altoII" { \altoIILyrics } >> \new Staff = "Staff_tenor" { \set Staff.instrumentName = #"Tenor" \new Voice = "tenor" \tenorMusic } \new Lyrics \lyricsto "tenor" { \tenorLyrics } >> \new StaffGroup = "StaffGroup_strings" << \new GrandStaff = "GrandStaff_violins" << \new Staff = "Staff_violinI" { \set Staff.instrumentName = #"Violin I" \violinIMusic } \new Staff = "Staff_violinII" { \set Staff.instrumentName = #"Violin II" \violinIIMusic } >> \new Staff = "Staff_viola" { \set Staff.instrumentName = #"Viola" \violaMusic } \new Staff = "Staff_cello" { \set Staff.instrumentName = #"Cello" \celloMusic } \new Staff = "Staff_bass" { \set Staff.instrumentName = #"Double Bass" \bassMusic } >> >> \layout { } }
Putting lyrics inside the staff
Lyrics can be moved vertically to place them inside the staff. The
lyrics are moved with \override LyricText.extra-offset = #'(0
. dy)
and there are similar commands to move the extenders and
hyphens. The offset needed is established with trial and error.
<< \new Staff << \new Voice = "voc" \relative c' { \stemDown a bes c8 b c4 } >> \new Lyrics \with { \override LyricText.extra-offset = #'(0 . 8.6) \override LyricExtender.extra-offset = #'(0 . 8.6) \override LyricHyphen.extra-offset = #'(0 . 8.6) } \lyricsto "voc" { La la -- la __ _ la } >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Putting lyrics inside the staff ] | [ Up : Staff notation ] | [ Staff notation: Quoting another voice > ] |
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, the quoted pitches will stay
unchanged.
\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
which should be quoted. The default value is (note-event
rest-event tie-event beam-event tuplet-span-event)
, which means that
only the notes, rests, ties, beams and tuplets of the quoted voice will
appear in the \quoteDuring
expression. In the following
example, a 16th rest is not quoted since rest-event
is not in
quotedEventTypes
.
For a list of event types, consult the “Music classes” section of the Internals Reference.
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. } } >> >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Quoting another voice ] | [ Up : Staff notation ] | [ Staff notation: Setting system separators > ] |
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 { \Staff \RemoveEmptyStaves % 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 } >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Removing the first empty line ] | [ Up : Staff notation ] | [ Staff notation: Tick bar lines > ] |
Setting system separators
System separators can be inserted between systems. Any markup can be
used, but \slashSeparator
has been provided as a sensible
default.
\paper { system-separator-markup = \slashSeparator } notes = \relative c' { c1 | c \break c1 | c \break c1 | c } \book { \score { \new GrandStaff << \new Staff \notes \new Staff \notes >> } }
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 "|." }
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Tick bar lines ] | [ Up : Staff notation ] | [ Staff notation: Time signature in parentheses > ] |
Time signature in parentheses - method 3
Another way to put the time signature in parenthesis
\relative c'' { \override Staff.TimeSignature.stencil = #(lambda (grob) (parenthesize-stencil (ly:time-signature::print grob) 0.1 0.4 0.4 0.1 )) \time 2/4 a4 b8 c }
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
clefTransposition
. 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. In order to get key signatures on the correct staff lines,
middleCClefPosition
must also be set. The positional parameters
are relative to the staff center line, positive numbers displacing
upwards, counting one for each line and space. The
clefTransposition
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 \key f \major c'1 % The standard bass clef \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 \set Staff.middleCPosition = #6 \set Staff.middleCClefPosition = #6 \key g \major c'1 % The baritone clef \set Staff.clefGlyph = #"clefs.C" \set Staff.clefPosition = #4 \set Staff.middleCPosition = #4 \set Staff.middleCClefPosition = #4 \key f \major c'1 % The standard choral tenor clef \set Staff.clefGlyph = #"clefs.G" \set Staff.clefPosition = #-2 \set Staff.clefTransposition = #-7 \set Staff.middleCPosition = #1 \set Staff.middleCClefPosition = #1 \key f \major c'1 % A non-standard clef \set Staff.clefPosition = #0 \set Staff.clefTransposition = #0 \set Staff.middleCPosition = #-4 \set Staff.middleCClefPosition = #-4 \key g \major c'1 \break % The following clef changes do not preserve % the normal relationship between notes, key signatures % 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.clefTransposition = #7 c'1 \set Staff.clefTransposition = #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 ChoirStaff
context.
\score { \new StaffGroup { << \set StaffGroup.systemStartDelimiter = #'SystemStartSquare \new Staff { c'4 d' e' f' } \new Staff { c'4 d' e' f' } >> } }
Using autochange with more than one voice
Using autochange
with more than one voice.
\score { \new PianoStaff << \new Staff = "up" { << \set Timing.beamExceptions = #'() \set Timing.beatStructure = #'(4) \new Voice { \voiceOne \autochange \relative c' { g8 a b c d e f g g,8 a b c d e f g } } \new Voice { \voiceTwo \autochange \relative c' { g8 a b c d e f g g,,8 a b c d e f g } } >> } \new Staff = "down" { \clef bass } >> }
Vertical aligned StaffGroups without connecting SystemStartBar
This snippet shows how to achieve vertically aligned StaffGroups with a SystemStartBar for each StaffGroup, but without connecting them.
% by Thomas Morley #(set-global-staff-size 18) \paper { indent = 0 ragged-right = ##f print-all-headers = ##t } \layout { \context { \Staff \consists "Mark_engraver" \override RehearsalMark.self-alignment-X = #LEFT } \context { \StaffGroup systemStartDelimiterHierarchy = #'(SystemStartBrace (SystemStartBracket a b)) } \context { \Score \override SystemStartBrace.style = #'bar-line \omit SystemStartBar \override SystemStartBrace.padding = #-0.1 \override SystemStartBrace.thickness = #1.6 \remove "Mark_engraver" \override StaffGrouper.staffgroup-staff-spacing.basic-distance = #15 } } %%%% EXAMPLE txt = \lyricmode { Wer4 nur den lie -- ben Gott läßt wal2 -- ten4 und4 hof -- fet auf ihn al -- le Zeit2. } % First StaffGroup "exercise" eI = \relative c' { \mark \markup { \bold Teacher: This is a simple setting of the choral. Please improve it. } \key a \minor \time 4/4 \voiceOne \partial 4 e4 a b c b a b gis2 e4\fermata g! g f e a a gis a2.\fermata \bar ":|." } eII = \relative c' { \key a \minor \time 4/4 \voiceTwo \partial 4 c4 e e e gis a f e2 b4 b d d c c d d c2. \bar ":|." } eIII = \relative c' { \key a \minor \time 4/4 \clef bass \voiceOne \partial 4 a4 c b a b c d b2 gis4 g g b c a f e e2. } eIV = \relative c' { \key a \minor \time 4/4 \clef bass \voiceTwo \partial 4 a,4 a' gis a e a, d e2 e,4\fermata e' b g c f d e a,2.\fermata \bar ":|." } exercise = \new StaffGroup = "exercise" << \new Staff << \new Voice \eI \new Voice \eII >> \new Lyrics \txt \new Staff << \new Voice \eIII \new Voice \eIV >> >> % Second StaffGRoup "simple Bach" sbI = \relative c' { \mark \markup { \bold" Pupil:" Here's my version! } \key a \minor \time 4/4 \voiceOne \partial 4 e4 a b c b a b gis2 e4\fermata g! g f e a a gis a2.\fermata \bar ":|." } sbII = \relative c' { \key a \minor \time 4/4 \voiceTwo \partial 4 c8 d e4 e e8 f g4 f f e2 b4 b8 c d4 d e8 d c4 b8 c d4 c2. \bar ":|." } sbIII = \relative c' { \key a \minor \time 4/4 \clef bass \voiceOne \partial 4 a8 b c4 b a b8 c d4 d8 c b2 gis4 g g8 a b4 b a8 g f4 e e2. } sbIV = \relative c' { \key a \minor \time 4/4 \clef bass \voiceTwo \partial 4 a,4 a' gis a e f8 e d4 e2 e,4\fermata e' b a8 g c4 f8 e d4 e a,2.\fermata \bar ":|." } simpleBach = \new StaffGroup = "simple Bach" << \new Staff << \new Voice \sbI \new Voice \sbII >> \new Lyrics \txt \new Staff << \new Voice \sbIII \new Voice \sbIV >> >> % Third StaffGroup "chromatic Bach" cbI = \relative c' { \mark \markup { \bold "Teacher:" \column { "Well, you simply copied and transposed a version of J.S.Bach." "Do you know this one?" } } \key a \minor \time 4/4 \voiceOne \partial 4 e4 a b c b a b gis4. fis8 e4\fermata g! g f e a a8 b gis4 a2.\fermata \bar ":|." } cbII = \relative c' { \key a \minor \time 4/4 \voiceTwo \partial 4 c8 d e4 e e8 fis gis4 a8 g! f!4 e2 b4 e e d d8[ cis] d dis e fis e4 e2. \bar ":|." } cbIII = \relative c' { \key a \minor \time 4/4 \clef bass \voiceOne \partial 4 a8 b c[ b] a gis8 a4 d, e8[ e'] d c b4. a8 gis4 b c d8 c b[ a] a b c b b c16 d c2. } cbIV = \relative c' { \key a \minor \time 4/4 \clef bass \voiceTwo \partial 4 a4 c, e a, b c d e2 e4\fermata e a b8 c gis[ g] fis f e dis e4 a,2.\fermata \bar ":|." } chromaticBach = \new StaffGroup = "chromatic Bach" << \new Staff << \new Voice \cbI \new Voice \cbII >> \new Lyrics \txt \new Staff << \new Voice \cbIII \new Voice \cbIV >> >> % Score \score { << \exercise \simpleBach \chromaticBach >> \header { title = \markup \column { \combine \null \vspace #1 "Exercise: Improve the given choral" " " } } \layout { \context { \Lyrics \override LyricText.X-offset = #-1 } } }
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" } } }
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Volta below chords ] | [ Up : Staff notation ] | [ Editorial annotations > ] |
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 e1 } } << \new StaffGroup << \new Staff \voltaMusic \new Staff \voltaMusic >> \new StaffGroup << \new Staff \with { \consists "Volta_engraver" } \voltaMusic \new Staff \voltaMusic >> >>
[ << Staff notation ] | [Top][Contents][Index][ ? ] | [ Editorial annotations >> ] | ||
[ < Staff notation: Volta below chords ] | [ Up : Staff notation ] | [ Editorial annotations > ] |