[ << Alapfogalmak ] | [Címoldal][Tartalom][Tárgymutató] | [ A kimenet finomhangolása >> ] |
[ < A kontextus fogalma ] | [Fel: Kontextusok és ábrázolók ] | [ Az ábrázoló fogalma > ] |
4.3.2 Kontextusok létrehozása
In an input file a score block, introduced with a \score
command, contains a single music expression and an associated
output definition (either a \layout
or a \midi
block).
The Score
context is usually left to be created automatically
when the interpretation of that music expression starts.
For scores with only one voice and one staff, the Voice
and
Staff
contexts may also be left to be created automatically,
but for more complex scores it is necessary to create them by hand.
The simplest command that does this is \new
. It is prepended
to a music expression, for example
\new type music-expression
where type is a context name (like Staff
or
Voice
). This command creates a new context, and starts
interpreting the music-expression within that context.
(Note that a \new Score
command is not normally required,
as the essential top-level Score
context is created
automatically when the music expression within the \score
block is interpreted. The only reason for creating a Score
context explicitly using \new Score
is to introduce a
\with
block in which one or more score-wide default values
of context properties may be specified. Information on using
\with
blocks can be found under the heading
„Setting context properties with \with
” in
Kontextusok tulajdonságainak módosítása.)
You have seen many practical examples which created new
Staff
and Voice
contexts in earlier sections, but
to remind you how these commands are used in practice, here’s an
annotated real-music example:
\score { % start of single compound music expression << % start of simultaneous staves section \time 2/4 \new Staff { % create RH staff \key g \minor \clef "treble" \new Voice { % create voice for RH notes \relative { % start of RH notes d''4 ees16 c8. d4 ees16 c8. } % end of RH notes } % end of RH voice } % end of RH staff \new Staff << % create LH staff; needs two simultaneous voices \key g \minor \clef "bass" \new Voice { % create LH voice one \voiceOne \relative { % start of LH voice one notes g8 <bes d> ees, <g c> g8 <bes d> ees, <g c> } % end of LH voice one notes } % end of LH voice one \new Voice { % create LH voice two \voiceTwo \relative { % start of LH voice two notes g4 ees g4 ees } % end of LH voice two notes } % end of LH voice two >> % end of LH staff >> % end of simultaneous staves section } % end of single compound music expression
(Note how all the statements which open a block with either a
curly bracket, {
, or double angle brackets, <<
,
are indented by two further spaces, and the corresponding
closing bracket is indented by exactly the same amount. While
this is not required, following this practice will greatly
reduce the number of ‘unmatched bracket’ errors, and is
strongly recommended. It enables the structure of the music to
be seen at a glance, and any unmatched brackets will be obvious.
Note too how the LH staff is created using double angle brackets
because it requires two voices for its music, whereas the RH staff
is created with a single music expression surrounded by curly
brackets because it requires only one voice.)
The \new
command may also give an identifying name to the
context to distinguish it from other contexts of the same type,
\new type = id music-expression
Note the distinction between the name of the context type,
Staff
, Voice
, etc, and the identifying name of a
particular instance of that type, which can be any sequence of letters
invented by the user. Digits and spaces can also be used in the
identifying name, but then it has to be placed in quotes,
i.e. \new Staff = "MyStaff 1" music-expression
.
The identifying name is used to
refer back to that particular instance of a context. We saw this in
use in the section on lyrics, see Szólamok és vokális zene.
Lásd még
A kottaírás kézikönyve: Kontextusok létrehozása.
[ << Alapfogalmak ] | [Címoldal][Tartalom][Tárgymutató] | [ A kimenet finomhangolása >> ] |
[ < A kontextus fogalma ] | [Fel: Kontextusok és ábrázolók ] | [ Az ábrázoló fogalma > ] |