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