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


Quoting other voices

Quotations allow fragments of other parts to be inserted directly into a music expression. 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' {
  f4 fis g gis
}
\addQuote "flute" { \flute }

The \quoteDuring command may then be used to indicate when the quotation should take place. The corresponding measures from the quotation are inserted into the music expression. The syntax is similar to \addQuote:

     
     flute = \relative c' {
       f4 fis g gis
     }
     \addQuote "flute" { \flute }
     
     \relative c' {
       c4 cis \quoteDuring #"flute" { s2 }
     }

[image of music]

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' {
       f4 fis g gis
     }
     \addQuote "flute" { \flute }
     
     \relative c' {
       c4 cis \quoteDuring #"flute" { c4 b }
     }

[image of music]

Quotations recognize instrument transposition settings for both the source and target instruments if they are specified using the \transposition command:

     
     clarinet = \relative c' {
       \transposition bes
       f4 fis g gis
     }
     \addQuote "clarinet" { \clarinet }
     
     \relative c' {
       c4 cis \quoteDuring #"clarinet" { s2 }
     }

[image of music]

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" >>
     }

[image of music]

Quoting another voice

With \quote, fragments of previously entered music may be quoted. quotedEventTypes will determines which items are quoted. In this example, a 16th rest is not quoted, since rest-event is not in quotedEventTypes.

     
     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. }
         }
       >>
     >>

[image of music]

See also

Notation Reference: Instrument transpositions.

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.

Diese Seite ist für LilyPond-2.11.58 (Entwicklungszweig).

Fehler bitte an http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs melden.

Ihre Vorschläge für die Dokumentation sind willkommen.

Andere Sprachen: français, español.