Next: Quoting other voices, Previous: Metronome marks, Up: Writing parts
Instrument names can be printed on the left side of staves in the
Staff and PianoStaff contexts. The value of
instrumentName is used for the first staff, and the value
of shortInstrumentName is used for all succeeding staves.
\set Staff.instrumentName = #"Violin "
\set Staff.shortInstrumentName = #"Vln "
c4.. g'16 c4.. g'16
\break
c1
Markup mode can be used to create more complicated instrument names:
\set Staff.instrumentName = \markup {
\column { "Clarinetti"
\line { "in B" \smaller \flat } } }
c4 c,16 d e f g2
When two or more staff contexts are grouped together, the
instrument names and short instrument names are centered by
default. To center multi-line instrument names,
\center-column must be used:
<<
\new Staff {
\set Staff.instrumentName = #"Flute"
f2 g4 f
}
\new Staff {
\set Staff.instrumentName = \markup \center-column {
Clarinet
\line { "in B" \smaller \flat }
}
c4 b c2
}
>>
However, if the instrument names are longer, the instrument names
in a staff group may not be centered unless the indent and
short-indent settings are increased. For details about
these settings, see Horizontal dimensions.
\layout {
indent = 3.0\cm
short-indent = 1.5\cm
}
\relative c'' <<
\new Staff {
\set Staff.instrumentName = #"Alto Flute in G"
\set Staff.shortInstrumentName = #"Fl."
f2 g4 f \break
g4 f g2
}
\new Staff {
\set Staff.instrumentName = #"Clarinet"
\set Staff.shortInstrumentName = #"Clar."
c,4 b c2 \break
c2 b4 c
}
>>
To add instrument names to other contexts (such as
GrandStaff, ChoirStaff, or StaffGroup),
Instrument_name_engraver must be added to that context.
For details, see Modifying context plug-ins.
Instrument names may be changed in the middle of a piece:
\set Staff.instrumentName = #"First"
\set Staff.shortInstrumentName = #"one"
c1 c c c \break
c1 c c c \break
\set Staff.instrumentName = #"Second"
\set Staff.shortInstrumentName = #"two"
c1 c c c \break
c1 c c c \break
If an instrument switch is needed,
\addInstrumentDefinition may be used in combination with
\instrumentSwitch to create a detailed list of the
necessary changes for the switch. The
\addInstrumentDefinition command has two arguments: an
identifying string, and an association list of context properties
and values to be used for the instrument. It must be placed in
the toplevel scope. \instrumentSwitch is used in the music
expression to declare the instrument switch:
\addInstrumentDefinition #"contrabassoon"
#`((instrumentTransposition . ,(ly:make-pitch -1 0 0))
(shortInstrumentName . "Cbsn.")
(clefGlyph . "clefs.F")
(middleCPosition . 6)
(clefPosition . 2)
(instrumentCueName . ,(make-bold-markup "cbsn."))
(midiInstrument . "bassoon"))
\new Staff \with {
instrumentName = #"Bassoon"
}
\relative c' {
\clef tenor
\compressFullBarRests
c2 g'
R1*16
\instrumentSwitch "contrabassoon"
c,,2 g \break
c,1 ~ | c1
}
Notation Reference: Horizontal dimensions, Modifying context plug-ins.
Snippets: Staff notation.
Internals Reference: InstrumentName, PianoStaff, Staff.