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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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:

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.

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.

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.

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.

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.

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.