| [ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
| [ < Hiding staves ] | [ Up : Staff notation ] | [ Instrument names > ] | ||
1.6.3 Writing parts
This section explains how to insert tempo indications and instrument names into a score. Methods to quote other voices and format cue notes are also described.
| Instrument names | ||
| Quoting other voices | ||
| Formatting cue notes |
| [ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
| [ < Writing parts ] | [ Up : Writing parts ] | [ Quoting other voices > ] | ||
Instrument names
Instrument names can be printed on the left side of staves in the
Staff, PianoStaff, StaffGroup, GrandStaff
and ChoirStaff 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 \paper variables for shifts and indents.
\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
ChordNames or FiguredBass),
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.
However, remember that instrumentName will not be
displayed in the middle of the piece, as it only appears
on the first staff:
\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
}
See also
Notation Reference:
\paper variables for shifts and indents,
Modifying context plug-ins.
Snippets: Staff notation.
Internals Reference: InstrumentName, PianoStaff, Staff.
| [ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
| [ < Instrument names ] | [ Up : Writing parts ] | [ Formatting cue notes > ] | ||
Quoting other voices
It is very common for one voice to double some of the music from another voice. For example, the first and second violins may play the same notes during a passage of music. In LilyPond this is accomplished by letting one voice quote the other voice without having to re-enter it.
Before a part can be quoted, the \addQuote command must be used
to initialize the quoted fragment. This command must be used in the
toplevel scope. The first argument is an identifying string, and the
second is a music expression:
flute = \relative c'' {
a4 gis g gis
}
\addQuote "flute" { \flute }
The \quoteDuring command is used to indicate the point where the
quotation begins. It is followed by two arguments: the name of the
quoted voice, as defined with \addQuote, and a music expression
that indicates the duration of the quote, usually spacer rests or
multi-measure rests. The corresponding music (including all articulations,
dynamics, markup, etc.) from the quoted voice is inserted into the music
expression:
flute = \relative c'' {
a4 gis g->\f gis^\markup{quoted}
}
\addQuote "flute" { \flute }
\relative c' {
c4 cis \quoteDuring #"flute" { s2 }
}
If the music expression used for \quoteDuring contains
anything but a spacer rest or multi-measure rest, a polyphonic
situation is created, which is often not desirable:
flute = \relative c'' {
a4 gis g gis
}
\addQuote "flute" { \flute }
\relative c' {
c4 cis \quoteDuring #"flute" { c4 b }
}
Quotations recognize instrument transposition settings for both
the source and target instruments if the \transposition
command is used. For details about \transposition, see
Instrument transpositions.
clarinet = \relative c'' {
\transposition bes
a4 gis g gis
}
\addQuote "clarinet" { \clarinet }
\relative c' {
c4 cis \quoteDuring #"clarinet" { s2 }
}
It is possible to tag quotations with unique names in order to process them in different ways. For details about this procedure, see Using tags.
It is also possible to adjust which objects from the original voice are quoted
by changing the quotedEventTypes property. By default, its value is
#'(StreamEvent), which means that everything is quoted. Setting it
to e.g. #'(note-event rest-event tie-event) causes lilypond to quote
only notes, rests and ties, but no articulations, markup or dynamics.
clarinet = \relative c'' {
a4 gis g->\f gis^\markup{quoted}
}
\addQuote "clarinet" { \clarinet }
\relative c' {
\set Score.quotedEventTypes = #'(note-event rest-event tie-event)
c4 cis \quoteDuring #"clarinet" { s2 }
}
Selected Snippets
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
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. }
}
>>
>>
See also
Notation Reference: Instrument transpositions, Using tags.
Snippets: Staff notation.
Internals Reference: QuoteMusic, Voice.
Known issues and warnings
Only the contents of the first Voice occurring in an
\addQuote command will be considered for quotation, so
music cannot contain \new and
\context Voice statements that would switch to a different
Voice.
Quoting grace notes is broken and can even cause LilyPond to crash.
Quoting nested triplets may result in poor notation.
In earlier versions of LilyPond (pre 2.11), addQuote was
written entirely in lower-case letters: \addquote.
| [ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
| [ < Quoting other voices ] | [ Up : Writing parts ] | [ Editorial annotations > ] | ||
Formatting cue notes
The previous section explains how to create quotations. The
\cueDuring command is a more specialized form of
\quoteDuring, being particularly useful for inserting cue
notes into a part. The syntax is as follows:
\cueDuring #partname #voice music
This command copies only the notes and rests from the
corresponding measures from partname into a
CueVoice context. The CueVoice is created
implicitly, and occurs simultaneously with music,
which creates a polyphonic situation. The voice
argument determines whether the cue notes should be notated as a
first or second voice; UP corresponds to the first voice,
and DOWN corresponds to the second.
oboe = \relative c'' {
r2 r8 d16(\f f e g f a)
g8 g16 g g2.
}
\addQuote "oboe" { \oboe }
\new Voice \relative c'' {
\cueDuring #"oboe" #UP { R1 }
g2 c,
}
In the above example, the Voice context had to be
explicitly declared, or else the entire music expression would
belong to the CueVoice context.
It is possible to adjust which aspects of the music are quoted with
\cueDuring by setting the quotedCueEventTypes
property. Its default value is #'(note-event rest-event
tie-event beam-event tuplet-span-event), which means that only
notes, rests, ties, beams and tuplets are quoted, but not
articulations, dynamic marks, markup etc.
oboe = \relative c'' {
r2 r8 d16(\f f e g f a)
g8 g16 g g2.
}
\addQuote "oboe" { \oboe }
\new Voice \relative c'' {
\set Score.quotedCueEventTypes = #'(note-event rest-event tie-event
beam-event tuplet-span-event
dynamic-event slur-event)
\cueDuring #"oboe" #UP { R1 }
g2 c,
}
Markup can be used to show the name of the quoted instrument. Also, if the cue notes require a change in clef, the original clef should be restored at the end of the cue notes.
flute = \relative c'' {
r2. c4 d8 c d e fis2 g2 d2
}
bassoon = \relative c {
\clef bass
R1
\clef treble
s1*0^\markup { \tiny "flute" }
\cueDuring #"flute" #UP { R1 }
\clef bass
g4. b8 d2
}
\addQuote "flute" { \flute }
\new Staff {
\bassoon
}
The \killCues command removes cue notes from a music
expression, so the same music expression can be used to produce
the instrument part with cues and the score. The \killCues
command removes only the notes and events that were quoted by
\cueDuring. Other markup associated with cues, such as clef
changes and a label identifying the source instrument, can be
tagged for selective inclusion in the score; see Using tags.
flute = \relative c'' {
r2. c4 d8 c d e fis2 g2 d2
}
bassoon = \relative c {
\clef bass
R1
\tag #'part {
\clef treble
s1*0^\markup { \tiny "flute" }
}
\cueDuring #"flute" #UP { R1 }
\tag #'part \clef bass
g4. b8 d2
}
\addQuote "flute" { \flute }
\new Staff {
\bassoon
}
\new StaffGroup <<
\new Staff {
\flute
}
\new Staff {
\removeWithTag #'part { \killCues { \bassoon } }
}
>>
Alternatively, Clef changes and instrument labels can be
collected into an instrument definition for repeated use, using
\addInstrumentDefinition described in
Instrument names.
Like \quoteDuring, \cueDuring takes instrument
transpositions into account. Cue notes are produced at the
pitches that would be written for the instrument receiving the cue
to produce the sounding pitches of the source instrument.
To transpose cue notes differently, use
\transposedCueDuring. This command takes an extra argument
to specify (in absolute mode) the printed pitch that you want to
represent the sound of a concert middle C. This is useful for
taking cues from an instrument in a completely different register.
piccolo = \relative c''' {
\clef "treble^8"
R1
c8 c c e g2
c4 g g2
}
bassClarinet = \relative c' {
\key d \major
\transposition bes,
d4 r a r
\transposedCueDuring #"piccolo" #UP d { R1 }
d4 r a r
}
\addQuote "piccolo" { \piccolo }
<<
\new Staff \piccolo
\new Staff \bassClarinet
>>
A CueVoice context may be created explicitly if notes of a
smaller size are required, for example to set an alternative
sequence of notes more suitable for a higher or lower voice.
\time 12/8
\key ees \major
g4 ees8 f4 g8
\stemDown
<<
{ d4. bes4 c8 }
\new CueVoice
{ g'4. f4 ees8 }
>>
\stemUp
d2. d2.
See also
Notation Reference: Instrument transpositions, Instrument names, Musical cues, Using tags.
Snippets: Staff notation.
Internals Reference: CueVoice, Voice.
Known issues and warnings
Collisions can occur with rests, when using \cueDuring,
between Voice and CueVoice contexts.
| [ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
| [ < Quoting other voices ] | [ Up : Writing parts ] | [ Editorial annotations > ] | ||