Next: , Previous: Instrument names, Up: Writing parts


1.6.2.3 Quoting other voices

With quotations, fragments of other parts can be inserted into a part directly. Before a part can be quoted, it must be marked especially as quotable. This is done with the \addQuote command.

\addQuote name music

Here, name is an identifying string. The music is any kind of music. Here is an example of \addQuote

\addQuote clarinet \relative c' {
  f4 fis g gis
}

This command must be entered at toplevel, i.e., outside any music blocks. Typically, one would use an already defined music event as the music:

clarinet = \relative c' {
  f4 fis g gis
}
\addQuote clarinet { \clarinet }

After calling \addQuote, the quotation may then be done with \quoteDuring or \cueDuring,

\quoteDuring #name music

During a part, a piece of music can be quoted with the \quoteDuring command.

\quoteDuring #"clarinet" { s2. }

This would cite three quarter notes (the duration of s2.) of the previously added clarinet voice.

More precisely, it takes the current time-step of the part being printed, and extracts the notes at the corresponding point of the \addQuoted voice. Therefore, the argument to \addQuote should be the entire part of the voice to be quoted, including any rests at the beginning.

It is possible to use another music expression instead of s, thus creating a polyphonic section, but this may not always give the desired result.

Quotations take into account the transposition of both source and target instruments, if they are specified using the \transposition command.

     
     \addQuote clarinet \relative c' {
       \transposition bes
       f4 fis g gis
     }
     
     {
       e'8 f'8 \quoteDuring #"clarinet" { s2 }
     }

[image of music]

The type of events that are present in the quoted music can be trimmed with the quotedEventTypes property. The default value is (note-event rest-event), which means that only notes and rests of the quoted voice end up in the \quoteDuring. Setting

\set Staff.quotedEventTypes =
       #'(note-event articulation-event dynamic-event)

will quote notes (but no rests), together with scripts and dynamics.

Known issues and warnings

Only the contents of the first Voice occurring in an \addQuote command will be considered for quotation, so music can not 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.

See also

Notation Reference: Instrument transpositions.

Snippets: Staff

Internals Reference: QuoteMusic, Voice.


Next: , Previous: Instrument names, Up: Writing parts

This page is for LilyPond-2.11.40 (development-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Your suggestions for the documentation are welcome.

Andere Sprachen: français, español.