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