]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/hu/learning/fundamental.itely
0c978d6bfa5bc5641fa33a1f4ed6bb1c937a252d
[lilypond.git] / Documentation / hu / learning / fundamental.itely
1 @c -*- coding: utf-8; mode: texinfo; documentlanguage: hu -*-
2 @c This file is part of learning.tely
3 @ignore
4     Translation of GIT committish: 48c2b169dc8a9bc2ab2c767cbb83b57cc158742b
5
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  For details, see the Contributors'
8     Guide, node Updating translation committishes..
9 @end ignore
10
11
12 @c -*- coding: utf-8; mode: texinfo; -*-
13 @c \version "2.19.2"
14 @node Alapfogalmak
15 @chapter Alapfogalmak
16 @translationof Fundamental concepts
17 @translationof Fundamental concepts
18
19 Miután megtanultuk, hogyan állíthatunk elő gyönyörű kottákat egyszerű szöveges
20 fájlokból, ebben a szakaszban megismerjük azokat a fogalmakat és technikákat,
21 amelyek segítségével hasonlóan gyönyörű, de bonyolultabb kottákat készíthetünk.
22
23 @menu
24 * Hogyan működnek a LilyPond bemeneti fájlok?::
25 * A szólamok zenét tartalmaznak::
26 * Kontextusok és ábrázolók::
27 * A sablonok kibővítése::
28 @end menu
29
30 @node Hogyan működnek a LilyPond bemeneti fájlok?
31 @section Hogyan működnek a LilyPond bemeneti fájlok?
32 @translationof How LilyPond input files work
33 @translationof How LilyPond input files work
34
35 A LilyPond bemeneti formátuma meglehetősen rugalmas, így a tapasztalt
36 felhasználóknak nagy szabadságot ad abban, hogyan strukturálják a
37 forrásfájljaikat. Azonban ez a rugalmasság az újdonsült felhasználók számára
38 bonyolult lehet. Ez a szakasz elmagyarázza a struktúra nagy részét, az
39 egyszerűség kedvéért bizonyos részleteket elnagyolva. A bemeneti formátum
40 felépítésének teljes leírása a @ruser{File structure} c. szakaszban olvasható.
41
42 @menu
43 * Bevezetés a LilyPond fájlok szerkezetébe::
44 * A kotta egy összetett zenei kifejezés::
45 * Zenei kifejezések egymásba ágyazása::
46 * A gerendák és ívek átfedhetik egymást::
47 @end menu
48
49 @node Bevezetés a LilyPond fájlok szerkezetébe
50 @subsection Bevezetés a LilyPond fájlok szerkezetébe
51 @translationof Introduction to the LilyPond file structure
52 @translationof Introduction to the LilyPond file structure
53
54 @c index bemeneti formátum
55 @c index fájlstruktúra
56
57 A LilyPond bemeneti fájlok szerkezetére egy tipikus példa:
58
59 @example
60 \version @w{"@version{}"}
61
62 \header @{ @}
63
64 \score @{
65   @var{...összetett zenei kifejezés...}  % ide jön a zene!
66   \layout @{ @}
67   \midi @{ @}
68 @}
69 @end example
70
71 @noindent
72 Ennek az alapvető mintának sok változata lehetséges, de ez a példa jó
73 kiindulási alapot jelent.
74
75 @funindex \book
76 @funindex book
77 @funindex \score
78 @funindex score
79 @cindex book
80 @cindex score
81
82 Eddig egyik példa sem használta a @code{\score@{@}} parancsot. Ennek oka, hogy
83 a LilyPond automatikusan hozzáadja az egyszerű bemenethez a szükséges
84 parancsokat. A következő bemenet például:
85
86 @example
87 \relative c'' @{
88   c4 a d c
89 @}
90 @end example
91
92 @noindent
93 a következő rövidítése:
94
95 @example
96 \book @{
97   \score @{
98     \new Staff @{
99       \new Voice @{
100         \relative c'' @{
101           c4 a b c
102         @}
103       @}
104     @}
105     \layout @{ @}
106   @}
107 @}
108 @end example
109
110 Más szóval, ha a bemenet egyetlen zenei kifejezést tartalmaz, a LilyPond úgy
111 értelmezi a fájlt, mintha a zenei kifejezés körül már szerepelnének a fenti
112 parancsok.
113
114 @cindex implicit kontextusok
115
116 @strong{Figyelem!} A dokumentációban sok példa nem tartalmazza a
117 @code{\new Staff} és @code{\new Voice} parancsokat, így azok implicite kerülnek
118 létrehozásra. Ez egyszerű példáknál jól működik, de bonyolultabb esetekben,
119 főleg, ha más parancsokat is használunk, a kontextusok implicit létrehozása
120 meglepő kimenetet eredményezhet, például nemkívánatos kottasorok jelenlétét.
121 A kontextusok explicit megadásának módja a @ref{Kontextusok és ábrázolók} c.
122 részben olvasható.
123
124 @warning{Többszólamú zeneművek esetén ajánlott explicit módon létrehozni a
125 kottasorokat és az azon belüli szólamokat.}
126
127 Egyelőre térjünk vissza az első példánkhoz, és vizsgáljuk meg csak a
128 @code{\score} parancsot.
129
130 A @code{\score} blokkon belül először pontosan egy zenei kifejezésnek kell
131 következnie.
132 Emlékezzünk arra, hogy egy zenei kifejezés lehet egy hang is, de akár
133 egy olyan nagy összetett kifejezés is, mint:
134
135 @example
136 @{
137   \new StaffGroup <<
138     @var{...egy teljes Wagner-opera zenei anyaga...}
139   >>
140 @}
141 @end example
142
143 @noindent
144 Mivel mindez egy @code{@{ ... @}} blokkban szerepel, egy zenei
145 kifejezésnek számít.
146
147 Ahogy korábban láttuk, a @code{\score} blokk a zenén kívül más definíciókat is
148 tartalmazhat, mint például:
149
150 @example
151 \score @{
152   @{ c'4 a b c' @}
153   \header @{ @}
154   \layout @{ @}
155   \midi @{ @}
156 @}
157 @end example
158
159 @funindex \header
160 @funindex header
161 @funindex \layout
162 @funindex layout
163 @funindex \midi
164 @funindex midi
165 @cindex header
166 @cindex layout
167 @cindex midi
168
169 @noindent
170 Ez a három parancs -- @code{\header}, @code{\layout} és @code{\midi} --
171 speciális: az eddigi parancsokkal ellentétben @emph{nem} zenei kifejezések, és
172 nem azok részei. A @code{\score} blokkon belül vagy kívül is elhelyezkedhetnek
173 -- például a @code{\header} (fejléc) blokk, melyben a kotta adatait (pl. cím,
174 szerző stb.) lehet megadni, legtöbbször a @code{\score} parancs előtt szerepel,
175 ahogy a szakasz elején található példában is látható.
176
177 A két további, még ismeretlen parancs: @code{\layout @{@}} és
178 @code{\midi @{@}}. Ezek ebben a formában rendre azt jelentik, hogy a LilyPond
179 kottaképet, ill. hangzó anyagot állítson elő. Teljes leírásuk a Kottaírás
180 Kézikönyvében található, a @ruser{Score layout} és a
181 @ruser{Creating MIDI files} szakaszokban.
182
183 @cindex több kotta
184 @cindex implicit book blokk
185 @funindex \book
186 @funindex book
187
188 Egy fájlban több @code{\score} blokk lehet. Mindegyik egy-egy zeneművet
189 vagy tételt jelöl, de ezek egy kimeneti fájlban fognak megjelenni. Nem
190 szükséges @code{\book} blokkba foglalni őket -- ez implicite megtörténik.
191 Ha azonban több kimeneti fájlt szeretnénk kapni egy forrásfájlból, akkor több
192 @code{\book} blokkot kell megadnunk -- kimeneti fájlonként egyet-egyet.
193
194 Összegezve:
195
196 Minden @code{\book} blokk külön kimeneti fájlt eredményez (pl. egy-egy PDF
197 állományt). Ha nem szerepel explicit módon a forráskódban, akkor a LilyPond
198 körülveszi az egész forráskódot egy @code{\book} blokkal.
199
200 Egy @code{\book} blokkon belül minden @code{\score} blokk különálló zenei
201 egységet jelöl.
202
203 @cindex layout blokk helye
204
205 Minden @code{\layout} blokk arra a @code{\score} vagy @code{\book} blokkra
206 érvényes, amelyben szerepel -- tehát egy @code{\score} blokkon belüli
207 @code{\layout} blokk csakis arra az egy @code{\score} blokkra vonatkozik,
208 de egy @code{\score} blokkon kívüli @code{\layout} blokk a @code{\score}
209 blokkot tartalmazó (akár explicit, akár implicit) @code{\book} blokkon belüli
210 minden @code{\score} blokkra érvényes.
211
212 A részletek a @ruser{Multiple scores in a book} c. részben olvashatók.
213
214 @cindex változók
215
216 Fájljainkat áttekinthetőbbé tehetjük változók definiálásával (ld.
217 @ref{Művek szervezettebbé tétele változók segítségével}). Minden sablonban ezt
218 a módszert használjuk:
219
220 @example
221 dallam = \relative c' @{
222   c4 a b c
223 @}
224
225 \score @{
226   \dallam
227 @}
228 @end example
229
230 Amikor a LilyPond feldolgozza ezt a fájlt, a @code{dallam} változó értékét
231 (azaz mindent az egyenlőségjel utáni zenei kifejezésből) beszúrja mindenhova,
232 ahol @code{\dallam} hivatkozást lát. A változók nevére nincs sok megkötés -- a
233 következők mind helyes példák:  @code{dallam}, @code{jobbkéz}, @code{fuvola},
234 @code{BII} stb. A @ref{Kevesebb gépelés változókkal és függvényekkel} c.
235 szakasz további információkat tartalmaz. Mindössze annyi a korlátozás, hogy a
236 változónevek csak betűket tartalmazhatnak, és nem ütközhetnek a
237 LilyPond parancsok neveivel. A pontos szabályok a @ruser{File structure} c.
238 részben vannak leírva.
239
240 @seealso
241 A bemeneti formátum teljes definíciója a
242 @ruser{File structure} c. szakaszban található.
243
244 @node A kotta egy összetett zenei kifejezés
245 @subsection A kotta egy összetett zenei kifejezés
246 @translationof Score is a (single) compound musical expression
247 @translationof Score is a (single) compound musical expression
248
249 @funindex \score
250 @funindex score
251 @cindex score
252 @cindex összetett zenei kifejezés
253
254 Az előző szakaszban (@ref{Bevezetés a LilyPond fájlok szerkezetébe}) már láttuk
255 a LilyPond fájlok általános felépítését. De a legfontosabb részt mintha
256 átugrottuk volna: mi kerüljön a @code{\score} blokk belsejébe?
257
258 Valójában ez sokkal egyszerűbb, mint gondolnánk. Ez a mondat mindent
259 megmagyaráz:
260
261 @quotation
262 @emph{A @code{\score} blokknak egy összetett zenei kifejezéssel kell
263 kezdődnie.}
264 @end quotation
265
266 @noindent
267 Az összetett zenei kifejezés fogalmát már tisztáztuk
268 @ref{A zenei kifejezés fogalma} c. részben. Láttuk, hogy építhetünk fel nagy
269 zenei kifejezéseket kis részekből -- először hangokból, aztán akkordokból stb.
270 Most egy összetett zenei kifejezést vizsgálunk meg felülről lefelé. Az
271 egyszerűség kedvéért egy zongorakíséretes dal lesz a példánk. Először is
272 szükségünk van az énekes és a zongorista szólamára.
273
274 @example
275 \score @{
276   <<
277     \new Staff = "ének" <<
278     >>
279     \new PianoStaff = "zongora" <<
280     >>
281   >>
282   \layout @{ @}
283 @}
284 @end example
285
286 Elneveztük a két szólamot @qq{ének} és @qq{zongora} néven. Ez nem kötelező,
287 de jó szokás, hogy első pillantásra lássuk, melyik szólam mire szolgál.
288
289 Emlékezzünk arra, hogy @code{<< ... >>} szolgál több szólam jelölésére. Ennek
290 hatására az ének- és a zongoraszólam egymás alatt fog megjelenni a kottában.
291 A zongoraszólam két kottasort fog tartalmazni, az énekszólam pedig egy
292 kottasort és egy dalszöveget, így mindkettőhöz @code{<< ... >>} blokk kell.
293 A dalszöveghez az @code{\addlyrics} parancsot fogjuk használni. Ha szükséges
294 feleleveníteni, az @ref{Egyszerű dalok kottázása} c. részben olvashatunk róla.
295
296 @lilypond[verbatim,quote,ragged-right]
297 \score {
298   <<
299     \new Staff = "ének" <<
300       \new Voice = "dallam" { c'1 }
301       \addlyrics { Szólt }
302     >>
303     \new PianoStaff = "zongora" <<
304       \new Staff = "jobbkéz" { c'1 }
305       \new Staff = "balkéz" { c'1 }
306     >>
307   >>
308   \layout { }
309 }
310 @end lilypond
311
312 Most megvan a teljes struktúra. Az énekszólam egy @code{Voice} kontextust
313 tartalmaz a hangoknak, és egy strófányi dalszöveget. A zongoraszólam pedig
314 a jobb- és balkéz kottasorait tartalmazza.
315
316 Most elkezdhetjük kitölteni a hangokat. Elkezdhetnénk közvetlenül a Voice
317 kontextus belsejébe beleírni, hogy:
318
319 @example
320 \relative c'' @{
321   r4 d8\noBeam g, c4 r
322 @}
323 @end example
324
325 De ha ezt tennénk, a @code{\score} blokk nagyon bonyolult lenne, és nem lehetne
326 átlátni a szólamok szerkezetét. Így érdemes változókat használni. A dalszöveg
327 változóként való megadására a @code{\lyricmode} parancsot kell használni, hogy
328 a LilyPond dalszövegként és ne hangokként értelmezze a változó tartalmát.
329 (A dalszöveg egy külön beviteli mód, ezekből még több is van, ld. az
330 @ruser{Input modes} c. részt.)
331
332 Tehát miután definiáltuk a megfelelő változókat, hivatkoztunk rájuk, és
333 basszuskulccsal láttuk el a balkezet, kész egy valódi mű kezdete:
334
335 @lilypond[verbatim,quote,ragged-right]
336 dallam = \relative c'' { r4 d8\noBeam g, c4 r }
337 dalszöveg = \lyricmode { Szólt az Úr, }
338 jobbkéz = \relative c'' { <g d g,>2~ <g d g,> }
339 balkéz = \relative c { b2 e2 }
340
341 \score {
342   <<
343     \new Staff = "ének" <<
344       \new Voice = "dallam" { \dallam }
345       \addlyrics { \dalszöveg }
346     >>
347     \new PianoStaff = "zongora" <<
348       \new Staff = "jobbkéz" { \jobbkéz }
349       \new Staff = "balkéz" {
350         \clef "bass"
351         \balkéz
352       }
353     >>
354   >>
355   \layout { }
356 }
357 @end lilypond
358
359 Amikor a @code{\score} blokkot írjuk vagy olvassuk, mindig lassan, gondosan
360 járjunk el. Haladjunk kívülről befelé, a magas szintű felépítéstől a részletek
361 felé haladva. Nagyban segít, ha ügyelünk a behúzásokra -- minden blokk
362 kezdődjön egy tabulátorral beljebb, így az egy szinten levő blokkok ugyanolyan
363 mértékben lesznek behúzva.
364
365 @seealso
366 Referencia: @ruser{Structure of a score}.
367
368
369 @node Zenei kifejezések egymásba ágyazása
370 @subsection Zenei kifejezések egymásba ágyazása
371 @translationof Nesting music expressions
372
373 @cindex ideiglenes kottasorok
374 @cindex ossia
375
376 Ossiák bevitelekor jön jól, hogy kottasorok bármikor, darab közben is
377 kezdődhetnek, és bármikor végződhetnek. Álljon itt erre egy példa:
378
379 @lilypond[verbatim,quote,ragged-right]
380 \new Staff {
381   \relative g' {
382     r4 g8 g c4 c8 d |
383     e4 r8
384     <<
385       { f c c }
386       \new Staff {
387         f8 f c
388       }
389     >>
390     r4 |
391   }
392 }
393 @end lilypond
394
395 @noindent
396 Figyeljük meg, hogy a kulcs mérete némileg kisebb, mint a sor elején szereplő
397 kulcsé (mint ahogy kulcsváltásnál is).
398
399 @cindex kottasorok pozíciója
400
401 Az ossia a kottasor fölött is elhelyezkedhet:
402
403 @lilypond[verbatim,quote,ragged-right]
404 \new Staff = "main" {
405   \relative g' {
406     r4 g8 g c4 c8 d |
407     e4 r8
408     <<
409       { f c c }
410       \new Staff \with {
411         alignAboveContext = #"main" }
412       { f8 f c }
413     >>
414     r4 |
415   }
416 }
417 @end lilypond
418
419 Ebben a példában a még ismeretlen @code{\with} parancsot használtuk, amelyet
420 később ismertetünk. Most elég annyit tudni róla, hogy a kottasor bizonyos
421 tulajdonságainak módosítására szolgál. Itt egy olyan tulajdonságot adunk meg,
422 ami azt mondja, hogy az új kottasor a @qq{main} nevű kottasor felett
423 helyezkedjen el (ahelyett, hogy alatta helyezkedne el, ami az alapértelmezés).
424
425
426 @seealso
427 Az ossiákat általában kulcs és ütemmutató nélkül, valamint kisebb méretben
428 szedjük. Ehhez további új parancsok kellenek; ld. az @ref{Size of objects} és
429 @ruser{Ossia staves} szakaszokat.
430
431
432 @node A gerendák és ívek átfedhetik egymást
433 @subsection A gerendák és ívek átfedhetik egymást
434 @translationof On the un-nestedness of brackets and ties
435
436 @cindex zárójeltípusok
437 @cindex zárójelek egymásba ágyazása
438
439 Már sok zárójelfajtával találkoztunk a LilyPond fájlok írása közben. Ezekre
440 különböző szabályok vonatkoznak, amelyeket érdemes tisztázni. Ismételjük át
441 ezeket a típusokat.
442
443 @need 50
444 @multitable @columnfractions .3 .7
445 @headitem Zárójelfajta
446   @tab Szerep
447 @item @code{@{ .. @}}
448   @tab Egymás után megszólaló hangokat tartalmaz
449 @item @code{< .. >}
450   @tab Egy akkord hangjait tartalmazza
451 @item @code{<< .. >>}
452   @tab Egyszerre megszólaló zenei kifejezéseket tartalmaz
453 @item @code{( .. )}
454   @tab Egy ív kezdetét és végét jelöli
455 @item @code{\( .. \)}
456   @tab Egy frazeálóív kezdetét és végét jelöli
457 @item @code{[ .. ]}
458   @tab Egy kézi gerenda kezdetét és végét jelöli
459 @end multitable
460
461 A LilyPond világán kívül a különböző fajtájú zárójeleket megfelelően egymásba
462 kell ágyazni, pl. így: @code{<< [ @{ ( .. ) @} ] >>}. Tehát a záró
463 zárójeleknek pontosan fordított sorrendben kell állniuk, mint a nyitó
464 zárójeleknek. A fenti táblázatban szereplő első három típusnál (a blokkoknál)
465 ezt a LilyPond is megköveteli. A többi parancsnál ez nem követelmény.
466 Valójában ezekre nem is úgy érdemes gondolni, mint a zárójelekre, hanem olyan
467 jelzésekre, amelyek zenei elemek kezdetét és végét jelölik.
468
469 Tehát például egy frazeálóív kezdődhet egy kézzel megadott gerenda előtt, és
470 befejeződhet a gerenda vége előtt -- lehet, hogy nem a legzeneibb megoldás, de
471 lehetséges:
472
473 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
474  { g8\( a b[ c b\) a] }
475 @end lilypond
476
477 Általánosságban az ívek, frazeálóívek, kötőívek és gerendák átnyúlhatnak
478 a triolák és előkék határain. A következő példában az 1. sorban egy gerenda,
479 a 2. sorban egy kötőív nyúl bele egy triolába, a 3. és 4. sorban pedig
480 mindezek mellett még egy kötőív is található két triola között, valamint egy
481 frazeálóív, amely túlnyúlik a triolán.
482
483 @lilypond[quote,verbatim,fragment,ragged-right]
484 {
485   r16[ g16 \tuplet 3/2 {r16 e'8] }
486   g16( a \tuplet 3/2 {b d) e' }
487   g8[( a \tuplet 3/2 {b d') e'~]}
488   \tuplet 5/4 {e'32\( a b d' e'} a'4.\)
489 }
490 @end lilypond
491
492
493 @node A szólamok zenét tartalmaznak
494 @section A szólamok zenét tartalmaznak
495 @translationof Voices contain music
496
497 Ahogy az énekeseknek dallamok kellenek ahhoz, hogy énekelhessenek, a LilyPondnak is szüksége van hangokra.
498 A valódi zene minden hangszer számára magában a kottában szereplő szólamokat jelenti -- 
499 ezek nem csak a zenének, hanem magának a LilyPondnak is alapkövei.
500
501 @menu
502 * Hangzatos szólamok::
503 * Szólamok kézi létrehozása::
504 * Szólamok és vokális zene::
505 @end menu
506
507 @node Hangzatos szólamok
508 @subsection Hangzatos szólamok
509 @translationof I'm hearing Voices
510
511
512 @cindex polyphony
513 @cindex layers
514 @cindex multiple voices
515 @cindex voices, multiple
516 @cindex Voice context
517 @cindex context, Voice
518 @cindex simultaneous music
519 @cindex music, simultaneous
520 @cindex concurrent music
521 @cindex music, concurrent
522 @cindex voices vs. chords
523 @cindex chords vs. voices
524
525 A LilyPond kotta legalsó rétege a  @q{Szólam környezet} vagy röviden @q{Szólamok}. 
526 A szólamokat egyes csomagokban csak rétegeknek nevezzük.
527
528 Valójában a szólam környezet az egyetlen, ami zenét tartalmazhat. 
529 Ha szólam környezetet nem hozunk létre, akkor automatikusan készül 
530 egy, ahogy láthattuk ennek a fejezetnek az elején. Egyes hangszerek 
531 -- mint az oboa is -- egy időben csak egy hangot képesek kiadni. 
532 Az ilyen hangszerekre írt zenék monofonikusak és csak egyetlen hangot 
533 tartalmaznak (egy időben). Azon hangszerek esetén, melyek képesek egy 
534 időben több hangot is kiadni -- mint a zongora -- sokszor többszörös 
535 szólamokra van szükségünk, akár különböző ütemben. 
536
537         
538 Egy egyszerű szólam  több hangjegyet is tartalmazhat egy akkordban, 
539 tehát felmerül a kérdés, hogy mikor is van szükségünk többszörös szólamra. 
540 Nézzük az első példát, 4 akkorddal:
541
542 @lilypond[quote,verbatim,fragment,ragged-right,relative=1]
543 \key g \major
544 <d g>4 <d fis> <d a'> <d g>
545 @end lilypond
546
547 A fenti példa leírható egyszerű, kúpos („kacsacsőr”) zárójelekkel, @code{< ... >}, 
548 így csak egy egyszeres szólamra volt szükségünk. De tegyük fel, hogy, hogy a FISZ 
549 egy nyolcad, melyet egy másik G nyolcad követ. Ebben esetben két hangunk van, 
550 mely ugyanakkor kezdődik, de különböző hanghosszúságú: a negyed D és a nyolcad FISZ. 
551 Hogy írjuk ezt le? Nem írhatjuk akkordként, hiszen egy akkordban minden hang azonos 
552 hosszúságú és nem írhatjuk egymást követő hangokként sem, hiszen egy időben kell kezdődniük a hangoknak. Ilyenkor van szükségünk két szólamra.
553
554
555
556 Nézzük, hogy néz ez ki a LilyPond szintaxisában.
557
558 @funindex << \\ >>
559 @funindex \\
560
561 A legegyszerűbb módja olyan részek rögzítésének, amelyek több mint egy hangot 
562 tartalmaznak egy szólamban, hogy szekvenciát @code{@{...@}} használunk és ezt kombináljuk a szögletes zárójelekkel @code{<<...>>}.
563 Az ilyen a részeket @code{\\} segítségével kell elválasztani ahhoz, hogy különböző szólamként jelenjenek meg. 
564 Az elválasztó jelek nélkül a hangok egyetlen szólamként szerepelnének, ami általában hibát okoz. 
565 Ez a technika használható olyan daraboknál melyek leginkább monofonikusak és néhány részük polifón.
566
567
568 Itt egy példa, ami a fenti akkord egyik hangját két szólamra osztja és kötést is tartalmaz:
569
570 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
571 \key g \major
572 %    Voice "1"                  Voice "2"
573 << { g4 fis8( g) a4 g }  \\  { d4 d d d }  >>
574 @end lilypond
575
576 Vegyük észre, hogy a második hang szárai lefele mutatnak.
577
578
579 Íme egy másik egyszerű példa:
580
581 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
582 \key d \minor
583 %    Voice "1"             Voice "2"
584 << { r4 g g4. a8 }    \\ { d,2 d4 g }       >>
585 << { bes4 bes c bes } \\ { g4 g g8( a) g4 } >>
586 << { a2. r4 }         \\ { fis2. s4 }       >>
587 @end lilypond
588
589 Nem szükséges, hogy minden ütemet elválasszunk a  @code{<< \\ >>} segítségével.  
590 Olyan zenék esetén, ahol csak néhány hang van minden ütemben, ez a felépítés 
591 segíti a kód olvashatóságát, de ha már sok hang van, akkor jobb, ha a hangokat külön-külön jegyezzük le, például így:
592
593
594 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
595 \key d \minor
596 << {
597   % Voice "1"
598   r4 g g4. a8 |
599   bes4 bes c bes |
600   a2. r4 |
601 } \\ {
602   % Voice "2"
603   d,2 d4 g |
604   g4 g g8( a) g4 |
605   fis2. s4 |
606 } >>
607 @end lilypond
608
609
610 @cindex voices, naming
611 @cindex voices crossing brackets
612 @cindex slurs crossing brackets
613 @cindex ties crossing brackest
614
615
616 A fenti példában csak két szólam van, de ha három vagy több szólamot kell 
617 lejegyezni, azt is hasonlóan lehet megoldani visszaperjelek (back-slash) használatával.
618
619 A szólam környezetek nevei @code{"1"}, @code{"2"}, stb. 
620 Minden ilyen környezetben a függőleges elrendezés (kötések, szárak, dinamika, stb) megfelelően jelenik meg.
621
622
623 @lilypond[quote,verbatim,fragment]
624 \new Staff \relative c' {
625   % Main voice
626   c16 d e f
627   %    Voice "1"     Voice "2"                 Voice "3"
628   << { g4 f e } \\ { r8 e4 d c8~ } >>
629   << { d2 e2 }  \\ { c8 b16 a b8 g~ g2 } \\ { s4 b4 c2 } >>
630 }
631 @end lilypond
632
633
634 A fő szólamtól különválasztva jelennek meg a @code{<< .. >>} között  
635 szereplő szólamok (hangok). Ezt hívjuk @emph{szimultán felépítésnek}. 
636 Az átkötések és kötőívek csak az azonos szólamon belül kötik 
637 össze a hangokat, tehát ezek nem kerülhetnek belülre vagy kívülre a 
638 szimultán felépítéshez képest.
639 Fordítva, szimultán felépítés esetén azok a párhuzamos szólamok, 
640 amelyek ugyanabban az ötvonalban vannak, egy szólamnak minősülnek. 
641 Egyéb szólamhoz kapcsolódó tulajdonságok átöröklődnek a szimultán 
642 felépítésbe is. Itt egy másik példa, melynél a különböző szólamokban 
643 különböző színű hangok szerepelnek. Vegyük észre, hogy 
644 adott szólambeli változások nincsenek hatással más szólamokra, 
645 de a változtatások ugyanabban a szólamban később is érvényesek. 
646 Vegyük észre azt is, hogy az összekötött hangokat szétválaszthatja 
647 az ütemhatár, ahogy a kék háromszöget jelző szólamban láthatjuk: 
648
649
650 @lilypond[quote,verbatim]
651 \new Staff \relative c' {
652   % Main voice
653   c16 d e f
654   <<  % Bar 1
655     {
656       \voiceOneStyle
657       g4 f e
658     }
659   \\
660     {
661       \voiceTwoStyle
662       r8 e4 d c8~
663     }
664   >>
665   <<  % Bar 2
666      % Voice 1 continues
667     { d2 e2 }
668   \\
669      % Voice 2 continues
670     { c8 b16 a b8 g ~ g2 }
671   \\
672     {
673       \voiceThreeStyle
674       s4 b4 c2
675     }
676   >>
677 }
678 @end lilypond
679
680 @funindex \voiceOneStyle
681 @funindex \voiceTwoStyle
682 @funindex \voiceThreeStyle
683 @funindex \voiceFourStyle
684 @funindex \voiceNeutralStyle
685
686
687 A @code{\voiceXXXStyle} parancsot elsősorban oktatási célra érdemes 
688 használni, olyan esetben, mint amilyet ez is.  Ezek a parancsok 
689 módosítják a hangok színét illetve a kottafejet, a  szárat, a 
690 gerendákat és a hangfejek stílusát, így lesznek a szólamok könnyen felismerhetőek. 
691
692 Az első szólam piros rombusz, a második kék háromszög, a 
693 harmadik zöld áthúzott kör, a negyedik (itt nem használt) magenta kereszt. 
694 A @code{\voiceNeutralStyle} (szintén nem használt a fenti példában) visszaállítja 
695 a stílust az alapértelmezettre. Később az  @ref{Objektumok láthatósága és színe} 
696 és @ref{Változók felhasználása a finomhangoláshoz} fejezetekben majd látni fogjuk, 
697 hogyan lehet hasonló parancsokat létrehozni.
698
699
700 @cindex polyphony and relative note entry
701 @cindex relative note entry and polyphony
702
703
704 A polifónia nem változtatja meg a hangjegyek viszonyát a @code{\relative @{ @}} blokkon belül. 
705 Minden hangjegy helyzetét az azt megelőző hang illetve első hang helyzete határozza meg.
706
707 @example
708 \relative c' @{ noteA << < noteB noteC > \\ noteD >> noteE @}
709 @end example
710
711 @noindent
712 @code{noteB} is relative to @code{noteA}                      @*
713 @code{noteC} is relative to @code{noteB}, not @code{noteA};   @*
714 @code{noteD} is relative to @code{noteB}, not @code{noteA} or
715 @code{noteC};                                                 @*
716 @code{noteE} is relative to @code{noteD}, not @code{noteA}.
717
718
719 Van egy másik módszer, ami egyszerűbb, ha a hangjegyek a 
720 szólamokon belül teljesen szét vannak választva. 
721 Ezt úgy érthetjük el, hogy  a @code{\relative} parancsot használjuk minden szólam kezdetén:
722
723
724 @example
725 \relative c' @{ noteA ... @}
726 <<
727   \relative c'' @{ < noteB noteC > ... @}
728 \\
729   \relative g' @{ noteD ... @}
730 >>
731 \relative c' @{ noteE ... @}
732 @end example
733
734 Végül vizsgáljuk meg a szólamokat összetettebb zene esetén. 
735 Nézzük Chopin Deux Nocturne, Op 32. művének első két ütemét. 
736 A továbbiakban is ezt a példát fogjuk használni arra, hogy a 
737 jelölésekre használható különböző technikákat szemléltessük, 
738 ezért tekintsünk el attól, hogy az alábbi kód elsőre rejtélyesnek 
739 tűnhet és koncentráljunk csak a zenére és a szólamokra -- a nehezebb részeket majd a későbbi fejezetekben áttekintjük. 
740
741
742
743 @c The following should appear as music without code
744 @lilypond[quote,ragged-right]
745 \new Staff \relative c'' {
746   \key aes \major
747   <<  % Voice one
748     { c2 aes4. bes8 }
749   \\  % Voice two
750     { aes2 f4 fes }
751   \\  % No voice three
752   \\  % Voice four
753     {
754       % Ignore these for now - they are explained in Ch 4
755       \once \override NoteColumn #'force-hshift = #0
756       <ees c>2
757       \once \override NoteColumn #'force-hshift = #0.5
758       des2
759     }
760   >> |
761   <c ees aes c>1 |
762 }
763 @end lilypond
764
765 A szárak iránya gyakran jelzi két egyidejű dallamsor folytonosságát. 
766 A fenti példánál a legfelső hangjegy szárai felfelé mutatnak, az alsóké mind lefelé. 
767 Ez az első jelölés, amire szükségünk van több szólam lejegyzése során. 
768
769
770 Leginkább viszont akkor van szükségünk többszörös szólamokra, amikor a hangok ugyanakkor kezdődnek ugyan, de különböző hosszúságúak. Nézzük azt a hangot, ami első ütem harmadik ütésekor kezdődik. Az ASZ egy pontozott negyed, az alatta levő F egy pontozatlan negyed,  a DESZ pedig egy fél hang.  Ezek nem írhatók le akkordként, hiszen akkord esetén minden hang azonos hosszúságú. Nem írhatóak le egymást követő hangokként sem, hiszen egy időben kell kezdődniük. Az ütemnek ebben a részében három szólamra van szükségünk, és normál esetben az egész ütem három szólamú, ahogy az alábbi példa mutatja, ahol különböző hangjegyfejeket használunk különböző színekkel a három szólamhoz. Szeretnénk ismét kihangsúlyozni, hogy az alábbi példa mögötti kódot később elmagyarázzuk, most csak hagyjuk figyelmen kívül azokat a részeket, amik nem érthetőek. 
771
772
773 @c The following should appear as music without code
774 @c The three voice styles should be defined in -init
775 @lilypond[quote,ragged-right]
776 \new Staff \relative c'' {
777   \key aes \major
778   <<
779     {  % Voice one
780       \voiceOneStyle
781       c2 aes4. bes8
782     }
783   \\  % Voice two
784     { \voiceTwoStyle
785       aes2 f4 fes
786     }
787   \\  % No Voice three (we want stems down)
788   \\  % Voice four
789     { \voiceThreeStyle
790       % Ignore these for now - they are explained in Ch 4
791       \once \override NoteColumn #'force-hshift = #0
792       <ees c>2
793       \once \override NoteColumn #'force-hshift = #0.5
794       des2
795     }
796   >>
797   <c ees aes c>1
798 }
799 @end lilypond
800
801 Kezdjük a legelején a fenti zene kódolását.  
802 Látni fogjuk, hogy beleütközünk majd több problémába is (de ez ne keserítsen el minket, a lényeg, hogy ezekből tanulunk :) ). 
803 Kezdjük azzal, amit tanultunk: a @code{<< \\  >>}  használatával. 
804 Gépeljük be a három szólam első ütemét:
805
806 @lilypond[quote,verbatim,fragment,ragged-right]
807 \new Staff \relative c'' {
808   \key aes \major
809   <<
810     { c2 aes4. bes8 } \\ { aes2 f4 fes } \\ { <ees c>2 des2 }
811   >>
812   <c ees aes c>1
813 }
814 @end lilypond
815
816 @cindex stem down
817 @cindex voices and stem directions
818 @cindex stem directions and voices
819 @cindex stem up
820
821
822 A szárak iránya automatikusan hozzárendelődik a szólamokhoz, a páratlan-sorszámú szólamoknál felfelé, a párosoknál lefelé. Az első és második szólamhoz tartozó hangok szárai megfelelőek, de a harmadik szólamban a száraknak lefelé kellene állniuk. Ezt úgy javíthatjuk, hogy a harmadik szólamot átugorjuk (üresen hagyjuk) és a negyedik szólamba helyezzük az eredetileg harmadik szólamot. Ezt egyszerűen megtehetjük a @code{\\} segítségével:
823
824
825 @lilypond[quote,verbatim,fragment,ragged-right]
826 \new Staff \relative c'' {
827   \key aes \major
828   <<  % Voice one
829     { c2 aes4. bes8 }
830   \\  % Voice two
831     { aes2 f4 fes }
832   \\  % Omit Voice three
833   \\  % Voice four
834     { <ees c>2 des2 }
835   >>
836   <c ees aes c>1
837 }
838 @end lilypond
839
840 @noindent
841 Látjuk, hogy ez megoldotta a problémát a szárak irányával kapcsolatban, 
842 de előhozott egy másikat, ami többszörös szólamoknál néha előfordul -- 
843 a hangok szárai a szólamon belül ütköznek más kottafejekkel más szólamokban. 
844 A hangok megtervezéséhez a LilyPond lehetővé teszi, hogy hangok illetve akkordok esetén, két hang ugyanazt a függőleges pozíciót foglalja el akár ellentétes szárirány esetén, viszont figyelembe veszi azt, hogy bizonyos esetekben a harmadik és a negyedik szólam elmozdulhat, ezzel elkerülve azt, hogy a kottafejek egymást fedjék. Ez általában működik, de a fenti példában egyértelmű, hogy az alacsonyabb szólamok alapértelmezetten nem jól helyezkednek el. Jelenleg még nem vagyunk készen rá, hogy ezt kijavítsuk, úgyhogy most ezt érintetlenül hagyjuk és visszatérünk rá egy későbbi fejezetben -- lásd  @code{force-hshift} tulajdonság az @ref{Egymást átfedő jelek javítása} fejezetben.
845
846
847 @seealso
848 Notation Reference: @ruser{Multiple voices}.
849
850
851 @node Szólamok kézi létrehozása
852 @subsection Szólamok kézi létrehozása
853 @translationof Explicitly instantiating voices
854
855
856 @funindex \voiceOne
857 @funindex voiceOne
858 @funindex \voiceTwo
859 @funindex voiceTwo
860 @funindex \voiceThree
861 @funindex voiceThree
862 @funindex \voiceFour
863 @funindex voiceFour
864 @funindex \oneVoice
865 @funindex oneVoice
866 @funindex \new Voice
867 @cindex voice contexts, creating
868
869 A @code{<< >>} blokkon belül is létrehozhatunk polifón zenét és ha szükséges, 
870 a  @code{\voiceOne} ... @code{\voiceFour} parancsokkal jelezhetjük a szárak, ívek, stb irányát. 
871 Hosszabb kották esetén ez a módszer átláthatóbb, mert így külön-külön írhatjuk a szólamokat és beszédesebb neveket is adhatunk nekik. 
872
873 Konkrétan a @code{<< \\ >>}szerkezet, amit az előző fejezetben használtunk:
874
875 @example
876 \new Staff @{
877   \relative c' @{
878     << @{ e4 f g a @} \\ @{ c,4 d e f @} >>
879   @}
880 @}
881 @end example
882
883 @noindent
884 egyenértékű az alábbival:
885
886 @example
887 \new Staff <<
888   \new Voice = "1" @{ \voiceOne \relative c' @{ e4 f g a @} @}
889   \new Voice = "2" @{ \voiceTwo \relative c' @{ c4 d e f @} @}
890 >>
891 @end example
892
893 Mindkét fenti esetben az alábbi kottát kapjuk
894
895 @c The following example should not display the code
896 @lilypond[ragged-right,quote]
897 \new Staff <<
898   \new Voice = "1" { \voiceOne \relative c' { e4 f g a } }
899   \new Voice = "2" { \voiceTwo \relative c' { c4 d e f } }
900 >>
901 @end lilypond
902
903 @cindex voices, reverting to single
904 @cindex reverting to a single voice
905
906
907 A  @code{\voiceXXX} parancs meghatározza a szárak irányát, az 
908 átkötéseket, a kötőíveket, az artikulációt, a szöveges magyarázatokat, 
909 a pontozott hangokat és az ujjrendet.  A @code{\voiceOne} és a @code{\voiceThree} 
910 hatására a mutató elemek felfele mutatnak, míg a @code{\voiceTwo} és a 
911 @code{\voiceFour} esetén lefelé. Ezen parancsok ha szükséges vízszintes 
912 eltolást is létrehoznak minden szólam esetén, hogy elkerüljék a kottafejek 
913 ütközését. A @code{\oneVoice} parancs visszaállítja a beállításokat a normál egyszeres szólamra.
914
915
916 Nézzünk egy egyszerű példát arra, hogy a @code{\oneVoice}, @code{\voiceOne} és @code{\voiceTwo} 
917 parancsok milyen hatással vannak a jelzésekre, ívekre illetve dinamikára:
918
919 @lilypond[quote,ragged-right,verbatim]
920 \relative c'{
921   % Default behavior or behavior after \oneVoice
922   c d8~ d e4( f g a) b-> c
923 }
924 @end lilypond
925
926 @lilypond[quote,ragged-right,verbatim]
927 \relative c'{
928   \voiceOne
929   c d8~ d e4( f g a) b-> c
930   \oneVoice
931   c, d8~ d e4( f g a) b-> c
932 }
933 @end lilypond
934
935 @lilypond[quote,ragged-right,verbatim]
936 \relative c'{
937   \voiceTwo
938   c d8~ d e4( f g a) b-> c
939   \oneVoice
940   c, d8~ d e4( f g a) b-> c
941 }
942 @end lilypond
943
944 Nézzük végig a három különböző lejegyzési módját ugyanannak a polifón dallamnak, 
945 és vizsgáljuk meg melyik milyen esetben előnyös, használva az előző fejezetbeli példát.
946
947
948 A @code{<< >>} közt található kifejezés a főszólamhoz tartozik (jegyezzük meg, hogy a @code{<< >>}  használata során ez @strong{nem} igaz). 
949 Ez akkor hasznos, amikor további szólamok jelennek meg a főszólam mellett. Egy helyesebb megvalósítása a példánknak alább látható. 
950 The red diamond-shaped notes demonstrate that the main melody is now in a single voice context,
951 permitting a phrasing slur to be drawn over them.
952
953 @lilypond[quote,ragged-right,verbatim]
954 \new Staff \relative c' {
955   \voiceOneStyle
956   % The following notes are monophonic
957   c16^( d e f
958   % Start simultaneous section of three voices
959   <<
960     % Continue the main voice in parallel
961     { g4 f e | d2 e2) | }
962     % Initiate second voice
963     \new Voice {
964       % Set stems, etc., down
965       \voiceTwo
966       r8 e4 d c8~ | c8 b16 a b8 g~ g2 |
967     }
968     % Initiate third voice
969     \new Voice {
970       % Set stems, etc, up
971       \voiceThree
972       s2. | s4 b4 c2 |
973     }
974   >>
975 }
976 @end lilypond
977
978 @cindex nesting music expressions
979 @cindex nesting simultaneous constructs
980 @cindex nesting voices
981 @cindex voices, temporary
982 @cindex voices, nesting
983
984 Létrehozhatunk többszörösen beágyazott polifón szerkezetet is, és ha a szólamok rövidek, az alábbi módon természetesebbnek tűnik a leírásuk:
985
986 @lilypond[quote,ragged-right,verbatim]
987 \new Staff \relative c' {
988   c16^( d e f
989   <<
990     { g4 f e | d2 e2) | }
991     \new Voice {
992       \voiceTwo
993       r8 e4 d c8~
994       <<
995         { c8 b16 a b8 g~ g2 }
996         \new Voice {
997           \voiceThree
998           s4 b4 c2
999         }
1000       >>
1001     }
1002   >>
1003 }
1004 @end lilypond
1005
1006 @cindex spacing notes
1007
1008 A szólamokat akkor érdemes így írni, ha a zene csak egy kis része polifón. Viszont amikor az egész ötvonalas kotta nagyrésze polifón, egyszerűbb, ha többszörös szólamokat  használunk mindenütt, --  ritkított hangokkal, hogy átlépjük azokat a részeket, ahol a szólamok  üresek. Az alábbi példa ezt mutatja:
1009
1010 @lilypond[quote,ragged-right,verbatim]
1011 \new Staff \relative c' <<
1012   % Initiate first voice
1013   \new Voice {
1014     \voiceOne
1015     c16^( d e f g4 f e | d2 e2) |
1016   }
1017   % Initiate second voice
1018   \new Voice {
1019     % Set stems, etc, down
1020     \voiceTwo
1021     s4 r8 e4 d c8~ | c8 b16 a b8 g~ g2 |
1022   }
1023   % Initiate third voice
1024   \new Voice {
1025     % Set stems, etc, up
1026     \voiceThree
1027     s1 | s4 b4 c2 |
1028   }
1029 >>
1030 @end lilypond
1031
1032 @subsubheading Hangoszlopok
1033
1034 @cindex note column
1035 @cindex note collisions
1036 @cindex collisions, notes
1037 @cindex shift commands
1038 @funindex \shiftOff
1039 @funindex shiftOff
1040 @funindex \shiftOn
1041 @funindex shiftOn
1042 @funindex \shiftOnn
1043 @funindex shiftOnn
1044 @funindex \shiftOnnn
1045 @funindex shiftOnnn
1046
1047
1048 Egymáshoz közel elhelyezkedő, különböző szólamban levő hangok esetén 
1049 kettő, esetenként több oszlopba rendezzük a hangokat, hogy a kottafejek 
1050 fedését elkerüljük. Ezeket hangoszlopoknak hívjuk. Különálló oszlopokat 
1051 hozunk létre minden szólamhoz és az éppen aktuális szólam-független eltolást 
1052 minden oszlopra alkalmazzuk, ezzel elkerülve az ütközéseket. A fenti példában 
1053 is ezt láthatjuk. A 2. ütemben a C a kettes szólamban eltolódik a D-tól jobbra 
1054 (ami az első szólamban van) és a végső C akkord a hármas szólamban szintén eltolódik jobbra a többi hangtól. 
1055
1056 A @code{\shiftOn}, @code{\shiftOnn}, @code{\shiftOnnn}, és
1057 @code{\shiftOff} parancsok meghatározzák, hogy melyik hangot vagy akkordot milyen mértékben kell megemelnünk ahhoz, hogy az ütközést elkerüljük. Alapértelmezett esetben, a külső szólamokban (az egyes és a kettes szólamban) a  @code{\shiftOff} érvényes, amíg a köztes szólamokban (hármas és négyes) a  @code{\shiftOn}. Eltolás esetén az egyes és a hármas szólam jobbra a kettes és a négyes balra tolódik
1058
1059
1060 A @code{\shiftOnn} és @code{\shiftOnnn} további eltolási szinteket 
1061 határoznak meg, melyek összetett esetekben ideiglenesen szükségesek 
1062 lehetnek ahhoz, hogy elkerüljük az ütközéseket – lásd @ref{Valós zenei példa}. 
1063
1064 Egy hangoszlop egyszerre csak egy hangot (vagy akkordot) tartalmazhat egy szólamból 
1065 szárral felfelé és egy másikat szárral lefelé. Ha két különböző szólambeli hang 
1066 azonos irányú szárral kerül ugyanabba a pozícióba és egyik szólamban sincs eltolás 
1067 vagy ugyanazt az eltolást adjuk meg, akkor a @qq{Too many clashing note columns} hibaüzenetet kapjuk.
1068
1069
1070 @seealso
1071 Notation Reference: @ruser{Multiple voices}.
1072
1073
1074 @node Szólamok és vokális zene
1075 @subsection Szólamok és vokális zene
1076 @translationof Voices and vocals
1077
1078 Vocal music presents a special difficulty: we need to combine two
1079 expressions -- notes and lyrics.
1080
1081 @funindex \new Lyrics
1082 @funindex \lyricsto
1083 @funindex lyricsto
1084 @funindex Lyrics
1085 @cindex Lyrics context, creating
1086 @cindex lyrics, linking to voice
1087
1088 You have already seen the @code{\addlyrics@{@}} command, which
1089 handles simple scores well.  However, this technique is
1090 quite limited.  For more complex music, you must introduce the
1091 lyrics in a @code{Lyrics} context using @code{\new Lyrics} and
1092 explicitly link
1093 the lyrics to the notes with @code{\lyricsto@{@}}, using the
1094 name assigned to the Voice.
1095
1096 @lilypond[quote,verbatim,fragment]
1097 <<
1098   \new Voice = "one" \relative c'' {
1099     \autoBeamOff
1100     \time 2/4
1101     c4 b8. a16 g4. f8 e4 d c2
1102   }
1103   \new Lyrics \lyricsto "one" {
1104     No more let sins and sor -- rows grow.
1105   }
1106 >>
1107 @end lilypond
1108
1109 Note that the lyrics must be linked to a @code{Voice} context,
1110 @emph{not} a @code{Staff} context.  This is a case where it is
1111 necessary to create @code{Staff} and @code{Voice} contexts
1112 explicitly.
1113
1114 @cindex lyrics and beaming
1115 @cindex beaming and lyrics
1116 @funindex \autoBeamOff
1117 @funindex autoBeamOff
1118
1119 The automatic beaming which LilyPond uses by default works well
1120 for instrumental music, but not so well for music with lyrics,
1121 where beaming is either not required at all or is used to indicate
1122 melismata in the lyrics.  In the example above we use the command
1123 @code{\autoBeamOff} to turn off the automatic beaming.
1124
1125 @funindex \new ChoirStaff
1126 @funindex ChoirStaff
1127 @funindex \lyricmode
1128 @funindex lyricmode
1129 @cindex vocal score structure
1130 @cindex choir staff
1131
1132 Let us reuse the earlier example from Judas Maccabæus to
1133 illustrate this more flexible technique.  We first recast
1134 it to use variables so the music and lyrics can be separated
1135 from the staff structure.  We also introduce a ChoirStaff
1136 bracket.  The lyrics themselves must be introduced with
1137 @code{\lyricmode} to ensure they are interpreted as lyrics
1138 rather than music.
1139
1140 @lilypond[quote,verbatim]
1141 global = { \time 6/8 \partial 8 \key f \major}
1142 SopOneMusic = \relative c'' {
1143   c8 | c([ bes)] a a([ g)] f | f'4. b, | c4.~ 4 | }
1144 SopTwoMusic = \relative c' {
1145   r8 | r4. r4 c8 | a'([ g)] f f([ e)] d | e([ d)] c bes' | }
1146 SopOneLyrics = \lyricmode {
1147   Let | flee -- cy flocks the | hills a -- dorn, __ | }
1148 SopTwoLyrics = \lyricmode {
1149   Let | flee -- cy flocks the | hills a -- dorn, | }
1150
1151 \score {
1152   \new ChoirStaff <<
1153     \new Staff <<
1154       \new Voice = "SopOne" {
1155         \global
1156         \SopOneMusic
1157       }
1158       \new Lyrics \lyricsto "SopOne" {
1159         \SopOneLyrics
1160       }
1161     >>
1162     \new Staff <<
1163       \new Voice = "SopTwo" {
1164         \global
1165         \SopTwoMusic
1166       }
1167       \new Lyrics \lyricsto "SopTwo" {
1168         \SopTwoLyrics
1169       }
1170     >>
1171   >>
1172 }
1173 @end lilypond
1174
1175 This is the basic structure of all vocal scores.  More staves may be
1176 added as required, more voices may be added to the staves, more verses
1177 may be added to the lyrics, and the variables containing the music can
1178 easily be placed in separate files should they become too long.
1179
1180 @cindex hymn structure
1181 @cindex SATB structure
1182 @cindex vocal scores with multiple verses
1183 @cindex multiple vocal verses
1184 @cindex verses, multiple vocal
1185
1186 Here is an example of the first line of a hymn with four
1187 verses, set for SATB.  In this case the words for all four
1188 parts are the same.  Note how we use variables to separate the
1189 music notation and words from the staff structure.  See too
1190 how a variable, which we have chosen to call @q{TimeKey}, is used
1191 to hold several commands for use within the two staves.  In other
1192 examples this is often called @q{global}.
1193
1194 @lilypond[quote,verbatim]
1195 TimeKey = { \time 4/4 \partial 4 \key c \major}
1196 SopMusic   = \relative c' { c4 | e4. e8 g4  g  | a a g | }
1197 AltoMusic  = \relative c' { c4 | c4. c8 e4  e  | f f e | }
1198 TenorMusic = \relative c  { e4 | g4. g8 c4. b8 | a8 b c d e4 | }
1199 BassMusic  = \relative c  { c4 | c4. c8 c4  c  | f8 g a b c4 | }
1200 VerseOne   = \lyricmode {
1201   E -- | ter -- nal fa -- ther, | strong to save, | }
1202 VerseTwo   = \lyricmode {
1203   O | Christ, whose voice the | wa -- ters heard, | }
1204 VerseThree = \lyricmode {
1205   O | Ho -- ly Spi -- rit, | who didst brood | }
1206 VerseFour  = \lyricmode {
1207   O | Tri -- ni -- ty of | love and pow'r | }
1208
1209 \score {
1210   \new ChoirStaff <<
1211     \new Staff <<
1212       \clef "treble"
1213       \new Voice = "Sop"  { \voiceOne \TimeKey \SopMusic }
1214       \new Voice = "Alto" { \voiceTwo \AltoMusic }
1215       \new Lyrics \lyricsto "Sop" { \VerseOne   }
1216       \new Lyrics \lyricsto "Sop" { \VerseTwo   }
1217       \new Lyrics \lyricsto "Sop" { \VerseThree }
1218       \new Lyrics \lyricsto "Sop" { \VerseFour  }
1219     >>
1220     \new Staff <<
1221       \clef "bass"
1222       \new Voice = "Tenor" { \voiceOne \TimeKey \TenorMusic }
1223       \new Voice = "Bass"  { \voiceTwo \BassMusic }
1224     >>
1225   >>
1226 }
1227 @end lilypond
1228
1229 @cindex verse and refrain
1230
1231 We end with an example to show how we might code a solo verse which
1232 continues into a two-part refrain in two staves.  The positioning
1233 of the sequential and simultaneous sections to achieve this within
1234 a single score is quite tricky, so follow the explanation carefully!
1235
1236 Let's start with a score block containing a @code{ChoirStaff}, as
1237 we would like the brace to appear at the start of the chorus.
1238 Normally you would need angle brackets after @code{\new ChoirStaff}
1239 to bring in all the staves in parallel, but here we want to
1240 defer the parallelism during the solo so we use braces, although
1241 angle brackets here wouldn't hurt.  Inside the @code{ChoirStaff} we
1242 want first the staff which will contain the verse.  This must
1243 contain notes and lyrics in parallel, so here we need angle
1244 brackets around the @code{\new Voice} and @code{\new Lyrics} to
1245 start them at the same time:
1246
1247 @lilypond[quote,verbatim,ragged-right]
1248 versenotes = \relative c'' {
1249   \clef "treble"
1250   \key g \major
1251   \time 3/4
1252   g g g | b b b |
1253 }
1254 versewords = \lyricmode {
1255   One two three four five six
1256 }
1257 \score {
1258   \new ChoirStaff {
1259     \new Staff <<
1260       \new Voice = "verse" {
1261         \versenotes \break
1262       }
1263       \new Lyrics \lyricsto verse {
1264         \versewords
1265       }
1266     >>
1267   }
1268 }
1269 @end lilypond
1270
1271 That gives the verse line.
1272
1273 Now we want to continue with refrainA on the same staff while a
1274 second staff is introduced in parallel with it for refrainB, so
1275 this is a parallel section which must be positioned immediately
1276 following the @code{\break} in the verse Voice.  Yes, @emph{within}
1277 the verse Voice!  Here's that parallel section.  More staves
1278 could be introduced here in the same way.
1279
1280 @example
1281 <<
1282   \refrainnotesA
1283   \new Lyrics \lyricsto verse @{
1284     \refrainwordsA
1285   @}
1286   \new Staff <<
1287     \new Voice = "refrainB" @{
1288       \refrainnotesB
1289     @}
1290     \new Lyrics \lyricsto "refrainB" @{
1291       \refrainwordsB
1292     @}
1293   >>
1294 >>
1295 @end example
1296
1297 Here's the final result with two staves in the chorus showing
1298 how the parallel section is positioned within the verse Voice:
1299
1300 @lilypond[quote,verbatim, ragged-right]
1301 versenotes = \relative c'' {
1302   \clef "treble"
1303   \key g \major
1304   \time 3/4
1305   g g g | b b b |
1306 }
1307 refrainnotesA = \relative c'' {
1308   \time 2/4
1309   c c | g g \bar "|."
1310 }
1311 refrainnotesB = \relative c {
1312   \clef "bass"
1313   \key g \major
1314   c e | d d |
1315 }
1316 versewords = \lyricmode {
1317   One two three four five six
1318 }
1319 refrainwordsA = \lyricmode {
1320   la la la la
1321 }
1322 refrainwordsB = \lyricmode {
1323   dum dum dum dum
1324 }
1325 \score {
1326   \new ChoirStaff {
1327     \new Staff <<
1328       \new Voice = "verse" {
1329         \versenotes \break
1330         <<
1331           \refrainnotesA
1332           \new Lyrics \lyricsto "verse" {
1333             \refrainwordsA
1334           }
1335           \new Staff <<
1336             \new Voice = "refrainB" {
1337               \refrainnotesB
1338             }
1339             \new Lyrics \lyricsto "refrainB" {
1340               \refrainwordsB
1341             }
1342           >>
1343         >>
1344       }
1345       \new Lyrics \lyricsto "verse" {
1346         \versewords
1347       }
1348     >>
1349   }
1350 }
1351 @end lilypond
1352
1353 @cindex book, example of using
1354 @funindex \book
1355 @funindex book
1356
1357 However, although this is an interesting and useful exercise to
1358 help you to understand how sequential and simultaneous blocks work,
1359 in practice one would perhaps choose to code this as two
1360 @code{\score} blocks within an implicit @code{\book} block, as
1361 follows:
1362
1363 @lilypond[quote,verbatim,ragged-right]
1364 versenotes = \relative c'' {
1365   \clef "treble"
1366   \key g \major
1367   \time 3/4
1368   g g g | b b b |
1369 }
1370 refrainnotesA = \relative c'' {
1371   \time 2/4
1372   c c | g g \bar "|."
1373 }
1374 refrainnotesB = \relative c {
1375   \clef "bass"
1376   \key g \major
1377   c e | d d |
1378 }
1379 versewords = \lyricmode {
1380   One two three four five six
1381 }
1382 refrainwordsA = \lyricmode {
1383   la la la la
1384 }
1385 refrainwordsB = \lyricmode {
1386   dum dum dum dum
1387 }
1388 \score {
1389   \new Staff <<
1390     \new Voice = "verse" {
1391       \versenotes
1392     }
1393     \new Lyrics \lyricsto "verse" {
1394       \versewords
1395     }
1396   >>
1397 }
1398
1399 \score {
1400   \new ChoirStaff <<
1401     \new Staff <<
1402       \new Voice = "refrainA" {
1403         \refrainnotesA
1404       }
1405       \new Lyrics \lyricsto "refrainA" {
1406         \refrainwordsA
1407       }
1408     >>
1409     \new Staff <<
1410       \new Voice = "refrainB" {
1411         \refrainnotesB
1412       }
1413       \new Lyrics \lyricsto "refrainB" {
1414         \refrainwordsB
1415       }
1416     >>
1417   >>
1418 }
1419 @end lilypond
1420
1421
1422 @seealso
1423 Notation Reference: @ruser{Vocal music}.
1424
1425
1426 @node Kontextusok és ábrázolók
1427 @section Kontextusok és ábrázolók
1428 @translationof Contexts and engravers
1429
1430
1431 Kontextusok és ábrázolók have been mentioned informally
1432 in earlier sections; we now must look at
1433 these concepts in more detail, as they are important
1434 in the fine-tuning of LilyPond output.
1435
1436
1437 @menu
1438 * A kontextus fogalma::
1439 * Kontextusok létrehozása::
1440 * Az ábrázoló fogalma::
1441 * Kontextusok tulajdonságainak módosítása::
1442 * Ábrázolók hozzáadása és eltávolítása::
1443 @end menu
1444
1445 @node A kontextus fogalma
1446 @subsection A kontextus fogalma
1447 @translationof Contexts explained
1448
1449 @cindex contexts explained
1450
1451 When music is printed, many notational elements which do not
1452 appear explicitly in the input file must be added to the
1453 output.  For example, compare the input and output of the
1454 following example:
1455
1456 @lilypond[quote,verbatim,relative=2,fragment]
1457 cis4 cis2. g4
1458 @end lilypond
1459
1460 The input is rather sparse, but in the output, bar lines,
1461 accidentals, clef, and time signature have been added.  When
1462 LilyPond @emph{interprets} the input the musical information
1463 is parsed from left to right, similar to the way a performer
1464 reads the score.  While reading the input, the program remembers
1465 where measure boundaries are, and which pitches require explicit
1466 accidentals.  This information must be held on several levels.
1467 For example, an accidental affects only a single staff, while
1468 a bar line must be synchronized across the entire score.
1469
1470 Within LilyPond, these rules and bits of information are grouped in
1471 @emph{Contexts}.  We have already introduced the @code{Voice} context.
1472 Others are the @code{Staff} and @code{Score} contexts.  Contexts are
1473 hierarchical to reflect the hierarchical nature of a musical score.
1474 For example: a @code{Staff} context can contain many @code{Voice}
1475 contexts, and a @code{Score} context can contain many @code{Staff}
1476 contexts.
1477
1478 @quotation
1479 @sourceimage{context-example,5cm,,}
1480 @end quotation
1481
1482 Each context has the responsibility for enforcing some notation rules,
1483 creating some notation objects and maintaining the associated
1484 properties.  For example, the @code{Voice} context may introduce an
1485 accidental and then the @code{Staff} context maintains the rule to
1486 show or suppress the accidental for the remainder of the measure.
1487
1488 As another example, the synchronization of bar lines is, by default,
1489 handled in the @code{Score} context.
1490 However, in some music we may not want the bar lines to be
1491 synchronized -- consider a polymetric score in 4/4 and 3/4 time.
1492 In such cases, we must modify the default settings of the
1493 @code{Score} and @code{Staff} contexts.
1494
1495 For very simple scores, contexts are created implicitly, and you need
1496 not be aware of them.  For larger pieces, such as anything with more
1497 than one staff, they must be
1498 created explicitly to make sure that you get as many staves as you
1499 need, and that they are in the correct order.  For typesetting pieces
1500 with specialized notation, it is usual to modify existing, or
1501 even to define totally new, contexts.
1502
1503 In addition to the @code{Score,} @code{Staff} and
1504 @code{Voice} contexts there are contexts which fit between
1505 the score and staff levels to control staff groups, such as the
1506 @code{PianoStaff} and @code{ChoirStaff} contexts.  There
1507 are also alternative staff and voice contexts, and contexts for
1508 lyrics, percussion, fret boards, figured bass, etc.
1509
1510 The names of all context types are formed from one or more
1511 words, each word being capitalized and joined immediately to the
1512 preceding word with no hyphen or underscore, e.g.,
1513 @code{GregorianTranscriptionStaff}.
1514
1515
1516 @seealso
1517 Notation Reference: @ruser{A kontextus fogalma}.
1518
1519
1520 @node Kontextusok létrehozása
1521 @subsection Kontextusok létrehozása
1522 @translationof Creating contexts
1523
1524
1525 @funindex \new
1526 @funindex new
1527 @cindex new contexts
1528 @cindex creating contexts
1529 @cindex contexts, creating
1530
1531 In an input file a score block, introduced with a @code{\score}
1532 command, contains a single music expression and an associated
1533 output definition (either a @code{\layout} or a @code{\midi} block).
1534 The @code{Score} context is usually left to be created automatically
1535 when the interpretation of that music expression starts.
1536
1537 For scores with only one voice and one staff, the @code{Voice} and
1538 @code{Staff} contexts may also be left to be created automatically,
1539 but for more complex scores it is necessary to create them by hand.
1540 The simplest command that does this is @code{\new}.  It is prepended
1541 to a music expression, for example
1542
1543 @example
1544 \new @var{type} @var{music-expression}
1545 @end example
1546
1547 @noindent
1548 where @var{type} is a context name (like @code{Staff} or
1549 @code{Voice}).  This command creates a new context, and starts
1550 interpreting the @var{music-expression} within that context.
1551
1552 (Note that a @code{\new Score} command is not normally required,
1553 as the essential top-level @code{Score} context is created
1554 automatically when the music expression within the @code{\score}
1555 block is interpreted.  The only reason for creating a @code{Score}
1556 context explicitly using @code{\new Score} is to introduce a
1557 @code{\with} block in which one or more score-wide default values
1558 of context properties may be specified.  Information on using
1559 @code{\with} blocks can be found under the heading
1560 @qq{Setting context properties with @code{\\with} } in
1561 @ref{Kontextusok tulajdonságainak módosítása}.)
1562
1563 You have seen many practical examples which created new
1564 @code{Staff} and @code{Voice} contexts in earlier sections, but
1565 to remind you how these commands are used in practice, here's an
1566 annotated real-music example:
1567
1568 @lilypond[quote,verbatim,ragged-right]
1569 \score {  % start of single compound music expression
1570   <<  % start of simultaneous staves section
1571     \time 2/4
1572     \new Staff {  % create RH staff
1573       \key g \minor
1574       \clef "treble"
1575       \new Voice {  % create voice for RH notes
1576         \relative c'' {  % start of RH notes
1577           d4 ees16 c8.
1578           d4 ees16 c8.
1579         }  % end of RH notes
1580       }  % end of RH voice
1581     }  % end of RH staff
1582     \new Staff <<  % create LH staff; needs two simultaneous voices
1583       \key g \minor
1584       \clef "bass"
1585       \new Voice {  % create LH voice one
1586         \voiceOne
1587         \relative g {  % start of LH voice one notes
1588           g8 <bes d> ees, <g c>
1589           g8 <bes d> ees, <g c>
1590         }  % end of LH voice one notes
1591       }  % end of LH voice one
1592       \new Voice {  % create LH voice two
1593         \voiceTwo
1594         \relative g {  % start of LH voice two notes
1595           g4 ees
1596           g4 ees
1597         }  % end of LH voice two notes
1598       }  % end of LH voice two
1599     >>  % end of LH staff
1600   >>  % end of simultaneous staves section
1601 }  % end of single compound music expression
1602 @end lilypond
1603
1604 (Note how all the statements which open a block with either a
1605 curly bracket, @code{@{}, or double angle brackets, @code{<<},
1606 are indented by two further spaces, and the corresponding
1607 closing bracket is indented by exactly the same amount.  While
1608 this is not required, following this practice will greatly
1609 reduce the number of @q{unmatched bracket} errors, and is
1610 strongly recommended.  It enables the structure of the music to
1611 be seen at a glance, and any unmatched brackets will be obvious.
1612 Note too how the LH staff is created using double angle brackets
1613 because it requires two voices for its music, whereas the RH staff
1614 is created with a single music expression surrounded by curly
1615 brackets because it requires only one voice.)
1616
1617 @cindex contexts, naming
1618 @cindex naming contexts
1619
1620 The @code{\new} command may also give an identifying name to the
1621 context to distinguish it from other contexts of the same type,
1622
1623 @example
1624 \new @var{type} = @var{id} @var{music-expression}
1625 @end example
1626
1627 Note the distinction between the name of the context type,
1628 @code{Staff}, @code{Voice}, etc, and the identifying name of a
1629 particular instance of that type, which can be any sequence of letters
1630 invented by the user.  Digits and spaces can also be used in the
1631 identifying name, but then it has to be placed in quotes,
1632 i.e. @code{\new Staff = "MyStaff 1" @var{music-expression}}.
1633 The identifying name is used to
1634 refer back to that particular instance of a context.  We saw this in
1635 use in the section on lyrics, see @ref{Szólamok és vokális zene}.
1636
1637
1638 @seealso
1639 Notation Reference: @ruser{Kontextusok létrehozása}.
1640
1641
1642 @node Az ábrázoló fogalma
1643 @subsection Az ábrázoló fogalma
1644 @translationof Engravers explained
1645
1646 @cindex engravers
1647
1648 Every mark on the printed output of a score produced by LilyPond
1649 is produced by an @code{Engraver}.  Thus there is an engraver
1650 to print staves, one to print note heads, one for stems, one for
1651 beams, etc, etc.  In total there are over 120 such engravers!
1652 Fortunately, for most scores it is not necessary to know about
1653 more than a few, and for simple scores you do not need to know
1654 about any.
1655
1656 Engravers live and operate in Contexts.  Engravers such as the
1657 @code{Metronome_mark_engraver}, whose action and output apply to the
1658 score as a whole, operate in the highest level context -- the
1659 @code{Score} context.
1660
1661 The @code{Clef_engraver} and @code{Key_engraver} are to be
1662 found in every @code{Staff} Context, as different staves may require
1663 different clefs and keys.
1664
1665 The @code{Note_heads_engraver} and @code{Stem_engraver} live
1666 in every @code{Voice} context, the lowest level context of all.
1667
1668 Each engraver processes the particular objects associated
1669 with its function, and maintains the properties that relate
1670 to that function.  These properties, like the properties
1671 associated with contexts, may be modified to change the
1672 operation of the engraver or the appearance of those elements
1673 in the printed score.
1674
1675 Engravers all have compound names formed from words which
1676 describe their function.  Just the first word is capitalized,
1677 and the remainder are joined to it with underscores.  Thus
1678 the @code{Staff_symbol_engraver} is responsible for creating the
1679 lines of the staff, the @code{Clef_engraver} determines and sets
1680 the pitch reference point on the staff by drawing a clef symbol.
1681
1682 Here are some of the most common engravers together with their
1683 function.  You will see it is usually easy to guess the function
1684 from the name, or vice versa.
1685
1686 @multitable @columnfractions .3 .7
1687 @headitem Engraver
1688   @tab Function
1689 @item Accidental_engraver
1690   @tab Makes accidentals, cautionary and suggested accidentals
1691 @item Beam_engraver
1692   @tab Engraves beams
1693 @item Clef_engraver
1694   @tab Engraves clefs
1695 @item Completion_heads_engraver
1696   @tab Splits notes which cross bar lines
1697 @item Dynamic_engraver
1698   @tab Creates hairpins and dynamic texts
1699 @item Forbid_line_break_engraver
1700   @tab Prevents line breaks if a musical element is still active
1701 @item Key_engraver
1702   @tab Creates the key signature
1703 @item Metronome_mark_engraver
1704   @tab Engraves metronome marking
1705 @item Note_heads_engraver
1706   @tab Engraves note heads
1707 @item Rest_engraver
1708   @tab Engraves rests
1709 @item Staff_symbol_engraver
1710   @tab Engraves the five (by default) lines of the staff
1711 @item Stem_engraver
1712   @tab Creates stems and single-stem tremolos
1713 @item Time_signature_engraver
1714   @tab Creates time signatures
1715 @end multitable
1716
1717 @smallspace
1718
1719 We shall see later how the output of LilyPond can be changed
1720 by modifying the action of Engravers.
1721
1722
1723 @seealso
1724 Internals reference: @rinternals{Engravers and Performers}.
1725
1726
1727 @node Kontextusok tulajdonságainak módosítása
1728 @subsection Kontextusok tulajdonságainak módosítása
1729 @translationof Modifying context properties
1730
1731 @cindex context properties
1732 @cindex context properties, modifying
1733 @cindex modifying context properties
1734 @funindex \set
1735 @funindex set
1736 @funindex \unset
1737 @funindex unset
1738
1739 Contexts are responsible for holding the values of a number of
1740 context @emph{properties}.  Many of them can be changed to
1741 influence the interpretation of the input and so change the
1742 appearance of the output.  They are changed by the
1743 @code{\set} command.  This takes the form
1744
1745 @example
1746 \set @emph{ContextName}.@emph{propertyName} = #@emph{value}
1747 @end example
1748
1749 Where the @emph{ContextName} is usually @code{Score},
1750 @code{Staff} or @code{Voice}.  It may be omitted,
1751 in which case the current context (typically @code{Voice}) is assumed.
1752
1753 The names of context properties consist of words joined
1754 together with no hyphens or underscores, all except the
1755 first having a capital letter.  Here are a few examples
1756 of some commonly used ones.  There are many more.
1757
1758 @c attempt to force this onto a new page
1759 @need 50
1760 @multitable @columnfractions .25 .15 .45 .15
1761 @headitem propertyName
1762   @tab Type
1763   @tab Function
1764   @tab Example Value
1765 @item extraNatural
1766   @tab Boolean
1767   @tab If true, set extra natural signs before accidentals
1768   @tab @code{#t}, @code{#f}
1769 @item currentBarNumber
1770   @tab Integer
1771   @tab Set the current bar number
1772   @tab @code{50}
1773 @item doubleSlurs
1774   @tab Boolean
1775   @tab If true, print slurs both above and below notes
1776   @tab @code{#t}, @code{#f}
1777 @item instrumentName
1778   @tab Text
1779   @tab Set the name to be placed at the start of the staff
1780   @tab @code{"Cello I"}
1781 @item fontSize
1782   @tab Real
1783   @tab Increase or decrease the font size
1784   @tab @code{2.4}
1785 @item stanza
1786   @tab Text
1787   @tab Set the text to print before the start of a verse
1788   @tab @code{"2"}
1789 @end multitable
1790
1791 @noindent
1792 where a Boolean is either True (@code{#t}) or False (@code{#f}),
1793 an Integer is a positive whole number, a Real is a positive
1794 or negative decimal number, and text is enclosed in double
1795 apostrophes.  Note the occurrence of hash signs,
1796 (@code{#}), in two different places -- as part of the Boolean
1797 value before the @code{t} or @code{f}, and before @emph{value}
1798 in the @code{\set} statement.  So when a Boolean is being
1799 entered you need to code two hash signs, e.g., @code{##t}.
1800
1801 @cindex properties operating in contexts
1802 @cindex setting properties within contexts
1803
1804 Before we can set any of these properties we need to know
1805 in which context they operate.  Sometimes this is obvious,
1806 but occasionally it can be tricky.  If the wrong context
1807 is specified, no error message is produced, but the expected
1808 action will not take place.  For example, the
1809 @code{instrumentName} clearly lives in the @code{Staff} context, since
1810 it is the staff that is to be named.
1811 In this example the first staff is labeled, but not the second,
1812 because we omitted the context name.
1813
1814 @lilypond[quote,verbatim,ragged-right]
1815 <<
1816   \new Staff \relative c'' {
1817     \set Staff.instrumentName = #"Soprano"
1818     c4 c
1819  }
1820   \new Staff \relative c' {
1821   \set instrumentName = #"Alto"  % Wrong!
1822   d4 d
1823  }
1824 >>
1825 @end lilypond
1826
1827 Remember the default context name is @code{Voice}, so the second
1828 @code{\set} command set the property @code{instrumentName} in the
1829 @code{Voice} context to @qq{Alto}, but as LilyPond does not look
1830 for any such property in the @code{Voice} context, no
1831 further action took place.  This is not an error, and no error
1832 message is logged in the log file.
1833
1834 Similarly, if the property name is mis-spelt no error message is
1835 produced, and clearly the expected action cannot be performed.  In
1836 fact, you can set any (fictitious) @q{property} using any name you
1837 like in any context that exists by using the @code{\set} command.  But
1838 if the name is not known to LilyPond it will not cause any action to
1839 be taken.  Some text editors with special support for LilyPond input
1840 files document property names with bullets when you hover them with
1841 the mouse, like JEdit with LilyPondTool, or highlight unknown property
1842 names differently, like ConTEXT.  If you do not use an editor with
1843 such features, it is recommended to check the property name in the
1844 Internals Reference: see @rinternals{Tunable context properties}, or
1845 @rinternals{Contexts}.
1846
1847 The @code{instrumentName} property will take effect only
1848 if it is set in the @code{Staff} context, but
1849 some properties can be set in more than one context.
1850 For example, the property @code{extraNatural} is by
1851 default set to ##t (true) for all staves.
1852 If it is set to ##f (false) in one particular @code{Staff}
1853 context it applies just to the accidentals on that staff.
1854 If it is set to false in the @code{Score} context
1855 it applies to all staves.
1856
1857 So this turns off extra naturals in one staff:
1858
1859 @lilypond[quote,verbatim,ragged-right]
1860 <<
1861   \new Staff \relative c'' {
1862     ais4 aes
1863   }
1864   \new Staff \relative c'' {
1865     \set Staff.extraNatural = ##f
1866     ais4 aes
1867   }
1868 >>
1869 @end lilypond
1870
1871 @noindent
1872 and this turns them off in all staves:
1873
1874 @lilypond[quote,verbatim,ragged-right]
1875 <<
1876   \new Staff \relative c'' {
1877     ais4 aes
1878   }
1879   \new Staff \relative c'' {
1880     \set Score.extraNatural = ##f
1881     ais4 aes
1882   }
1883 >>
1884 @end lilypond
1885
1886 As another example, if @code{clefTransposition} is set in
1887 the @code{Score} context this immediately changes the value
1888 of the octavation in all current staves and sets a new default
1889 value which will be applied to all staves.
1890
1891 The opposite command, @code{\unset}, effectively removes the
1892 property from the context, which causes most properties to
1893 revert to their default value.  Usually @code{\unset} is not
1894 required as a new @code{\set} command will achieve what is
1895 wanted.
1896
1897 The @code{\set} and @code{\unset} commands can appear anywhere
1898 in the input file and will take effect from the time they are
1899 encountered until the end of the score or until the property is
1900 @code{\set} or @code{\unset} again.  Let's try changing the
1901 font size, which affects the size of the note heads (among
1902 other things) several times.  The change is from the default
1903 value, not the most recently set value.
1904
1905 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
1906 c4
1907 % make note heads smaller
1908 \set fontSize = #-4
1909 d e
1910 % make note heads larger
1911 \set fontSize = #2.5
1912 f g
1913 % return to default size
1914 \unset fontSize
1915 a b
1916 @end lilypond
1917
1918 We have now seen how to set the values of several different types of
1919 property.  Note that integers and numbers are always preceded by a
1920 hash sign, @code{#}, while a true or false value is specified by
1921 @code{##t} and @code{##f}, with two hash signs.  A text property
1922 should be enclosed in double quotation signs, as above, although we
1923 shall see later that text can actually be specified in a much more
1924 general way by using the very powerful @code{\markup} command.
1925
1926 @subsubheading Setting context properties with @code{\with}
1927
1928 @funindex \with
1929 @funindex with
1930 @cindex context properties, setting with \with
1931
1932 The default value of context properties may be set at the time the
1933 context is created.  Sometimes this is a clearer way of setting a
1934 property value if it is to remain fixed for the duration of
1935 the context.  When a context is created with a @code{\new}
1936 command it may be followed immediately by a @code{\with @{ .. @}}
1937 block in which the default property values are set.  For example,
1938 if we wish to suppress the printing of extra naturals for the
1939 duration of a staff we would write:
1940
1941 @example
1942 \new Staff \with @{ extraNatural = ##f @}
1943 @end example
1944
1945 @noindent
1946 like this:
1947
1948 @lilypond[quote,verbatim,ragged-right]
1949 <<
1950   \new Staff
1951   \relative c'' {
1952     gis ges aes ais
1953   }
1954   \new Staff \with { extraNatural = ##f }
1955   \relative c'' {
1956     gis ges aes ais
1957   }
1958 >>
1959 @end lilypond
1960
1961 Or, if the property override is to be applied to all staves
1962 within the score, it may be appended to an explicit
1963 @code{\new Score} command, like this:
1964
1965 @lilypond[quote,verbatim,ragged-right]
1966 \score {
1967   \new Score \with { extraNatural = ##f } <<
1968     \new Staff {
1969       \relative c'' {
1970         gis ges aes ais
1971       }
1972     }
1973     \new Staff {
1974       \relative c'' {
1975         gis ges aes ais
1976       }
1977     }
1978   >>
1979 }
1980 @end lilypond
1981
1982 Properties set in this way may still be changed dynamically using
1983 @code{\set} and returned to the default value set in the
1984 @code{\with} block with @code{\unset}.
1985
1986 @cindex fontSize, default and setting
1987
1988 So if the @code{fontSize} property is set in a @code{\with} clause
1989 it sets the default value of the font size.  If it is later changed
1990 with @code{\set}, this new default value may be restored with the
1991 @code{\unset fontSize} command.
1992
1993 @subsubheading Setting context properties with @code{\context}
1994
1995 @cindex context properties, setting with \context
1996 @funindex \context
1997 @funindex context
1998
1999 The values of context properties may be set in @emph{all} contexts
2000 of a particular type, such as all @code{Staff} contexts, with a single
2001 command.  The context type is identified by using its
2002 type name, like @code{Staff}, prefixed by a back-slash: @code{\Staff}.
2003 The statement which sets the property value is the same as that in a
2004 @code{\with} block, introduced above.  It is placed in a
2005 @code{\context} block within a @code{\layout} block.  Each
2006 @code{\context} block will affect all contexts of the type specified
2007 throughout the @code{\score} or @code{\book} block in which the
2008 @code{\layout} block appears.  Here is a example to show the format:
2009
2010 @lilypond[verbatim,quote]
2011 \score {
2012   \new Staff {
2013     \relative c'' {
2014       cis4 e d ces
2015     }
2016   }
2017   \layout {
2018     \context {
2019       \Staff
2020       extraNatural = ##t
2021     }
2022   }
2023 }
2024 @end lilypond
2025
2026 @noindent
2027 Context properties set in this way may be overridden for particular
2028 instances of contexts by statements in a @code{\with} block, and by
2029 @code{\set} commands embedded in music statements.
2030
2031
2032 @seealso
2033 Notation Reference:
2034 @ruser{Changing context default settings}.
2035 @ruser{The set command}.
2036
2037 Internals Reference:
2038 @rinternals{Contexts},
2039 @rinternals{Tunable context properties}.
2040
2041
2042 @node Ábrázolók hozzáadása és eltávolítása
2043 @subsection Ábrázolók hozzáadása és eltávolítása
2044 @translationof Adding and removing engravers
2045
2046 @cindex engravers, adding
2047 @cindex adding engravers
2048 @cindex engravers, removing
2049 @cindex removing engravers
2050
2051 @funindex \consists
2052 @funindex consists
2053 @funindex \remove
2054 @funindex remove
2055
2056 We have seen that contexts each contain several engravers, each
2057 of which is responsible for producing a particular part of the
2058 output, like bar lines, staves, note heads, stems, etc.  If an
2059 engraver is removed from a context, it can no longer produce its
2060 output.  This is a crude way of modifying the output, but it
2061 can sometimes be useful.
2062
2063 @subsubheading Changing a single context
2064
2065 To remove an engraver from a single context we use the
2066 @code{\with} command placed immediately after the context creation
2067 command, as in the previous section.
2068
2069 As an illustration, let's repeat an example from the previous section
2070 with the staff lines removed.  Remember that the staff lines are
2071 produced by the @code{Staff_symbol_engraver}.
2072
2073 @lilypond[quote,verbatim,ragged-right]
2074 \new Staff \with {
2075   \remove "Staff_symbol_engraver"
2076 }
2077 \relative c' {
2078   c4
2079   \set fontSize = #-4  % make note heads smaller
2080   d e
2081   \set fontSize = #2.5  % make note heads larger
2082   f g
2083   \unset fontSize  % return to default size
2084   a b
2085 }
2086 @end lilypond
2087
2088 @cindex ambitus engraver
2089
2090 Engravers can also be added to individual contexts.
2091 The command to do this is
2092
2093 @code{\consists @var{Engraver_name}},
2094
2095 @noindent
2096 placed inside a @code{\with} block.  Some vocal scores have an ambitus
2097 placed at the beginning of a staff to indicate the range of notes in
2098 that staff -- see @rglos{ambitus}.  The ambitus is produced by the
2099 @code{Ambitus_engraver}, which is not normally included in any
2100 context.  If we add it to the @code{Voice} context, it calculates the
2101 range from that voice only:
2102
2103 @lilypond[quote,verbatim,ragged-right]
2104 \new Staff <<
2105   \new Voice \with {
2106     \consists "Ambitus_engraver"
2107   }
2108   \relative c'' {
2109     \voiceOne
2110     c a b g
2111   }
2112   \new Voice
2113   \relative c' {
2114     \voiceTwo
2115     c e d f
2116   }
2117 >>
2118 @end lilypond
2119
2120 @noindent
2121 but if we add the ambitus engraver to the
2122 @code{Staff} context, it calculates the range from all
2123 the notes in all the voices on that staff:
2124
2125 @lilypond[quote,verbatim,ragged-right]
2126 \new Staff \with {
2127     \consists "Ambitus_engraver"
2128   }
2129   <<
2130   \new Voice
2131   \relative c'' {
2132     \voiceOne
2133     c a b g
2134   }
2135   \new Voice
2136   \relative c' {
2137     \voiceTwo
2138     c e d f
2139   }
2140 >>
2141 @end lilypond
2142
2143 @subsubheading Changing all contexts of the same type
2144
2145 @funindex \layout
2146 @funindex layout
2147
2148 The examples above show how to remove or add engravers to
2149 individual contexts.  It is also possible to remove or add
2150 engravers to every context of a specific type by placing the
2151 commands in the appropriate context in a @code{\layout}
2152 block.  For example, if we wanted to show an ambitus for every
2153 staff in a four-staff score, we could write
2154
2155 @lilypond[quote,verbatim,ragged-right]
2156 \score {
2157   <<
2158     \new Staff <<
2159       \relative c'' {
2160         c a b g
2161       }
2162     >>
2163     \new Staff <<
2164       \relative c' {
2165         c a b g
2166       }
2167     >>
2168     \new Staff <<
2169       \clef "G_8"
2170       \relative c' {
2171         c a b g
2172       }
2173     >>
2174     \new Staff <<
2175       \clef "bass"
2176       \relative c {
2177         c a b g
2178       }
2179     >>
2180   >>
2181   \layout {
2182     \context {
2183       \Staff
2184       \consists "Ambitus_engraver"
2185     }
2186   }
2187 }
2188 @end lilypond
2189
2190 @noindent
2191 The values of context properties may also be set
2192 for all contexts of a particular type by including the
2193 @code{\set} command in a @code{\context} block in the
2194 same way.
2195
2196
2197 @seealso
2198 Notation Reference: @ruser{Modifying context plug-ins},
2199 @ruser{Changing context default settings}.
2200
2201
2202 @node A sablonok kibővítése
2203 @section A sablonok kibővítése
2204 @translationof Extending the templates
2205
2206 You've read the tutorial, you know how to write music, you
2207 understand the fundamental concepts.  But how can you
2208 get the staves that you want?  Well, you can find lots of
2209 templates (see @ref{Templates}) which may give you a start.
2210 But what if you want something that isn't covered there?  Read on.
2211
2212 @menu
2213 * Szoprán és cselló::
2214 * Négyszólamú vegyeskar::
2215 * Kotta létrehozása az alapoktól::
2216 * Kevesebb gépelés változókkal és függvényekkel::
2217 * Partitúra és szólamkották::
2218 @end menu
2219
2220 @node Szoprán és cselló
2221 @subsection Szoprán és cselló
2222 @translationof Soprano and cello
2223
2224 @cindex template, modifying
2225 @cindex modifying templates
2226
2227 Start off with the template that seems closest to what you want to
2228 end up with.  Let's say that you want to write something for
2229 soprano and cello.  In this case, we would start with the
2230 @q{Notes and lyrics} template (for the soprano part).
2231
2232 @example
2233 \version @w{"@version{}"}
2234 melody = \relative c' @{
2235   \clef treble
2236   \key c \major
2237   \time 4/4
2238   a4 b c d
2239 @}
2240
2241 text = \lyricmode @{
2242   Aaa Bee Cee Dee
2243 @}
2244
2245 \score @{
2246   <<
2247     \new Voice = "one" @{
2248       \autoBeamOff
2249       \melody
2250     @}
2251     \new Lyrics \lyricsto "one" \text
2252   >>
2253   \layout @{ @}
2254   \midi @{ @}
2255 @}
2256 @end example
2257
2258 Now we want to add a cello part.  Let's look at the @q{Notes only} example:
2259
2260 @example
2261 \version @w{"@version{}"}
2262 melody = \relative c' @{
2263   \clef treble
2264   \key c \major
2265   \time 4/4
2266   a4 b c d
2267 @}
2268
2269 \score @{
2270   \new Staff \melody
2271   \layout @{ @}
2272   \midi @{ @}
2273 @}
2274 @end example
2275
2276 We don't need two @code{\version} commands.  We'll need the
2277 @code{melody} section.  We don't want two @code{\score} sections
2278 -- if we had two @code{\score}s, we'd get the two parts separately.
2279 We want them together, as a duet.  Within the @code{\score}
2280 section, we don't need two @code{\layout} or @code{\midi}.
2281
2282 If we simply cut and paste the @code{melody} section, we would
2283 end up with two @code{melody} definitions.  This would not generate
2284 an error, but the second one would be used for both melodies.
2285 So let's rename them to make them distinct.  We'll call the
2286 section for the soprano @code{sopranoMusic} and the section for
2287 the cello @code{celloMusic}.  While we're doing this, let's rename
2288 @code{text} to be @code{sopranoLyrics}.  Remember to rename both
2289 instances of all these names -- both the initial definition (the
2290 @code{melody = \relative c' @{ } part) and the name's use (in the
2291 @code{\score} section).
2292
2293 While we're doing this, let's change the cello part's staff --
2294 celli normally use bass clef.  We'll also give the cello some
2295 different notes.
2296
2297 @example
2298 \version @w{"@version{}"}
2299 sopranoMusic = \relative c' @{
2300   \clef treble
2301   \key c \major
2302   \time 4/4
2303   a4 b c d
2304 @}
2305
2306 sopranoLyrics = \lyricmode @{
2307   Aaa Bee Cee Dee
2308 @}
2309
2310 celloMusic = \relative c @{
2311   \clef bass
2312   \key c \major
2313   \time 4/4
2314   d4 g fis8 e d4
2315 @}
2316
2317 \score @{
2318   <<
2319     \new Voice = "one" @{
2320       \autoBeamOff
2321       \sopranoMusic
2322     @}
2323     \new Lyrics \lyricsto "one" \sopranoLyrics
2324   >>
2325   \layout @{ @}
2326   \midi @{ @}
2327 @}
2328 @end example
2329
2330 This is looking promising, but the cello part won't appear in the
2331 score -- we haven't used it in the @code{\score} section.  If we
2332 want the cello part to appear under the soprano part, we need to add
2333
2334 @example
2335 \new Staff \celloMusic
2336 @end example
2337
2338 @noindent
2339 underneath the soprano stuff.  We also need to add @code{<<} and
2340 @code{>>} around the music -- that tells LilyPond that there's
2341 more than one thing (in this case, two @code{Staves}) happening
2342 at once.  The @code{\score} looks like this now:
2343
2344 @c Indentation in this example is deliberately poor
2345 @example
2346 \score @{
2347   <<
2348     <<
2349       \new Voice = "one" @{
2350         \autoBeamOff
2351         \sopranoMusic
2352       @}
2353       \new Lyrics \lyricsto "one" \sopranoLyrics
2354     >>
2355     \new Staff \celloMusic
2356   >>
2357   \layout @{ @}
2358   \midi @{ @}
2359 @}
2360 @end example
2361
2362 @noindent
2363 This looks a bit messy; the indentation is messed up now.  That is
2364 easily fixed.  Here's the complete soprano and cello template.
2365
2366 @lilypond[quote,verbatim,ragged-right,addversion]
2367 sopranoMusic = \relative c' {
2368   \clef treble
2369   \key c \major
2370   \time 4/4
2371   a4 b c d
2372 }
2373
2374 sopranoLyrics = \lyricmode {
2375   Aaa Bee Cee Dee
2376 }
2377
2378 celloMusic = \relative c {
2379   \clef bass
2380   \key c \major
2381   \time 4/4
2382   d4 g fis8 e d4
2383 }
2384
2385 \score {
2386   <<
2387     <<
2388       \new Voice = "one" {
2389         \autoBeamOff
2390         \sopranoMusic
2391       }
2392       \new Lyrics \lyricsto "one" \sopranoLyrics
2393     >>
2394     \new Staff \celloMusic
2395   >>
2396   \layout { }
2397   \midi { }
2398 }
2399 @end lilypond
2400
2401
2402 @seealso
2403 The starting templates can be found in the @q{Templates} appendix,
2404 see @ref{Single staff}.
2405
2406
2407 @node Négyszólamú vegyeskar
2408 @subsection Négyszólamú vegyeskar
2409 @translationof Four-part SATB vocal score
2410
2411 @cindex template, SATB
2412 @cindex SATB template
2413
2414 Most vocal scores of music written for four-part mixed choir
2415 with orchestral accompaniment such as Mendelssohn's Elijah or
2416 Handel's Messiah have the choral music and words on four
2417 staves, one for each of SATB, with a piano reduction of the
2418 orchestral accompaniment underneath.  Here's an example
2419 from Handel's Messiah:
2420
2421 @c The following should appear as music without code
2422 @lilypond[quote,ragged-right]
2423 global = { \key d \major \time 4/4 }
2424 sopranoMusic = \relative c'' {
2425   \clef "treble"
2426   r4 d2 a4 | d4. d8 a2 | cis4 d cis2 |
2427 }
2428 sopranoWords = \lyricmode {
2429   Wor -- thy is the lamb that was slain
2430 }
2431 altoMusic = \relative a' {
2432   \clef "treble"
2433   r4 a2 a4 | fis4. fis8 a2 | g4 fis e2 |
2434 }
2435 altoWords = \sopranoWords
2436 tenorMusic = \relative c' {
2437   \clef "G_8"
2438   r4 fis2 e4 | d4. d8 d2 | e4 a, cis2 |
2439 }
2440 tenorWords = \sopranoWords
2441 bassMusic = \relative c' {
2442   \clef "bass"
2443   r4 d2 cis4 | b4. b8 fis2 | e4 d a'2 |
2444 }
2445 bassWords = \sopranoWords
2446 upper = \relative a' {
2447   \clef "treble"
2448   \global
2449   r4 <a d fis>2 <a e' a>4
2450   <d fis d'>4. <d fis d'>8 <a d a'>2
2451   <g cis g'>4 <a d fis> <a cis e>2
2452 }
2453 lower = \relative c, {
2454   \clef "bass"
2455   \global
2456   <d d'>4 <d d'>2 <cis cis'>4
2457   <b b'>4. <b' b'>8 <fis fis'>2
2458   <e e'>4 <d d'> <a' a'>2
2459 }
2460
2461 \score {
2462   <<  % combine ChoirStaff and PianoStaff in parallel
2463     \new ChoirStaff <<
2464       \new Staff = "sopranos" <<
2465         \set Staff.instrumentName = #"Soprano"
2466         \new Voice = "sopranos" {
2467           \global
2468           \sopranoMusic
2469         }
2470       >>
2471       \new Lyrics \lyricsto "sopranos" {
2472         \sopranoWords
2473       }
2474       \new Staff = "altos" <<
2475         \set Staff.instrumentName = #"Alto"
2476         \new Voice = "altos" {
2477           \global
2478           \altoMusic
2479         }
2480       >>
2481       \new Lyrics \lyricsto "altos" { \altoWords }
2482       \new Staff = "tenors" <<
2483         \set Staff.instrumentName = #"Tenor"
2484         \new Voice = "tenors" {
2485           \global
2486           \tenorMusic
2487         }
2488       >>
2489       \new Lyrics \lyricsto "tenors" { \tenorWords }
2490       \new Staff = "basses" <<
2491         \set Staff.instrumentName = #"Bass"
2492         \new Voice = "basses" {
2493           \global
2494           \bassMusic
2495         }
2496       >>
2497       \new Lyrics \lyricsto "basses" {
2498         \bassWords
2499       }
2500     >>  % end ChoirStaff
2501     \new PianoStaff <<
2502       \set PianoStaff.instrumentName = #"Piano"
2503       \new Staff = "upper" \upper
2504       \new Staff = "lower" \lower
2505     >>
2506   >>
2507 }
2508 @end lilypond
2509
2510 None of the templates provides this layout exactly.  The nearest is
2511 @q{SATB vocal score and automatic piano reduction} -- see @ref{Vocal
2512 ensembles} -- but we need to change the layout and add a piano
2513 accompaniment which is not derived automatically from the vocal parts.
2514 The variables holding the music and words for the vocal parts are
2515 fine, but we shall need to add variables for the piano reduction.
2516
2517 The order in which the contexts appear in the ChoirStaff of the
2518 template do not correspond with the order in the vocal score shown
2519 above.  We need to rearrange them so there are four staves with the
2520 words written directly underneath the notes for each part.  All the
2521 voices should be @code{\voiceOne}, which is the default, so the
2522 @code{\voiceXXX} commands should be removed.  We also need to specify
2523 the tenor clef for the tenors.  The way in which lyrics are specified
2524 in the template has not yet been encountered so we need to use the
2525 method with which we are familiar.  We should also add the names of
2526 each staff.
2527
2528 Doing this gives for our ChoirStaff:
2529
2530 @example
2531     \new ChoirStaff <<
2532       \new Staff = "sopranos" <<
2533         \set Staff.instrumentName = #"Soprano"
2534         \new Voice = "sopranos" @{
2535           \global
2536           \sopranoMusic
2537         @}
2538       >>
2539       \new Lyrics \lyricsto "sopranos" @{
2540         \sopranoWords
2541      @}
2542       \new Staff = "altos" <<
2543         \set Staff.instrumentName = #"Alto"
2544         \new Voice = "altos" @{
2545           \global
2546           \altoMusic
2547         @}
2548       >>
2549       \new Lyrics \lyricsto "altos" @{
2550         \altoWords
2551       @}
2552       \new Staff = "tenors" <<
2553         \set Staff.instrumentName = #"Tenor"
2554         \new Voice = "tenors" @{
2555           \global
2556           \tenorMusic
2557         @}
2558       >>
2559       \new Lyrics \lyricsto "tenors" @{
2560         \tenorWords
2561       @}
2562       \new Staff = "basses" <<
2563         \set Staff.instrumentName = #"Bass"
2564         \new Voice = "basses" @{
2565           \global
2566           \bassMusic
2567         @}
2568       >>
2569       \new Lyrics \lyricsto "basses" @{
2570         \bassWords
2571       @}
2572     >>  % end ChoirStaff
2573 @end example
2574
2575 Next we must work out the piano part.  This is
2576 easy - we just pull out the piano part from the
2577 @q{Solo piano} template:
2578
2579 @example
2580 \new PianoStaff <<
2581   \set PianoStaff.instrumentName = #"Piano  "
2582   \new Staff = "upper" \upper
2583   \new Staff = "lower" \lower
2584 >>
2585 @end example
2586
2587 and add the variable definitions for @code{upper}
2588 and @code{lower}.
2589
2590 The ChoirStaff and PianoStaff must be combined
2591 using angle brackets as we want them to be
2592 stacked one above the other:
2593
2594 @example
2595 <<  % combine ChoirStaff and PianoStaff one above the other
2596   \new ChoirStaff <<
2597     \new Staff = "sopranos" <<
2598       \new Voice = "sopranos" @{
2599         \global
2600         \sopranoMusic
2601       @}
2602     >>
2603     \new Lyrics \lyricsto "sopranos" @{
2604       \sopranoWords
2605      @}
2606     \new Staff = "altos" <<
2607       \new Voice = "altos" @{
2608         \global
2609         \altoMusic
2610       @}
2611     >>
2612     \new Lyrics \lyricsto "altos" @{
2613       \altoWords
2614     @}
2615     \new Staff = "tenors" <<
2616       \clef "G_8"  % tenor clef
2617       \new Voice = "tenors" @{
2618         \global
2619         \tenorMusic
2620       @}
2621     >>
2622     \new Lyrics \lyricsto "tenors" @{
2623       \tenorWords
2624     @}
2625     \new Staff = "basses" <<
2626       \clef "bass"
2627       \new Voice = "basses" @{
2628         \global
2629         \bassMusic
2630       @}
2631     >>
2632     \new Lyrics \lyricsto "basses" @{
2633       \bassWords
2634     @}
2635   >>  % end ChoirStaff
2636
2637   \new PianoStaff <<
2638     \set PianoStaff.instrumentName = #"Piano"
2639     \new Staff = "upper" \upper
2640     \new Staff = "lower" \lower
2641   >>
2642 >>
2643 @end example
2644
2645 Combining all these together and adding the music
2646 for the three bars of the example above gives:
2647
2648 @lilypond[quote,verbatim,ragged-right,addversion]
2649 global = {
2650   \key d \major
2651   \time 4/4
2652 }
2653 sopranoMusic = \relative c'' {
2654   \clef "treble"
2655   r4 d2 a4 | d4. d8 a2 | cis4 d cis2 |
2656 }
2657 sopranoWords = \lyricmode {
2658   Wor -- thy is the lamb that was slain
2659 }
2660 altoMusic = \relative a' {
2661   \clef "treble"
2662   r4 a2 a4 | fis4. fis8 a2 | g4 fis fis2 |
2663 }
2664 altoWords = \sopranoWords
2665 tenorMusic = \relative c' {
2666   \clef "G_8"
2667   r4 fis2 e4 | d4. d8 d2 | e4 a, cis2 |
2668 }
2669 tenorWords = \sopranoWords
2670 bassMusic = \relative c' {
2671   \clef "bass"
2672   r4 d2 cis4 | b4. b8 fis2 | e4 d a'2 |
2673 }
2674 bassWords = \sopranoWords
2675 upper = \relative a' {
2676   \clef "treble"
2677   \global
2678   r4 <a d fis>2 <a e' a>4
2679   <d fis d'>4. <d fis d'>8 <a d a'>2
2680   <g cis g'>4 <a d fis> <a cis e>2
2681 }
2682 lower = \relative c, {
2683   \clef "bass"
2684   \global
2685   <d d'>4 <d d'>2 <cis cis'>4
2686   <b b'>4. <b' b'>8 <fis fis'>2
2687   <e e'>4 <d d'> <a' a'>2
2688 }
2689
2690 \score {
2691   <<  % combine ChoirStaff and PianoStaff in parallel
2692     \new ChoirStaff <<
2693       \new Staff = "sopranos" <<
2694         \set Staff.instrumentName = #"Soprano"
2695         \new Voice = "sopranos" {
2696           \global
2697           \sopranoMusic
2698         }
2699       >>
2700       \new Lyrics \lyricsto "sopranos" {
2701         \sopranoWords
2702       }
2703       \new Staff = "altos" <<
2704         \set Staff.instrumentName = #"Alto"
2705         \new Voice = "altos" {
2706           \global
2707           \altoMusic
2708         }
2709       >>
2710       \new Lyrics \lyricsto "altos" {
2711         \altoWords
2712       }
2713       \new Staff = "tenors" <<
2714         \set Staff.instrumentName = #"Tenor"
2715         \new Voice = "tenors" {
2716           \global
2717           \tenorMusic
2718         }
2719       >>
2720       \new Lyrics \lyricsto "tenors" {
2721         \tenorWords
2722       }
2723       \new Staff = "basses" <<
2724         \set Staff.instrumentName = #"Bass"
2725         \new Voice = "basses" {
2726           \global
2727           \bassMusic
2728         }
2729       >>
2730       \new Lyrics \lyricsto "basses" {
2731         \bassWords
2732       }
2733     >>  % end ChoirStaff
2734
2735     \new PianoStaff <<
2736       \set PianoStaff.instrumentName = #"Piano  "
2737       \new Staff = "upper" \upper
2738       \new Staff = "lower" \lower
2739     >>
2740   >>
2741 }
2742 @end lilypond
2743
2744
2745 @node Kotta létrehozása az alapoktól
2746 @subsection Kotta létrehozása az alapoktól
2747 @translationof Building a score from scratch
2748
2749 @cindex template, writing your own
2750 @cindex example of writing a score
2751 @cindex writing a score, example
2752 @cindex score, example of writing
2753
2754 After gaining some facility with writing LilyPond code, you
2755 may find that it is easier to build a score from scratch
2756 rather than modifying one of the templates.  You can also
2757 develop your own style this way to suit the sort of music you
2758 like.  Let's see how to put together the score for an organ
2759 prelude as an example.
2760
2761 We begin with a header section.  Here go the title, name
2762 of composer, etc, then come any variable definitions, and
2763 finally the score block.  Let's start with these in outline
2764 and fill in the details later.
2765
2766 We'll use the first two bars of Bach's prelude
2767 based on @emph{Jesu, meine Freude} which is written for two
2768 manuals and pedal organ.  You can see these two bars of music
2769 at the bottom of this section.  The top manual part has two voices,
2770 the lower and pedal organ one each.  So we need four
2771 music definitions and one to define the time signature
2772 and key:
2773
2774 @example
2775 \version @w{"@version{}"}
2776 \header @{
2777   title = "Jesu, meine Freude"
2778   composer = "J S Bach"
2779 @}
2780 TimeKey = @{
2781   \time 4/4
2782   \key c \minor
2783 @}
2784 ManualOneVoiceOneMusic = @{ s1 @}
2785 ManualOneVoiceTwoMusic = @{ s1 @}
2786 ManualTwoMusic = @{ s1 @}
2787 PedalOrganMusic = @{ s1 @}
2788
2789 \score @{
2790 @}
2791 @end example
2792
2793 For now we've just used a spacer note, @code{s1},
2794 instead of the real music.  We'll add that later.
2795
2796 Next let's see what should go in the score block.
2797 We simply mirror the staff structure we want.
2798 Organ music is usually written on three staves,
2799 one for each manual and one for the pedals.  The
2800 manual staves should be bracketed together, so we
2801 need to use a PianoStaff for them.  The first
2802 manual part needs two voices and the second manual
2803 part just one.
2804
2805 @example
2806   \new PianoStaff <<
2807     \new Staff = "ManualOne" <<
2808       \new Voice @{
2809         \ManualOneVoiceOneMusic
2810       @}
2811       \new Voice @{
2812         \ManualOneVoiceTwoMusic
2813       @}
2814     >>  % end ManualOne Staff context
2815     \new Staff = "ManualTwo" <<
2816       \new Voice @{
2817         \ManualTwoMusic
2818       @}
2819     >>  % end ManualTwo Staff context
2820   >>  % end PianoStaff context
2821 @end example
2822
2823 Next we need to add a staff for the pedal organ.
2824 This goes underneath the PianoStaff, but it must
2825 be simultaneous with it, so we need angle brackets
2826 around the two.  Missing these out would generate
2827 an error in the log file.  It's a common mistake
2828 which you'll make sooner or later!  Try copying
2829 the final example at the end of this section,
2830 remove these angle brackets, and compile it to
2831 see what errors it generates.
2832
2833 @example
2834 <<  % PianoStaff and Pedal Staff must be simultaneous
2835   \new PianoStaff <<
2836     \new Staff = "ManualOne" <<
2837       \new Voice @{
2838         \ManualOneVoiceOneMusic
2839       @}
2840       \new Voice @{
2841         \ManualOneVoiceTwoMusic
2842       @}
2843     >>  % end ManualOne Staff context
2844     \new Staff = "ManualTwo" <<
2845       \new Voice @{
2846         \ManualTwoMusic
2847       @}
2848     >>  % end ManualTwo Staff context
2849   >>  % end PianoStaff context
2850   \new Staff = "PedalOrgan" <<
2851     \new Voice @{
2852       \PedalOrganMusic
2853     @}
2854   >>
2855 >>
2856 @end example
2857
2858 It is not necessary to use the simultaneous construct
2859 @code{<< .. >>} for the manual two staff and the pedal organ staff,
2860 since they contain only one music expression, but it does no harm,
2861 and always using angle brackets after @code{\new Staff} is a good
2862 habit to cultivate in case there are multiple voices.  The opposite
2863 is true for Voices: these should habitually be followed by braces
2864 @code{@{ .. @}} in case your music is coded in several variables
2865 which need to run consecutively.
2866
2867 Let's add this structure to the score block, and adjust the indenting.
2868 We also add the appropriate clefs, ensure stems, ties and slurs in
2869 each voice on the upper staff point to the right direction with
2870 @code{\voiceOne} and @code{\voiceTwo}, and enter the time signature
2871 and key to each staff using our predefined variable, @code{\TimeKey}.
2872
2873 @example
2874 \score @{
2875   <<  % PianoStaff and Pedal Staff must be simultaneous
2876     \new PianoStaff <<
2877       \new Staff = "ManualOne" <<
2878         \TimeKey  % set time signature and key
2879         \clef "treble"
2880         \new Voice @{
2881           \voiceOne
2882           \ManualOneVoiceOneMusic
2883         @}
2884         \new Voice @{
2885           \voiceTwo
2886           \ManualOneVoiceTwoMusic
2887         @}
2888       >>  % end ManualOne Staff context
2889       \new Staff = "ManualTwo" <<
2890         \TimeKey
2891         \clef "bass"
2892         \new Voice @{
2893           \ManualTwoMusic
2894         @}
2895       >>  % end ManualTwo Staff context
2896     >>  % end PianoStaff context
2897     \new Staff = "PedalOrgan" <<
2898       \TimeKey
2899       \clef "bass"
2900       \new Voice @{
2901         \PedalOrganMusic
2902       @}
2903     >>  % end PedalOrgan Staff
2904   >>
2905 @}  % end Score context
2906 @end example
2907
2908 That completes the structure.  Any three-staff organ music
2909 will have a similar structure, although the number of voices
2910 may vary.  All that remains now
2911 is to add the music, and combine all the parts together.
2912
2913 @lilypond[quote,verbatim,ragged-right,addversion]
2914 \header {
2915   title = "Jesu, meine Freude"
2916   composer = "J S Bach"
2917 }
2918 TimeKey = {
2919   \time 4/4
2920   \key c \minor
2921 }
2922 ManualOneVoiceOneMusic = \relative g' {
2923   g4 g f ees
2924   d2 c2
2925 }
2926 ManualOneVoiceTwoMusic = \relative c' {
2927   ees16 d ees8~ 16 f ees d c8 d~ d c~
2928   c c4 b8 c8. g16 c b c d
2929 }
2930 ManualTwoMusic = \relative c' {
2931   c16 b c8~ 16 b c g a8 g~ 16 g aes ees
2932   f ees f d g aes g f ees d e8~ 8es16 f ees d
2933 }
2934 PedalOrganMusic = \relative c {
2935   r8 c16 d ees d ees8~ 16 a, b g c b c8
2936   r16 g ees f g f g8 c,2
2937 }
2938
2939 \score {
2940   <<  % PianoStaff and Pedal Staff must be simultaneous
2941     \new PianoStaff <<
2942       \new Staff = "ManualOne" <<
2943         \TimeKey  % set time signature and key
2944         \clef "treble"
2945         \new Voice {
2946           \voiceOne
2947           \ManualOneVoiceOneMusic
2948         }
2949         \new Voice {
2950           \voiceTwo
2951           \ManualOneVoiceTwoMusic
2952         }
2953       >>  % end ManualOne Staff context
2954       \new Staff = "ManualTwo" <<
2955         \TimeKey
2956         \clef "bass"
2957         \new Voice {
2958           \ManualTwoMusic
2959         }
2960       >>  % end ManualTwo Staff context
2961     >>  % end PianoStaff context
2962     \new Staff = "PedalOrgan" <<
2963       \TimeKey
2964       \clef "bass"
2965       \new Voice {
2966         \PedalOrganMusic
2967       }
2968     >>  % end PedalOrgan Staff context
2969   >>
2970 }  % end Score context
2971 @end lilypond
2972
2973
2974 @node Kevesebb gépelés változókkal és függvényekkel
2975 @subsection Kevesebb gépelés változókkal és függvényekkel
2976 @translationof Saving typing with variables and functions
2977
2978 @cindex variables
2979 @cindex variables
2980
2981 By this point, you've seen this kind of thing:
2982
2983 @lilypond[quote,verbatim,ragged-right]
2984 hornNotes = \relative c'' { c4 b dis c }
2985 \score {
2986   {
2987     \hornNotes
2988   }
2989 }
2990 @end lilypond
2991
2992 You may even realize that this could be useful in minimalist music:
2993
2994 @lilypond[quote,verbatim,ragged-right]
2995 fragmentA = \relative c'' { a4 a8. b16 }
2996 fragmentB = \relative c'' { a8. gis16 ees4 }
2997 violin = \new Staff {
2998   \fragmentA
2999   \fragmentA
3000   \fragmentB
3001   \fragmentA
3002 }
3003 \score {
3004   {
3005     \violin
3006   }
3007 }
3008 @end lilypond
3009
3010 However, you can also use these variables (also known as
3011 macros, or user-defined commands) for tweaks:
3012
3013 @c TODO Avoid padtext - not needed with skylining
3014 @lilypond[quote,verbatim,ragged-right]
3015 dolce = \markup { \italic \bold dolce }
3016 padText = { \once \override TextScript.padding = #5.0 }
3017 fthenp=_\markup { \dynamic f \italic \small { 2nd } \hspace #0.1 \dynamic p }
3018 violin = \relative c'' {
3019   \repeat volta 2 {
3020     c4._\dolce b8 a8 g a b
3021     \padText
3022     c4.^"hi there!" d8 e' f g d
3023     c,4.\fthenp b8 c4 c-.
3024   }
3025 }
3026 \score {
3027   {
3028     \violin
3029   }
3030 \layout { ragged-right=##t }
3031 }
3032 @end lilypond
3033
3034 These variables are obviously useful for saving
3035 typing.  But they're worth considering even if you
3036 only use them once -- they reduce complexity.  Let's
3037 look at the previous example without any
3038 variables.  It's a lot harder to read, especially
3039 the last line.
3040
3041 @example
3042 violin = \relative c'' @{
3043   \repeat volta 2 @{
3044     c4._\markup @{ \italic \bold dolce @} b8 a8 g a b
3045     \once \override TextScript.padding = #5.0
3046     c4.^"hi there!" d8 e' f g d
3047     c,4.\markup @{ \dynamic f \italic \small @{ 2nd @}
3048       \hspace #0.1 \dynamic p @}
3049     b8 c4 c-.
3050   @}
3051 @}
3052 @end example
3053
3054 @c TODO Replace the following with a better example  -td
3055 @c Skylining handles this correctly without padText
3056
3057 So far we've seen static substitution -- when LilyPond
3058 sees @code{\padText}, it replaces it with the stuff that
3059 we've defined it to be (ie the stuff to the right of
3060 @code{padtext=}).
3061
3062 LilyPond can handle non-static substitution, too (you
3063 can think of these as functions).
3064
3065 @lilypond[quote,verbatim,ragged-right]
3066 padText =
3067 #(define-music-function (parser location padding) (number?)
3068   #{
3069     \once \override TextScript.padding = #padding
3070   #})
3071
3072 \relative c''' {
3073   c4^"piu mosso" b a b
3074   \padText #1.8
3075   c4^"piu mosso" d e f
3076   \padText #2.6
3077   c4^"piu mosso" fis a g
3078 }
3079 @end lilypond
3080
3081 Using variables is also a good way to reduce work if the
3082 LilyPond input syntax changes (see
3083 @rprogram{Updating files with convert-ly}).  If
3084 you have a single definition (such as @code{\dolce}) for all your
3085 input files (see @ref{Style sheets}), then if the syntax changes, you
3086 only need to update your single @code{\dolce} definition,
3087 instead of making changes throughout every @file{.ly} file.
3088
3089
3090 @node Partitúra és szólamkották
3091 @subsection Partitúra és szólamkották
3092 @translationof Scores and parts
3093
3094 In orchestral music, all notes are printed twice.  Once in a part for
3095 the musicians, and once in a full score for the conductor.  Variables can
3096 be used to avoid double work.  The music is entered once, and stored in
3097 a variable.  The contents of that variable is then used to generate
3098 both the part and the full score.
3099
3100 It is convenient to define the notes in a special file.  For example,
3101 suppose that the file @file{horn-music.ly} contains the following part
3102 of a horn/@/bassoon duo
3103
3104 @example
3105 hornNotes = \relative c @{
3106   \time 2/4
3107   r4 f8 a cis4 f e d
3108 @}
3109 @end example
3110
3111 @noindent
3112 Then, an individual part is made by putting the following in a file
3113
3114 @example
3115 \include "horn-music.ly"
3116 \header @{
3117   instrument = "Horn in F"
3118 @}
3119
3120 @{
3121  \transpose f c' \hornNotes
3122 @}
3123 @end example
3124
3125 The line
3126
3127 @example
3128 \include "horn-music.ly"
3129 @end example
3130
3131 @noindent
3132 substitutes the contents of @file{horn-music.ly} at this position in
3133 the file, so @code{hornNotes} is defined afterwards.  The command
3134 @code{\transpose f@tie{}c'} indicates that the argument, being
3135 @code{\hornNotes}, should be transposed by a fifth upwards.  Sounding
3136 @code{f} is denoted by notated @code{c'}, which corresponds with the
3137 tuning of a normal French Horn in@tie{}F.  The transposition can be seen
3138 in the following output
3139
3140 @lilypond[quote,ragged-right]
3141 \transpose f c' \relative c {
3142   \time 2/4
3143   r4 f8 a cis4 f e d
3144 }
3145 @end lilypond
3146
3147 In ensemble pieces, one of the voices often does not play for many
3148 measures.  This is denoted by a special rest, the multi-measure
3149 rest.  It is entered with a capital @code{R} followed by a duration
3150 (@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
3151 etc.).  By multiplying the
3152 duration, longer rests can be constructed.  For example, this rest
3153 takes 3@tie{}measures in 2/4 time
3154
3155 @example
3156 R2*3
3157 @end example
3158
3159 When printing the part, multi-rests
3160 must be condensed.  This is done by setting a run-time variable
3161
3162 @example
3163 \set Score.skipBars = ##t
3164 @end example
3165
3166 @noindent
3167 This command sets the property @code{skipBars} in the
3168 @code{Score} context to true (@code{##t}).  Prepending the rest and
3169 this option to the music above, leads to the following result
3170
3171 @lilypond[quote,ragged-right]
3172 \transpose f c' \relative c {
3173   \time 2/4
3174   \set Score.skipBars = ##t
3175   R2*3
3176   r4 f8 a cis4 f e d
3177 }
3178 @end lilypond
3179
3180
3181 The score is made by combining all of the music together.  Assuming
3182 that the other voice is in @code{bassoonNotes} in the file
3183 @file{bassoon-music.ly}, a score is made with
3184
3185 @example
3186 \include "bassoon-music.ly"
3187 \include "horn-music.ly"
3188
3189 <<
3190   \new Staff \hornNotes
3191   \new Staff \bassoonNotes
3192 >>
3193 @end example
3194
3195 @noindent
3196 leading to
3197
3198 @lilypond[quote,ragged-right]
3199 \relative c <<
3200   \new Staff {
3201     \time 2/4
3202     R2*3
3203     r4 f8 a cis4 f e d
3204   }
3205   \new Staff {
3206     \clef bass
3207     r4 d,8 f | gis4 c | b bes |
3208     a8 e f4 | g d | gis f |
3209   }
3210 >>
3211 @end lilypond