[icon]

GNU LilyPond

Welcome to the home of the GNU Music Typesetter

What is LilyPond
General information
Simple examples
Complex examples
Download
GNU/Linux binaries
Windows
Source code
Documentation
Tutorial
Manual
Glossary
other ...

Support
Mailing lists
Search
WikiWiki
FAQs

External sites
lilypond.org/development
lilypond.org/stable
ftp.lilypond.org
Mutopia
Other music online

Node:Default contexts, Next:, Previous:Creating contexts, Up:Interpretation context



Default contexts

Most music expressions don't need an explicit \context declaration: they inherit the notation context from their parent. Each note is a music expression, and as you can see in the following example, only the sequential music enclosing the three notes has an explicit context.

\score { \notes \context Voice = goUp { c'4 d' e' } }

[picture of music]

There are some quirks that you must keep in mind when dealing with defaults:

First, every top level music is interpreted by the Score context, in other words, you may think of \score working like

        \score {
                \context Score music
        }

Second, contexts are created automatically to be able to interpret the music expressions. Consider the following example.

\score { \context Score \notes { c'4 (  d' )e' } }

[picture of music]

The sequential music is interpreted by the Score context initially (notice that the \context specification is redundant), but when a note is encountered, contexts are setup to accept that note. In this case, a Thread, Voice and Staff are created. The rest of the sequential music is also interpreted with the same Thread, Voice and Staff context, putting the notes on the same staff, in the same voice.

This is a convenient mechanism, but do not expect opening chords to work without \context. For every note, a separate staff is instantiated.

\score { \notes <c'4 es'> }

[picture of music]

Of course, if the chord is preceded by a normal note in sequential music, the chord will be interpreted by the Thread of the preceding note:

\score { \notes { c'4 <c'4 es'> }  }

[picture of music]

Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to lilypond@packages.debian.org

Copyright (c) 1997--2001 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.4.12 (stable-branch) by

Anthony Fok <lilypond@packages.debian.org>, Tue Mar 12 01:35:39 2002 HKT.