1 @c -*- coding: utf-8; mode: texinfo; documentlanguage: hu -*-
2 @c This file is part of learning.tely
4 Translation of GIT committish: 48c2b169dc8a9bc2ab2c767cbb83b57cc158742b
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..
11 @c Translators: Griechisch Erika, Harmath Dénes
13 @c -*- coding: utf-8; mode: texinfo; -*-
17 @translationof Fundamental concepts
18 @translationof Fundamental concepts
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.
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::
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
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ó.
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::
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
55 @c index bemeneti formátum
56 @c index fájlstruktúra
58 A LilyPond bemeneti fájlok szerkezetére egy tipikus példa:
61 \version @w{"@version{}"}
66 @var{...összetett zenei kifejezés...} % ide jön a zene!
73 Ennek az alapvető mintának sok változata lehetséges, de ez a példa jó
74 kiindulási alapot jelent.
81 Eddig egyik példa sem használta a @code{\score@{@}} parancsot. Ennek oka, hogy
82 a LilyPond automatikusan hozzáadja az egyszerű bemenethez a szükséges
83 parancsokat. A következő bemenet például:
92 a következő rövidítése:
109 Más szóval, ha a bemenet egyetlen zenei kifejezést tartalmaz, a LilyPond úgy
110 értelmezi a fájlt, mintha a zenei kifejezés körül már szerepelnének a fenti
113 @cindex implicit kontextusok
115 @strong{Figyelem!} A dokumentációban sok példa nem tartalmazza a
116 @code{\new Staff} és @code{\new Voice} parancsokat, így azok implicite kerülnek
117 létrehozásra. Ez egyszerű példáknál jól működik, de bonyolultabb esetekben,
118 főleg, ha más parancsokat is használunk, a kontextusok implicit létrehozása
119 meglepő kimenetet eredményezhet, például nemkívánatos kottasorok jelenlétét.
120 A kontextusok explicit megadásának módja a @ref{Kontextusok és ábrázolók} c.
123 @warning{Többszólamú zeneművek esetén ajánlott explicit módon létrehozni a
124 kottasorokat és az azon belüli szólamokat.}
126 Egyelőre térjünk vissza az első példánkhoz, és vizsgáljuk meg csak a
127 @code{\score} parancsot.
129 A @code{\score} blokkon belül először pontosan egy zenei kifejezésnek kell
131 Emlékezzünk arra, hogy egy zenei kifejezés lehet egy hang is, de akár
132 egy olyan nagy összetett kifejezés is, mint:
137 @var{...egy teljes Wagner-opera zenei anyaga...}
143 Mivel mindez egy @code{@{ ... @}} blokkban szerepel, egy zenei
146 Ahogy korábban láttuk, a @code{\score} blokk a zenén kívül más definíciókat is
147 tartalmazhat, mint például:
166 Ez a három parancs -- @code{\header}, @code{\layout} és @code{\midi} --
167 speciális: az eddigi parancsokkal ellentétben @emph{nem} zenei kifejezések, és
168 nem azok részei. A @code{\score} blokkon belül vagy kívül is elhelyezkedhetnek
169 -- például a @code{\header} (fejléc) blokk, melyben a kotta adatait (pl. cím,
170 szerző stb.) lehet megadni, legtöbbször a @code{\score} parancs előtt szerepel,
171 ahogy a szakasz elején található példában is látható.
173 A két további, még ismeretlen parancs: @code{\layout @{@}} és
174 @code{\midi @{@}}. Ezek ebben a formában rendre azt jelentik, hogy a LilyPond
175 kottaképet, ill. hangzó anyagot állítson elő. Teljes leírásuk a Kottaírás
176 Kézikönyvében található, a @ruser{Score layout} és a
177 @ruser{Creating MIDI files} szakaszokban.
180 @cindex implicit book blokk
183 Egy fájlban több @code{\score} blokk lehet. Mindegyik egy-egy zeneművet
184 vagy tételt jelöl, de ezek egy kimeneti fájlban fognak megjelenni. Nem
185 szükséges @code{\book} blokkba foglalni őket -- ez implicite megtörténik.
186 Ha azonban több kimeneti fájlt szeretnénk kapni egy forrásfájlból, akkor több
187 @code{\book} blokkot kell megadnunk -- kimeneti fájlonként egyet-egyet.
191 Minden @code{\book} blokk külön kimeneti fájlt eredményez (pl. egy-egy PDF
192 állományt). Ha nem szerepel explicit módon a forráskódban, akkor a LilyPond
193 körülveszi az egész forráskódot egy @code{\book} blokkal.
195 Egy @code{\book} blokkon belül minden @code{\score} blokk különálló zenei
198 @cindex layout blokk helye
200 Minden @code{\layout} blokk arra a @code{\score} vagy @code{\book} blokkra
201 érvényes, amelyben szerepel -- tehát egy @code{\score} blokkon belüli
202 @code{\layout} blokk csakis arra az egy @code{\score} blokkra vonatkozik,
203 de egy @code{\score} blokkon kívüli @code{\layout} blokk a @code{\score}
204 blokkot tartalmazó (akár explicit, akár implicit) @code{\book} blokkon belüli
205 minden @code{\score} blokkra érvényes.
207 A részletek a @ruser{Multiple scores in a book} c. részben olvashatók.
211 Fájljainkat áttekinthetőbbé tehetjük változók definiálásával (ld.
212 @ref{Művek szervezettebbé tétele változók segítségével}). Minden sablonban ezt
213 a módszert használjuk:
216 dallam = \relative @{
225 Amikor a LilyPond feldolgozza ezt a fájlt, a @code{dallam} változó értékét
226 (azaz mindent az egyenlőségjel utáni zenei kifejezésből) beszúrja mindenhova,
227 ahol @code{\dallam} hivatkozást lát. A változók nevére nincs sok megkötés -- a
228 következők mind helyes példák: @code{dallam}, @code{jobbkéz}, @code{fuvola},
229 @code{BII} stb. A @ref{Kevesebb gépelés változókkal és függvényekkel} c.
230 szakasz további információkat tartalmaz. Mindössze annyi a korlátozás, hogy a
231 változónevek csak betűket tartalmazhatnak, és nem ütközhetnek a
232 LilyPond parancsok neveivel. A pontos szabályok a @ruser{File structure} c.
233 részben vannak leírva.
236 A bemeneti formátum teljes definíciója a
237 @ruser{File structure} c. szakaszban található.
239 @node A kotta egy összetett zenei kifejezés
240 @subsection A kotta egy összetett zenei kifejezés
241 @translationof Score is a (single) compound musical expression
242 @translationof Score is a (single) compound musical expression
246 @cindex összetett zenei kifejezés
248 Az előző szakaszban (@ref{Bevezetés a LilyPond fájlok szerkezetébe}) már láttuk
249 a LilyPond fájlok általános felépítését. De a legfontosabb részt mintha
250 átugrottuk volna: mi kerüljön a @code{\score} blokk belsejébe?
252 Valójában ez sokkal egyszerűbb, mint gondolnánk. Ez a mondat mindent
256 @emph{A @code{\score} blokknak egy összetett zenei kifejezéssel kell
261 Az összetett zenei kifejezés fogalmát már tisztáztuk
262 @ref{A zenei kifejezés fogalma} c. részben. Láttuk, hogy építhetünk fel nagy
263 zenei kifejezéseket kis részekből -- először hangokból, aztán akkordokból stb.
264 Most egy összetett zenei kifejezést vizsgálunk meg felülről lefelé. Az
265 egyszerűség kedvéért egy zongorakíséretes dal lesz a példánk. Először is
266 szükségünk van az énekes és a zongorista szólamára.
271 \new Staff = "ének" <<
273 \new PianoStaff = "zongora" <<
280 Elneveztük a két szólamot @qq{ének} és @qq{zongora} néven. Ez nem kötelező,
281 de jó szokás, hogy első pillantásra lássuk, melyik szólam mire szolgál.
283 Emlékezzünk arra, hogy @code{<< ... >>} szolgál több szólam jelölésére. Ennek
284 hatására az ének- és a zongoraszólam egymás alatt fog megjelenni a kottában.
285 A zongoraszólam két kottasort fog tartalmazni, az énekszólam pedig egy
286 kottasort és egy dalszöveget, így mindkettőhöz @code{<< ... >>} blokk kell.
287 A dalszöveghez az @code{\addlyrics} parancsot fogjuk használni. Ha szükséges
288 feleleveníteni, az @ref{Egyszerű dalok kottázása} c. részben olvashatunk róla.
290 @lilypond[verbatim,quote,ragged-right]
293 \new Staff = "ének" <<
294 \new Voice = "dallam" { c'1 }
297 \new PianoStaff = "zongora" <<
298 \new Staff = "jobbkéz" { c'1 }
299 \new Staff = "balkéz" { c'1 }
306 Most megvan a teljes struktúra. Az énekszólam egy @code{Voice} kontextust
307 tartalmaz a hangoknak, és egy versszaknyi dalszöveget. A zongoraszólam pedig
308 a jobb- és balkéz kottasorait tartalmazza.
310 Most elkezdhetjük kitölteni a hangokat. Elkezdhetnénk közvetlenül a Voice
311 kontextus belsejébe beleírni, hogy:
315 r4 d''8\noBeam g, c4 r
319 De ha ezt tennénk, a @code{\score} blokk nagyon bonyolult lenne, és nem lehetne
320 átlátni a szólamok szerkezetét. Így érdemes változókat használni. A dalszöveg
321 változóként való megadására a @code{\lyricmode} parancsot kell használni, hogy
322 a LilyPond dalszövegként és ne hangokként értelmezze a változó tartalmát.
323 (A dalszöveg egy külön beviteli mód, ezekből még több is van, ld. az
324 @ruser{Input modes} c. részt.)
326 Tehát miután definiáltuk a megfelelő változókat, hivatkoztunk rájuk, és
327 basszuskulccsal láttuk el a balkezet, kész egy valódi mű kezdete:
329 @lilypond[verbatim,quote,ragged-right]
330 dallam = \relative { r4 d''8\noBeam g, c4 r }
331 dalszöveg = \lyricmode { Szólt az Úr, }
332 jobbkéz = \relative { <g' d g,>2~ <g d g,> }
333 balkéz = \relative { b,2 e2 }
337 \new Staff = "ének" <<
338 \new Voice = "dallam" { \dallam }
339 \addlyrics { \dalszöveg }
341 \new PianoStaff = "zongora" <<
342 \new Staff = "jobbkéz" { \jobbkéz }
343 \new Staff = "balkéz" {
353 Amikor a @code{\score} blokkot írjuk vagy olvassuk, mindig lassan, gondosan
354 járjunk el. Haladjunk kívülről befelé, a magas szintű felépítéstől a részletek
355 felé haladva. Nagyban segít, ha ügyelünk a behúzásokra -- minden blokk
356 kezdődjön egy tabulátorral beljebb, így az egy szinten levő blokkok ugyanolyan
357 mértékben lesznek behúzva.
360 Referencia: @ruser{Structure of a score}.
363 @node Zenei kifejezések egymásba ágyazása
364 @subsection Zenei kifejezések egymásba ágyazása
365 @translationof Nesting music expressions
367 @cindex ideiglenes kottasorok
370 Ossiák bevitelekor jön jól, hogy kottasorok bármikor, darab közben is
371 kezdődhetnek, és bármikor végződhetnek. Álljon itt erre egy példa:
373 @lilypond[verbatim,quote,ragged-right]
390 Figyeljük meg, hogy a kulcs mérete némileg kisebb, mint a sor elején szereplő
391 kulcsé (mint ahogy kulcsváltásnál is).
393 @cindex kottasorok pozíciója
395 Az ossia a kottasor fölött is elhelyezkedhet:
397 @lilypond[verbatim,quote,ragged-right]
398 \new Staff = "main" {
405 alignAboveContext = #"main" }
413 Ebben a példában a még ismeretlen @code{\with} parancsot használtuk, amelyet
414 később ismertetünk. Most elég annyit tudni róla, hogy a kottasor bizonyos
415 tulajdonságainak módosítására szolgál. Itt egy olyan tulajdonságot adunk meg,
416 ami azt mondja, hogy az új kottasor a @qq{main} nevű kottasor felett
417 helyezkedjen el (ahelyett, hogy alatta helyezkedne el, ami az alapértelmezés).
421 Az ossiákat általában kulcs és ütemmutató nélkül, valamint kisebb méretben
422 szedjük. Ehhez további új parancsok kellenek; ld. az @ref{Size of objects} és
423 @ruser{Ossia staves} szakaszokat.
426 @node A gerendák és ívek átfedhetik egymást
427 @subsection A gerendák és ívek átfedhetik egymást
428 @translationof On the un-nestedness of brackets and ties
430 @cindex zárójeltípusok
431 @cindex zárójelek egymásba ágyazása
433 Már sok zárójelfajtával találkoztunk a LilyPond fájlok írása közben. Ezekre
434 különböző szabályok vonatkoznak, amelyeket érdemes tisztázni. Ismételjük át
438 @multitable @columnfractions .3 .7
439 @headitem Zárójelfajta
441 @item @code{@{ .. @}}
442 @tab Egymás után megszólaló hangokat tartalmaz
444 @tab Egy akkord hangjait tartalmazza
445 @item @code{<< .. >>}
446 @tab Egyszerre megszólaló zenei kifejezéseket tartalmaz
448 @tab Egy ív kezdetét és végét jelöli
449 @item @code{\( .. \)}
450 @tab Egy frazeálóív kezdetét és végét jelöli
452 @tab Egy kézi gerenda kezdetét és végét jelöli
455 A LilyPond világán kívül a különböző fajtájú zárójeleket megfelelően egymásba
456 kell ágyazni, pl. így: @code{<< [ @{ ( .. ) @} ] >>}. Tehát a záró
457 zárójeleknek pontosan fordított sorrendben kell állniuk, mint a nyitó
458 zárójeleknek. A fenti táblázatban szereplő első három típusnál (a blokkoknál)
459 ezt a LilyPond is megköveteli. A többi parancsnál ez nem követelmény.
460 Valójában ezekre nem is úgy érdemes gondolni, mint a zárójelekre, hanem olyan
461 jelzésekre, amelyek zenei elemek kezdetét és végét jelölik.
463 Tehát például egy frazeálóív kezdődhet egy kézzel megadott gerenda előtt, és
464 befejeződhet a gerenda vége előtt -- lehet, hogy nem a legzeneibb megoldás, de
467 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
468 { g8\( a b[ c b\) a] }
471 Általánosságban az ívek, frazeálóívek, kötőívek és gerendák átnyúlhatnak
472 a triolák és előkék határain. A következő példában az 1. sorban egy gerenda,
473 a 2. sorban egy kötőív nyúl bele egy triolába, a 3. és 4. sorban pedig
474 mindezek mellett még egy kötőív is található két triola között, valamint egy
475 frazeálóív, amely túlnyúlik a triolán.
477 @lilypond[quote,verbatim,fragment,ragged-right]
479 r16[ g16 \tuplet 3/2 {r16 e'8] }
480 g16( a \tuplet 3/2 {b d) e' }
481 g8[( a \tuplet 3/2 {b d') e'~]}
482 \tuplet 5/4 {e'32\( a b d' e'} a'4.\)
487 @node A szólamok zenét tartalmaznak
488 @section A szólamok zenét tartalmaznak
489 @translationof Voices contain music
491 Ahogy az énekeseknek dallamok kellenek ahhoz, hogy énekelhessenek, a LilyPondnak is szüksége van hangokra.
492 A valódi zene minden hangszer számára magában a kottában szereplő szólamokat jelenti --
493 ezek nem csak a zenének, hanem magának a LilyPondnak is alapkövei.
496 * Hangzatos szólamok::
497 * Szólamok kézi létrehozása::
498 * Szólamok és vokális zene::
501 @node Hangzatos szólamok
502 @subsection Hangzatos szólamok
503 @translationof I'm hearing Voices
508 @cindex multiple voices
509 @cindex voices, multiple
510 @cindex Voice context
511 @cindex context, Voice
512 @cindex simultaneous music
513 @cindex music, simultaneous
514 @cindex concurrent music
515 @cindex music, concurrent
516 @cindex voices vs. chords
517 @cindex chords vs. voices
519 A LilyPond kotta legalsó rétege a @q{Szólam környezet} vagy röviden @q{Szólamok}.
520 A szólamokat egyes csomagokban csak rétegeknek nevezzük.
522 Valójában a szólam környezet az egyetlen, ami zenét tartalmazhat.
523 Ha szólam környezetet nem hozunk létre, akkor automatikusan készül
524 egy, ahogy láthattuk ennek a fejezetnek az elején. Egyes hangszerek
525 -- mint az oboa is -- egy időben csak egy hangot képesek kiadni.
526 Az ilyen hangszerekre írt zenék monofonikusak és csak egyetlen hangot
527 tartalmaznak (egy időben). Azon hangszerek esetén, melyek képesek egy
528 időben több hangot is kiadni -- mint a zongora -- sokszor többszörös
529 szólamokra van szükségünk, akár különböző ütemben.
532 Egy egyszerű szólam több hangjegyet is tartalmazhat egy akkordban,
533 tehát felmerül a kérdés, hogy mikor is van szükségünk többszörös szólamra.
534 Nézzük az első példát, 4 akkorddal:
536 @lilypond[quote,verbatim,fragment,ragged-right,relative=1]
538 <d g>4 <d fis> <d a'> <d g>
541 A fenti példa leírható egyszerű, kúpos („kacsacsőr”) zárójelekkel, @code{< ... >},
542 így csak egy egyszeres szólamra volt szükségünk. De tegyük fel, hogy, hogy a FISZ
543 egy nyolcad, melyet egy másik G nyolcad követ. Ebben esetben két hangunk van,
544 mely ugyanakkor kezdődik, de különböző hanghosszúságú: a negyed D és a nyolcad FISZ.
545 Hogy írjuk ezt le? Nem írhatjuk akkordként, hiszen egy akkordban minden hang azonos
546 hosszúságú és nem írhatjuk egymást követő hangokként sem, hiszen egy időben kell
547 kezdődniük a hangoknak. Ilyenkor van szükségünk két szólamra.
551 Nézzük, hogy néz ez ki a LilyPond szintaxisában.
556 A legegyszerűbb módja olyan részek rögzítésének, amelyek több mint egy hangot
557 tartalmaznak egy szólamban, hogy szekvenciát @code{@{...@}} használunk és ezt
558 kombináljuk a szögletes zárójelekkel @code{<<...>>}.
559 Az ilyen a részeket @code{\\} segítségével kell elválasztani ahhoz, hogy különböző szólamként jelenjenek meg.
560 Az elválasztó jelek nélkül a hangok egyetlen szólamként szerepelnének, ami általában hibát okoz.
561 Ez a technika használható olyan daraboknál melyek leginkább monofonikusak és néhány részük polifón.
564 Itt egy példa, ami a fenti akkord egyik hangját két szólamra osztja és kötést is tartalmaz:
566 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
568 % 1. szólam 2. szólam
569 << { g4 fis8( g) a4 g } \\ { d4 d d d } >>
572 Vegyük észre, hogy a második hang szárai lefele mutatnak.
575 Íme egy másik egyszerű példa:
577 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
579 % 1. szólam 2. szólam
580 << { r4 g g4. a8 } \\ { d,2 d4 g } >>
581 << { bes4 bes c bes } \\ { g4 g g8( a) g4 } >>
582 << { a2. r4 } \\ { fis2. s4 } >>
585 Nem szükséges, hogy minden ütemet elválasszunk a @code{<< \\ >>} segítségével.
586 Olyan zenék esetén, ahol csak néhány hang van minden ütemben, ez a felépítés
587 segíti a kód olvashatóságát, de ha már sok hang van, akkor jobb, ha a
588 hangokat külön-külön jegyezzük le, például így:
591 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
607 @cindex voices, naming
608 @cindex voices crossing brackets
609 @cindex slurs crossing brackets
610 @cindex ties crossing brackest
613 A fenti példában csak két szólam van, de ha három vagy több szólamot kell
614 lejegyezni, azt is hasonlóan lehet megoldani visszaperjelek (back-slash) használatával.
616 A szólam környezetek nevei @code{"1"}, @code{"2"}, stb.
617 Minden ilyen környezetben a függőleges elrendezés (kötések, szárak, dinamika, stb) megfelelően jelenik meg.
620 @lilypond[quote,verbatim,fragment]
621 \new Staff \relative {
624 % 1. szólam 2. szólam 3. szólam
625 << { g4 f e } \\ { r8 e4 d c8~ } >>
626 << { d2 e2 } \\ { c8 b16 a b8 g~ g2 } \\ { s4 b4 c2 } >>
631 A fő szólamtól különválasztva jelennek meg a @code{<< .. >>} között
632 szereplő szólamok (hangok). Ezt hívjuk @emph{szimultán felépítésnek}.
633 Az átkötések és kötőívek csak az azonos szólamon belül kötik
634 össze a hangokat, tehát ezek nem kerülhetnek belülre vagy kívülre a
635 szimultán felépítéshez képest.
636 Fordítva, szimultán felépítés esetén azok a párhuzamos szólamok,
637 amelyek ugyanabban az ötvonalban vannak, egy szólamnak minősülnek.
638 Egyéb szólamhoz kapcsolódó tulajdonságok átöröklődnek a szimultán
639 felépítésbe is. Itt egy másik példa, melynél a különböző szólamokban
640 különböző színű hangok szerepelnek. Vegyük észre, hogy
641 adott szólambeli változások nincsenek hatással más szólamokra,
642 de a változtatások ugyanabban a szólamban később is érvényesek.
643 Vegyük észre azt is, hogy az összekötött hangokat szétválaszthatja
644 az ütemhatár, ahogy a kék háromszöget jelző szólamban láthatjuk:
647 @lilypond[quote,verbatim]
648 \new Staff \relative {
663 % 1. szólam folytatása
666 % 2. szólam folytatása
667 { c8 b16 a b8 g ~ g2 }
677 @funindex \voiceOneStyle
678 @funindex \voiceTwoStyle
679 @funindex \voiceThreeStyle
680 @funindex \voiceFourStyle
681 @funindex \voiceNeutralStyle
684 A @code{\voiceXXXStyle} parancsot elsősorban oktatási célra érdemes
685 használni, olyan esetben, mint amilyet ez is. Ezek a parancsok
686 módosítják a hangok színét illetve a kottafejet, a szárat, a
687 gerendákat és a hangfejek stílusát, így lesznek a szólamok könnyen felismerhetőek.
689 Az első szólam piros rombusz, a második kék háromszög, a
690 harmadik zöld áthúzott kör, a negyedik (itt nem használt) magenta kereszt.
691 A @code{\voiceNeutralStyle} (szintén nem használt a fenti példában) visszaállítja
692 a stílust az alapértelmezettre. Később az @ref{Objektumok láthatósága és színe}
693 és @ref{Változók felhasználása a finomhangoláshoz} fejezetekben majd látni fogjuk,
694 hogyan lehet hasonló parancsokat létrehozni.
697 @cindex polyphony and relative note entry
698 @cindex relative note entry and polyphony
701 A polifónia nem változtatja meg a hangjegyek viszonyát a @code{\relative @{ @}} blokkon belül.
702 Minden hangjegy helyzetét az azt megelőző hang illetve első hang helyzete határozza meg.
705 \relative c' @{ noteA << < noteB noteC > \\ noteD >> noteE @}
709 @code{noteB} is relative to @code{noteA} @*
710 @code{noteC} is relative to @code{noteB}, not @code{noteA}; @*
711 @code{noteD} is relative to @code{noteB}, not @code{noteA} or
713 @code{noteE} is relative to @code{noteD}, not @code{noteA}.
716 Van egy másik módszer, ami egyszerűbb, ha a hangjegyek a
717 szólamokon belül teljesen szét vannak választva.
718 Ezt úgy érthetjük el, hogy a @code{\relative} parancsot használjuk minden szólam kezdetén:
722 \relative c' @{ noteA ... @}
724 \relative c'' @{ < noteB noteC > ... @}
726 \relative g' @{ noteD ... @}
728 \relative c' @{ noteE ... @}
731 Végül vizsgáljuk meg a szólamokat összetettebb zene esetén.
732 Nézzük Chopin Deux Nocturne, Op 32. művének első két ütemét.
733 A továbbiakban is ezt a példát fogjuk használni arra, hogy a
734 jelölésekre használható különböző technikákat szemléltessük,
735 ezért tekintsünk el attól, hogy az alábbi kód elsőre rejtélyesnek
736 tűnhet és koncentráljunk csak a zenére és a szólamokra -- a nehezebb részeket majd a későbbi fejezetekben áttekintjük.
740 @c The following should appear as music without code
741 @lilypond[quote,ragged-right]
742 \new Staff \relative {
751 % Az alábbival nem foglalkozunk most, a 4. fejezetben megtalálhatjuk a kód magyarázatát
752 \once \override NoteColumn #'force-hshift = #0
754 \once \override NoteColumn #'force-hshift = #0.5
762 A szárak iránya gyakran jelzi két egyidejű dallamsor folytonosságát.
763 A fenti példánál a legfelső hangjegy szárai felfelé mutatnak, az alsóké mind lefelé.
764 Ez az első jelölés, amire szükségünk van több szólam lejegyzése során.
767 Leginkább viszont akkor van szükségünk többszörös szólamokra, amikor a hangok
768 ugyanakkor kezdődnek ugyan, de különböző hosszúságúak. Nézzük azt a hangot,
769 ami első ütem harmadik ütésekor kezdődik. Az ASZ egy pontozott negyed, az
770 alatta levő F egy pontozatlan negyed, a DESZ pedig egy fél hang.
771 Ezek nem írhatók le akkordként, hiszen akkord esetén minden hang azonos hosszúságú.
772 Nem írhatóak le egymást követő hangokként sem, hiszen egy időben kell kezdődniük.
773 Az ütemnek ebben a részében három szólamra van szükségünk, és normál esetben az
774 egész ütem három szólamú, ahogy az alábbi példa mutatja, ahol különböző hangjegyfejeket
775 használunk különböző színekkel a három szólamhoz. Szeretnénk ismét kihangsúlyozni, hogy
776 az alábbi példa mögötti kódot később elmagyarázzuk, most csak hagyjuk figyelmen kívül
777 azokat a részeket, amik nem érthetőek.
780 @c The following should appear as music without code
781 @c The three voice styles should be defined in -init
782 @lilypond[quote,ragged-right]
783 \new Staff \relative {
794 \\ % Nincs 3. szólam (a hangjegyek szárait lefele szeretnénk)
797 % Az alábbival nem foglalkozunk most, a 4. fejezetben megtalálhatjuk a kód magyarázatát
798 \once \override NoteColumn #'force-hshift = #0
800 \once \override NoteColumn #'force-hshift = #0.5
808 Kezdjük a legelején a fenti zene kódolását.
809 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 :) ).
810 Kezdjük azzal, amit tanultunk: a @code{<< \\ >>} használatával.
811 Gépeljük be a három szólam első ütemét:
813 @lilypond[quote,verbatim,fragment,ragged-right]
814 \new Staff \relative {
817 { c''2 aes4. bes8 } \\ { aes2 f4 fes } \\ { <ees c>2 des2 }
824 @cindex voices and stem directions
825 @cindex stem directions and voices
829 A szárak iránya automatikusan hozzárendelődik a szólamokhoz, a páratlan-sorszámú szólamoknál
830 felfelé, a párosoknál lefelé. Az első és második szólamhoz tartozó hangok szárai megfelelőek,
831 de a harmadik szólamban a száraknak lefelé kellene állniuk. Ezt úgy javíthatjuk, hogy a
832 harmadik szólamot átugorjuk (üresen hagyjuk) és a negyedik szólamba helyezzük az eredetileg harmadik szólamot.
833 Ezt egyszerűen megtehetjük a @code{\\} segítségével:
836 @lilypond[quote,verbatim,fragment,ragged-right]
837 \new Staff \relative {
843 \\ % 3. szólam - elhagyjuk
852 Látjuk, hogy ez megoldotta a problémát a szárak irányával kapcsolatban,
853 de előhozott egy másikat, ami többszörös szólamoknál néha előfordul --
854 a hangok szárai a szólamon belül ütköznek más kottafejekkel más szólamokban.
855 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.
859 A kottaírás kézikönyve:
860 @ruser{Multiple voices}.
863 @node Szólamok kézi létrehozása
864 @subsection Szólamok kézi létrehozása
865 @translationof Explicitly instantiating voices
870 @funindex \voiceThree
874 @cindex voice contexts, creating
876 A @code{<< >>} blokkon belül is létrehozhatunk polifón zenét és ha szükséges,
877 a @code{\voiceOne} ... @code{\voiceFour} parancsokkal jelezhetjük a szárak, ívek, stb irányát.
878 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.
880 Konkrétan a @code{<< \\ >>}szerkezet, amit az előző fejezetben használtunk:
885 << @{ e'4 f g a @} \\ @{ c,4 d e f @} >>
891 egyenértékű az alábbival:
895 \new Voice = "1" @{ \voiceOne \relative @{ e'4 f g a @} @}
896 \new Voice = "2" @{ \voiceTwo \relative @{ c'4 d e f @} @}
900 Mindkét fenti esetben az alábbi kottát kapjuk
902 @c The following example should not display the code
903 @lilypond[ragged-right,quote]
905 \new Voice = "1" { \voiceOne \relative { e'4 f g a } }
906 \new Voice = "2" { \voiceTwo \relative { c'4 d e f } }
910 @cindex voices, reverting to single
911 @cindex reverting to a single voice
914 A @code{\voiceXXX} parancs meghatározza a szárak irányát, az
915 átkötéseket, a kötőíveket, az artikulációt, a szöveges magyarázatokat,
916 a pontozott hangokat és az ujjrendet. A @code{\voiceOne} és a @code{\voiceThree}
917 hatására a mutató elemek felfele mutatnak, míg a @code{\voiceTwo} és a
918 @code{\voiceFour} esetén lefelé. Ezen parancsok ha szükséges vízszintes
919 eltolást is létrehoznak minden szólam esetén, hogy elkerüljék a kottafejek
920 ütközését. A @code{\oneVoice} parancs visszaállítja a beállításokat a normál egyszeres szólamra.
923 Nézzünk egy egyszerű példát arra, hogy a @code{\oneVoice}, @code{\voiceOne} és @code{\voiceTwo}
924 parancsok milyen hatással vannak a jelzésekre, ívekre illetve dinamikára:
926 @lilypond[quote,ragged-right,verbatim]
928 % Alapértelmezett viselkedés vagy viselkedés \oneVoice után
929 c d8~ d e4( f g a) b-> c
933 @lilypond[quote,ragged-right,verbatim]
936 c d8~ d e4( f g a) b-> c
938 c, d8~ d e4( f g a) b-> c
942 @lilypond[quote,ragged-right,verbatim]
945 c d8~ d e4( f g a) b-> c
947 c, d8~ d e4( f g a) b-> c
951 Nézzük végig a három különböző lejegyzési módját ugyanannak a polifón dallamnak,
952 és vizsgáljuk meg melyik milyen esetben előnyös, használva az előző fejezetbeli példát.
955 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).
956 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ó.
957 The red diamond-shaped notes demonstrate that the main melody is now in a single voice context,
958 permitting a phrasing slur to be drawn over them.
960 @lilypond[quote,ragged-right,verbatim]
961 \new Staff \relative {
963 % A következő hangok monofónok
965 % Szimultán rész három szólammal
967 % Continue the main voice in parallel
968 { g4 f e | d2 e2) | }
969 % Initiate second voice
971 % Set stems, etc., down
973 r8 e4 d c8~ | c8 b16 a b8 g~ g2 |
975 % Initiate third voice
985 @cindex nesting music expressions
986 @cindex nesting simultaneous constructs
987 @cindex nesting voices
988 @cindex voices, temporary
989 @cindex voices, nesting
991 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:
993 @lilypond[quote,ragged-right,verbatim]
994 \new Staff \relative {
997 { g4 f e | d2 e2) | }
1002 { c8 b16 a b8 g~ g2 }
1013 @cindex spacing notes
1015 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:
1017 @lilypond[quote,ragged-right,verbatim]
1018 \new Staff \relative <<
1019 % Initiate first voice
1022 c'16^( d e f g4 f e | d2 e2) |
1024 % Initiate second voice
1026 % Set stems, etc, down
1028 s4 r8 e4 d c8~ | c8 b16 a b8 g~ g2 |
1030 % Initiate third voice
1032 % Set stems, etc, up
1039 @subsubheading Hangoszlopok
1042 @cindex note collisions
1043 @cindex collisions, notes
1044 @cindex shift commands
1048 @funindex \shiftOnnn
1051 Egymáshoz közel elhelyezkedő, különböző szólamban levő hangok esetén
1052 kettő, esetenként több oszlopba rendezzük a hangokat, hogy a kottafejek
1053 fedését elkerüljük. Ezeket hangoszlopoknak hívjuk. Különálló oszlopokat
1054 hozunk létre minden szólamhoz és az éppen aktuális szólam-független eltolást
1055 minden oszlopra alkalmazzuk, ezzel elkerülve az ütközéseket. A fenti példában
1056 is ezt láthatjuk. A 2. ütemben a C a kettes szólamban eltolódik a D-tól jobbra
1057 (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.
1059 A @code{\shiftOn}, @code{\shiftOnn}, @code{\shiftOnnn}, és
1060 @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
1063 A @code{\shiftOnn} és @code{\shiftOnnn} további eltolási szinteket
1064 határoznak meg, melyek összetett esetekben ideiglenesen szükségesek
1065 lehetnek ahhoz, hogy elkerüljük az ütközéseket – lásd @ref{Valós zenei példa}.
1067 Egy hangoszlop egyszerre csak egy hangot (vagy akkordot) tartalmazhat egy szólamból
1068 szárral felfelé és egy másikat szárral lefelé. Ha két különböző szólambeli hang
1069 azonos irányú szárral kerül ugyanabba a pozícióba és egyik szólamban sincs eltolás
1070 vagy ugyanazt az eltolást adjuk meg, akkor a @qq{Too many clashing note columns} hibaüzenetet kapjuk.
1074 A kottaírás kézikönyve:
1075 @ruser{Multiple voices}.
1078 @node Szólamok és vokális zene
1079 @subsection Szólamok és vokális zene
1080 @translationof Voices and vocals
1082 A vokális zene speciális nehézséget jelent: két kifejezést kell egyesíteni -- hangokat és a szöveget.
1084 @funindex \new Lyrics
1087 @cindex Lyrics context, creating
1088 @cindex lyrics, linking to voice
1090 Korábban már találkoztunk a @code{\addlyrics@{@}} paranccsal, ami
1091 az egyszerű kottákhoz elegendő. Azonban ez a módszer eléggé korlátolt.
1092 Bonyolultabb zene esetén, muszáj bevezetni a @code{Lyrics}
1093 környezetet a @code{\new Lyrics} paranccsal és közvetlenül összekötni a
1094 dalszöveget a hangjegyekkel. A @code{\lyricsto@{@}} parancs használatával
1095 hozzárendelhetjük a szöveget a megfelelő szólamhoz.
1097 @lilypond[quote,verbatim,fragment]
1099 \new Voice = "one" \relative {
1102 c''4 b8. a16 g4. f8 e4 d c2
1104 \new Lyrics \lyricsto "one" {
1105 No more let sins and sor -- rows grow.
1110 Megjegyzés: a dalszövegnek egy @code{Voice} környezethez kell kapcsolódnia,
1111 @emph{nem} @code{Staff} környezethez. Ez egy olyan eset, amikor
1112 muszáj közvetlenül készíteni @code{Staff} és @code{Voice} környezetet is.
1114 @cindex lyrics and beaming
1115 @cindex beaming and lyrics
1116 @funindex \autoBeamOff
1118 Az automatikus gerendázás -, amit a LilyPond használ - jól működik
1119 a hangszeres zenére, de nem túl jó a dalszövegek esetén,
1120 amikor előfordul, hogy nincs is szükség gerendákra vagy ha épp melizmát jeleznénk a dalszövegben.
1121 A fenti példában az @code{\autoBeamOff} paranccsal kikapcsoltuk az automatikus gerendázást.
1123 @funindex \new ChoirStaff
1124 @funindex ChoirStaff
1125 @funindex \lyricmode
1126 @cindex vocal score structure
1129 A korábbi Judas Maccabæus példát használva
1130 nézzünk meg egy rugalmasabb módszert. Először írjuk újra
1131 változók használatával, így a zene és a dalszöveg a kotta struktúrájától
1132 különválik. Vezessünk be egy kottasorcsoportot, mely kórusszólamokat fog össze
1134 A dalszöveget magát egy @code{\lyricmode} paranccsal
1135 vezetjük be, ezzel biztosítva, hogy dalszövegként és
1136 ne zeneként legyen értelmezve.
1138 @lilypond[quote,verbatim]
1139 global = { \time 6/8 \partial 8 \key f \major}
1140 SopOneMusic = \relative {
1141 c''8 | c([ bes)] a a([ g)] f | f'4. b, | c4.~ 4 | }
1142 SopTwoMusic = \relative {
1143 r8 | r4. r4 c'8 | a'([ g)] f f([ e)] d | e([ d)] c bes' | }
1144 SopOneLyrics = \lyricmode {
1145 Let | flee -- cy flocks the | hills a -- dorn, __ | }
1146 SopTwoLyrics = \lyricmode {
1147 Let | flee -- cy flocks the | hills a -- dorn, | }
1152 \new Voice = "SopOne" {
1156 \new Lyrics \lyricsto "SopOne" {
1161 \new Voice = "SopTwo" {
1165 \new Lyrics \lyricsto "SopTwo" {
1173 Ilyen az alapvető felépítése, struktúrája minden vokális zenének. Olykor több kottasor
1174 szükséges vagy több szólam van egy-egy kottasorban, esetleg több versszakból áll a dalszöveg.
1175 A változók, amik a zenét tartalmazzák, könnyen külön fájlokba is rendezhetők, ha túl hosszúak lennének.
1177 @cindex hymn structure
1178 @cindex SATB structure
1179 @cindex vocal scores with multiple verses
1180 @cindex multiple vocal verses
1181 @cindex versszakok, multiple vocal
1183 Itt egy példa egy egyházi ének első sorára, aminek négy
1184 verszaka van, és négyszólamú kórusra íródott. Ebben az esetben a szavak mind a négy
1185 szólamra azonosak. Figyeljük meg, hogyan használjuk a változókat arra,
1186 hogy különválasszuk a kottát és a szavakat a kotta felépítésétől.
1187 Figyeljük meg, hogy a @q{TimeKey} nevű változó számos parancsot tartalmaz,
1188 melyet mindkét kottasorban felhasználunk!
1189 Más példákban ez a közös változó gyakran @q{global} néven szerepel.
1191 @lilypond[quote,verbatim]
1192 TimeKey = { \time 4/4 \partial 4 \key c \major}
1193 SopMusic = \relative { c'4 | e4. e8 g4 g | a a g | }
1194 AltoMusic = \relative { c'4 | c4. c8 e4 e | f f e | }
1195 TenorMusic = \relative { e4 | g4. g8 c4. b8 | a8 b c d e4 | }
1196 BassMusic = \relative { c4 | c4. c8 c4 c | f8 g a b c4 | }
1197 VerseOne = \lyricmode {
1198 E -- | ter -- nal fa -- ther, | strong to save, | }
1199 VerseTwo = \lyricmode {
1200 O | Christ, whose voice the | wa -- ters heard, | }
1201 VerseThree = \lyricmode {
1202 O | Ho -- ly Spi -- rit, | who didst brood | }
1203 VerseFour = \lyricmode {
1204 O | Tri -- ni -- ty of | love and pow'r | }
1210 \new Voice = "Sop" { \voiceOne \TimeKey \SopMusic }
1211 \new Voice = "Alto" { \voiceTwo \AltoMusic }
1212 \new Lyrics \lyricsto "Sop" { \VerseOne }
1213 \new Lyrics \lyricsto "Sop" { \VerseTwo }
1214 \new Lyrics \lyricsto "Sop" { \VerseThree }
1215 \new Lyrics \lyricsto "Sop" { \VerseFour }
1219 \new Voice = "Tenor" { \voiceOne \TimeKey \TenorMusic }
1220 \new Voice = "Bass" { \voiceTwo \BassMusic }
1226 @cindex versszakok és refrének
1228 A példát azzal fejezzük be, hogy megmutatjuk hogyan lehet egy olyan versszakot,
1229 ami kétféle refrénnel folytatódik, két ötvonalas kottában leírni.
1230 Az egymást követő (szekvenciális) és egyidejű (szimultán) részek leírása
1231 egy kottán belül elég trükkös, úgyhogy a magyarázatot óvatosan kövessük!
1233 Kezdjük egy score blokkal, ami tartalmaz egy @code{ChoirStaff}-ot,
1234 úgy beágyazva, ahogy szeretnénk, hogy látszódjon a kórusrész kezdetén.
1235 Alapesetben szükség lenne hegyes zárójelekre ( << és >> ) a @code{\new ChoirStaff} után,
1236 hogy minden kottasor párhuzamos legyen, de most itt el szeretnénk kerülni a
1237 párhuzamosságot a szóló résznél, ezért zárójeleket használunk - bár a
1238 hegyes zárójelek nem árthatnak. A @code{ChoirStaff}-on belül először szerepeljen az
1239 a kottasor, ami a versszakot tartalmazni fogja. Hangokat és dalszöveget kell párhuzamosan tartalmaznia,
1240 tehát szükség lesz hegyes zárójelre a @code{\new Voice} és @code{\new Lyrics} esetén, hogy egy időben kezdődjenek:
1242 @lilypond[quote,verbatim,ragged-right]
1243 versszakhangok = \relative {
1250 szoveg = \lyricmode {
1251 One two three four five six
1256 \new Voice = "versszak" {
1257 \versszakhangok \break
1259 \new Lyrics \lyricsto "versszak" {
1267 Ezzel kész a verssor.
1269 Folytatni szeretnénk a refrenA-val ugyanabban az ötvonalas kottában, míg
1270 a második ötvonal ezzel párhuzamosan lenne a refrenB-nek, tehát
1271 ez egy párhuzamos rész, ami rögtön a @code{\break} után jön a "versszak" nevű szólamban.
1272 Igen, a a "versszak" nevű szólamon @emph{belül}! Íme a párhuzamos rész. Több kottasort
1273 írhatunk hasonló módon.
1278 \new Lyrics \lyricsto versszak @{
1282 \new Voice = "refrenB" @{
1285 \new Lyrics \lyricsto "refrenB" @{
1292 Itt a végső eredmény két kottasorral a kórusban, mutatva a verse Voice-on belül pozicionált
1295 @lilypond[quote,verbatim, ragged-right]
1296 versszakhangok = \relative {
1302 refrenhangokA = \relative {
1304 c'' c | g g \bar "|."
1306 refrenhangokB = \relative {
1311 szoveg = \lyricmode {
1312 One two three four five six
1314 refrenszovegA = \lyricmode {
1317 refrenszovegB = \lyricmode {
1323 \new Voice = "versszak" {
1324 \versszakhangok \break
1327 \new Lyrics \lyricsto "versszak" {
1331 \new Voice = "refrenB" {
1334 \new Lyrics \lyricsto "refrenB" {
1340 \new Lyrics \lyricsto "versszak" {
1348 @cindex book, example of using
1351 Habár ez egy érdekes és hasznos példa arra, hogy megértsük, hogyan működnek
1352 az egymásutáni és egyidejű blokkok, gyakorlatban valószínűleg a többség ezt két
1353 @code{\score} blokként írná meg egy implicit @code{\book} blokkon belül, valahogy így:
1356 @lilypond[quote,verbatim,ragged-right]
1357 versenotes = \relative {
1363 refrainnotesA = \relative {
1365 c'' c | g g \bar "|."
1367 refrainnotesB = \relative {
1372 versewords = \lyricmode {
1373 One two three four five six
1375 refrainwordsA = \lyricmode {
1378 refrainwordsB = \lyricmode {
1383 \new Voice = "verse" {
1386 \new Lyrics \lyricsto "verse" {
1395 \new Voice = "refrainA" {
1398 \new Lyrics \lyricsto "refrainA" {
1403 \new Voice = "refrainB" {
1406 \new Lyrics \lyricsto "refrainB" {
1416 A kottaírás kézikönyve:
1417 @ruser{Vocal music}.
1420 @node Kontextusok és ábrázolók
1421 @section Kontextusok és ábrázolók
1422 @translationof Contexts and engravers
1425 Kontextusok és ábrázolók korábban említésre kerültek; viszont most részletesebben
1426 foglalkozunk a fogalommal, mivel ezeket használhatjuk a LilyPond kimeneti eredményének finomhangolására.
1430 * A kontextus fogalma::
1431 * Kontextusok létrehozása::
1432 * Az ábrázoló fogalma::
1433 * Kontextusok tulajdonságainak módosítása::
1434 * Ábrázolók hozzáadása és eltávolítása::
1437 @node A kontextus fogalma
1438 @subsection A kontextus fogalma
1439 @translationof Contexts explained
1441 @cindex contexts explained
1443 When music is printed, many notational elements which do not
1444 appear explicitly in the input file must be added to the
1445 output. For example, compare the input and output of the
1448 @lilypond[quote,verbatim,relative=2,fragment]
1452 The input is rather sparse, but in the output, bar lines,
1453 accidentals, clef, and time signature have been added. When
1454 LilyPond @emph{interprets} the input the musical information
1455 is parsed from left to right, similar to the way a performer
1456 reads the score. While reading the input, the program remembers
1457 where measure boundaries are, and which pitches require explicit
1458 accidentals. This information must be held on several levels.
1459 For example, an accidental affects only a single staff, while
1460 a bar line must be synchronized across the entire score.
1462 Within LilyPond, these rules and bits of information are grouped in
1463 @emph{Contexts}. We have already introduced the @code{Voice} context.
1464 Others are the @code{Staff} and @code{Score} contexts. Contexts are
1465 hierarchical to reflect the hierarchical nature of a musical score.
1466 For example: a @code{Staff} context can contain many @code{Voice}
1467 contexts, and a @code{Score} context can contain many @code{Staff}
1471 @sourceimage{context-example,5cm,,}
1474 Each context has the responsibility for enforcing some notation rules,
1475 creating some notation objects and maintaining the associated
1476 properties. For example, the @code{Voice} context may introduce an
1477 accidental and then the @code{Staff} context maintains the rule to
1478 show or suppress the accidental for the remainder of the measure.
1480 As another example, the synchronization of bar lines is, by default,
1481 handled in the @code{Score} context.
1482 However, in some music we may not want the bar lines to be
1483 synchronized -- consider a polymetric score in 4/4 and 3/4 time.
1484 In such cases, we must modify the default settings of the
1485 @code{Score} and @code{Staff} contexts.
1487 For very simple scores, contexts are created implicitly, and you need
1488 not be aware of them. For larger pieces, such as anything with more
1489 than one staff, they must be
1490 created explicitly to make sure that you get as many staves as you
1491 need, and that they are in the correct order. For typesetting pieces
1492 with specialized notation, it is usual to modify existing, or
1493 even to define totally new, contexts.
1495 In addition to the @code{Score,} @code{Staff} and
1496 @code{Voice} contexts there are contexts which fit between
1497 the score and staff levels to control staff groups, such as the
1498 @code{PianoStaff} and @code{ChoirStaff} contexts. There
1499 are also alternative staff and voice contexts, and contexts for
1500 lyrics, percussion, fret boards, figured bass, etc.
1502 The names of all context types are formed from one or more
1503 words, each word being capitalized and joined immediately to the
1504 preceding word with no hyphen or underscore, e.g.,
1505 @code{GregorianTranscriptionStaff}.
1509 A kottaírás kézikönyve:
1510 @ruser{A kontextus fogalma}.
1513 @node Kontextusok létrehozása
1514 @subsection Kontextusok létrehozása
1515 @translationof Creating contexts
1519 @cindex new contexts
1520 @cindex creating contexts
1521 @cindex contexts, creating
1523 In an input file a score block, introduced with a @code{\score}
1524 command, contains a single music expression and an associated
1525 output definition (either a @code{\layout} or a @code{\midi} block).
1526 The @code{Score} context is usually left to be created automatically
1527 when the interpretation of that music expression starts.
1529 For scores with only one voice and one staff, the @code{Voice} and
1530 @code{Staff} contexts may also be left to be created automatically,
1531 but for more complex scores it is necessary to create them by hand.
1532 The simplest command that does this is @code{\new}. It is prepended
1533 to a music expression, for example
1536 \new @var{type} @var{music-expression}
1540 where @var{type} is a context name (like @code{Staff} or
1541 @code{Voice}). This command creates a new context, and starts
1542 interpreting the @var{music-expression} within that context.
1544 (Note that a @code{\new Score} command is not normally required,
1545 as the essential top-level @code{Score} context is created
1546 automatically when the music expression within the @code{\score}
1547 block is interpreted. The only reason for creating a @code{Score}
1548 context explicitly using @code{\new Score} is to introduce a
1549 @code{\with} block in which one or more score-wide default values
1550 of context properties may be specified. Information on using
1551 @code{\with} blocks can be found under the heading
1552 @qq{Setting context properties with @code{\\with} } in
1553 @ref{Kontextusok tulajdonságainak módosítása}.)
1555 You have seen many practical examples which created new
1556 @code{Staff} and @code{Voice} contexts in earlier sections, but
1557 to remind you how these commands are used in practice, here's an
1558 annotated real-music example:
1560 @lilypond[quote,verbatim,ragged-right]
1561 \score { % start of single compound music expression
1562 << % start of simultaneous staves section
1564 \new Staff { % create RH staff
1567 \new Voice { % create voice for RH notes
1568 \relative { % start of RH notes
1574 \new Staff << % create LH staff; needs two simultaneous voices
1577 \new Voice { % create LH voice one
1579 \relative { % start of LH voice one notes
1580 g8 <bes d> ees, <g c>
1581 g8 <bes d> ees, <g c>
1582 } % end of LH voice one notes
1583 } % end of LH voice one
1584 \new Voice { % create LH voice two
1586 \relative { % start of LH voice two notes
1589 } % end of LH voice two notes
1590 } % end of LH voice two
1591 >> % end of LH staff
1592 >> % end of simultaneous staves section
1593 } % end of single compound music expression
1596 (Note how all the statements which open a block with either a
1597 curly bracket, @code{@{}, or double angle brackets, @code{<<},
1598 are indented by two further spaces, and the corresponding
1599 closing bracket is indented by exactly the same amount. While
1600 this is not required, following this practice will greatly
1601 reduce the number of @q{unmatched bracket} errors, and is
1602 strongly recommended. It enables the structure of the music to
1603 be seen at a glance, and any unmatched brackets will be obvious.
1604 Note too how the LH staff is created using double angle brackets
1605 because it requires two voices for its music, whereas the RH staff
1606 is created with a single music expression surrounded by curly
1607 brackets because it requires only one voice.)
1609 @cindex contexts, naming
1610 @cindex naming contexts
1612 The @code{\new} command may also give an identifying name to the
1613 context to distinguish it from other contexts of the same type,
1616 \new @var{type} = @var{id} @var{music-expression}
1619 Note the distinction between the name of the context type,
1620 @code{Staff}, @code{Voice}, etc, and the identifying name of a
1621 particular instance of that type, which can be any sequence of letters
1622 invented by the user. Digits and spaces can also be used in the
1623 identifying name, but then it has to be placed in quotes,
1624 i.e. @code{\new Staff = "MyStaff 1" @var{music-expression}}.
1625 The identifying name is used to
1626 refer back to that particular instance of a context. We saw this in
1627 use in the section on lyrics, see @ref{Szólamok és vokális zene}.
1631 A kottaírás kézikönyve:
1632 @ruser{Kontextusok létrehozása}.
1635 @node Az ábrázoló fogalma
1636 @subsection Az ábrázoló fogalma
1637 @translationof Engravers explained
1641 Every mark on the printed output of a score produced by LilyPond
1642 is produced by an @code{Engraver}. Thus there is an engraver
1643 to print staves, one to print note heads, one for stems, one for
1644 beams, etc, etc. In total there are over 120 such engravers!
1645 Fortunately, for most scores it is not necessary to know about
1646 more than a few, and for simple scores you do not need to know
1649 Engravers live and operate in Contexts. Engravers such as the
1650 @code{Metronome_mark_engraver}, whose action and output apply to the
1651 score as a whole, operate in the highest level context -- the
1652 @code{Score} context.
1654 The @code{Clef_engraver} and @code{Key_engraver} are to be
1655 found in every @code{Staff} Context, as different staves may require
1656 different clefs and keys.
1658 The @code{Note_heads_engraver} and @code{Stem_engraver} live
1659 in every @code{Voice} context, the lowest level context of all.
1661 Each engraver processes the particular objects associated
1662 with its function, and maintains the properties that relate
1663 to that function. These properties, like the properties
1664 associated with contexts, may be modified to change the
1665 operation of the engraver or the appearance of those elements
1666 in the printed score.
1668 Engravers all have compound names formed from words which
1669 describe their function. Just the first word is capitalized,
1670 and the remainder are joined to it with underscores. Thus
1671 the @code{Staff_symbol_engraver} is responsible for creating the
1672 lines of the staff, the @code{Clef_engraver} determines and sets
1673 the pitch reference point on the staff by drawing a clef symbol.
1675 Here are some of the most common engravers together with their
1676 function. You will see it is usually easy to guess the function
1677 from the name, or vice versa.
1679 @multitable @columnfractions .3 .7
1682 @item Accidental_engraver
1683 @tab Makes accidentals, cautionary and suggested accidentals
1688 @item Completion_heads_engraver
1689 @tab Splits notes which cross bar lines
1690 @item Dynamic_engraver
1691 @tab Creates hairpins and dynamic texts
1692 @item Forbid_line_break_engraver
1693 @tab Prevents line breaks if a musical element is still active
1695 @tab Creates the key signature
1696 @item Metronome_mark_engraver
1697 @tab Engraves metronome marking
1698 @item Note_heads_engraver
1699 @tab Engraves note heads
1702 @item Staff_symbol_engraver
1703 @tab Engraves the five (by default) lines of the staff
1705 @tab Creates stems and single-stem tremolos
1706 @item Time_signature_engraver
1707 @tab Creates time signatures
1712 We shall see later how the output of LilyPond can be changed
1713 by modifying the action of Engravers.
1717 Internals reference: @rinternals{Engravers and Performers}.
1720 @node Kontextusok tulajdonságainak módosítása
1721 @subsection Kontextusok tulajdonságainak módosítása
1722 @translationof Modifying context properties
1724 @cindex context properties
1725 @cindex context properties, modifying
1726 @cindex modifying context properties
1730 Contexts are responsible for holding the values of a number of
1731 context @emph{properties}. Many of them can be changed to
1732 influence the interpretation of the input and so change the
1733 appearance of the output. They are changed by the
1734 @code{\set} command. This takes the form
1737 \set @emph{ContextName}.@emph{propertyName} = #@emph{value}
1740 Where the @emph{ContextName} is usually @code{Score},
1741 @code{Staff} or @code{Voice}. It may be omitted,
1742 in which case the current context (typically @code{Voice}) is assumed.
1744 The names of context properties consist of words joined
1745 together with no hyphens or underscores, all except the
1746 first having a capital letter. Here are a few examples
1747 of some commonly used ones. There are many more.
1749 @c attempt to force this onto a new page
1751 @multitable @columnfractions .25 .15 .45 .15
1752 @headitem propertyName
1758 @tab If true, set extra natural signs before accidentals
1759 @tab @code{#t}, @code{#f}
1760 @item currentBarNumber
1762 @tab Set the current bar number
1766 @tab If true, print slurs both above and below notes
1767 @tab @code{#t}, @code{#f}
1768 @item instrumentName
1770 @tab Set the name to be placed at the start of the staff
1771 @tab @code{"Cello I"}
1774 @tab Increase or decrease the font size
1778 @tab Set the text to print before the start of a verse
1783 where a Boolean is either True (@code{#t}) or False (@code{#f}),
1784 an Integer is a positive whole number, a Real is a positive
1785 or negative decimal number, and text is enclosed in double
1786 apostrophes. Note the occurrence of hash signs,
1787 (@code{#}), in two different places -- as part of the Boolean
1788 value before the @code{t} or @code{f}, and before @emph{value}
1789 in the @code{\set} statement. So when a Boolean is being
1790 entered you need to code two hash signs, e.g., @code{##t}.
1792 @cindex properties operating in contexts
1793 @cindex setting properties within contexts
1795 Before we can set any of these properties we need to know
1796 in which context they operate. Sometimes this is obvious,
1797 but occasionally it can be tricky. If the wrong context
1798 is specified, no error message is produced, but the expected
1799 action will not take place. For example, the
1800 @code{instrumentName} clearly lives in the @code{Staff} context, since
1801 it is the staff that is to be named.
1802 In this example the first staff is labeled, but not the second,
1803 because we omitted the context name.
1805 @lilypond[quote,verbatim,ragged-right]
1807 \new Staff \relative {
1808 \set Staff.instrumentName = #"Soprano"
1811 \new Staff \relative {
1812 \set instrumentName = #"Alto" % Wrong!
1818 Remember the default context name is @code{Voice}, so the second
1819 @code{\set} command set the property @code{instrumentName} in the
1820 @code{Voice} context to @qq{Alto}, but as LilyPond does not look
1821 for any such property in the @code{Voice} context, no
1822 further action took place. This is not an error, and no error
1823 message is logged in the log file.
1825 Similarly, if the property name is mis-spelt no error message is
1826 produced, and clearly the expected action cannot be performed. In
1827 fact, you can set any (fictitious) @q{property} using any name you
1828 like in any context that exists by using the @code{\set} command. But
1829 if the name is not known to LilyPond it will not cause any action to
1830 be taken. Some text editors with special support for LilyPond input
1831 files document property names with bullets when you hover them with
1832 the mouse, like JEdit with LilyPondTool, or highlight unknown property
1833 names differently, like ConTEXT. If you do not use an editor with
1834 such features, it is recommended to check the property name in the
1835 Internals Reference: see @rinternals{Tunable context properties}, or
1836 @rinternals{Contexts}.
1838 The @code{instrumentName} property will take effect only
1839 if it is set in the @code{Staff} context, but
1840 some properties can be set in more than one context.
1841 For example, the property @code{extraNatural} is by
1842 default set to ##t (true) for all staves.
1843 If it is set to ##f (false) in one particular @code{Staff}
1844 context it applies just to the accidentals on that staff.
1845 If it is set to false in the @code{Score} context
1846 it applies to all staves.
1848 So this turns off extra naturals in one staff:
1850 @lilypond[quote,verbatim,ragged-right]
1852 \new Staff \relative {
1855 \new Staff \relative {
1856 \set Staff.extraNatural = ##f
1863 and this turns them off in all staves:
1865 @lilypond[quote,verbatim,ragged-right]
1867 \new Staff \relative {
1870 \new Staff \relative {
1871 \set Score.extraNatural = ##f
1877 As another example, if @code{clefTransposition} is set in
1878 the @code{Score} context this immediately changes the value
1879 of the octavation in all current staves and sets a new default
1880 value which will be applied to all staves.
1882 The opposite command, @code{\unset}, effectively removes the
1883 property from the context, which causes most properties to
1884 revert to their default value. Usually @code{\unset} is not
1885 required as a new @code{\set} command will achieve what is
1888 The @code{\set} and @code{\unset} commands can appear anywhere
1889 in the input file and will take effect from the time they are
1890 encountered until the end of the score or until the property is
1891 @code{\set} or @code{\unset} again. Let's try changing the
1892 font size, which affects the size of the note heads (among
1893 other things) several times. The change is from the default
1894 value, not the most recently set value.
1896 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
1898 % make note heads smaller
1901 % make note heads larger
1902 \set fontSize = #2.5
1904 % return to default size
1909 We have now seen how to set the values of several different types of
1910 property. Note that integers and numbers are always preceded by a
1911 hash sign, @code{#}, while a true or false value is specified by
1912 @code{##t} and @code{##f}, with two hash signs. A text property
1913 should be enclosed in double quotation signs, as above, although we
1914 shall see later that text can actually be specified in a much more
1915 general way by using the very powerful @code{\markup} command.
1917 @subsubheading Setting context properties with @code{\with}
1920 @cindex context properties, setting with \with
1922 The default value of context properties may be set at the time the
1923 context is created. Sometimes this is a clearer way of setting a
1924 property value if it is to remain fixed for the duration of
1925 the context. When a context is created with a @code{\new}
1926 command it may be followed immediately by a @code{\with @{ .. @}}
1927 block in which the default property values are set. For example,
1928 if we wish to suppress the printing of extra naturals for the
1929 duration of a staff we would write:
1932 \new Staff \with @{ extraNatural = ##f @}
1938 @lilypond[quote,verbatim,ragged-right]
1944 \new Staff \with { extraNatural = ##f }
1951 Or, if the property override is to be applied to all staves
1952 within the score, it may be appended to an explicit
1953 @code{\new Score} command, like this:
1955 @lilypond[quote,verbatim,ragged-right]
1957 \new Score \with { extraNatural = ##f } <<
1972 Properties set in this way may still be changed dynamically using
1973 @code{\set} and returned to the default value set in the
1974 @code{\with} block with @code{\unset}.
1976 @cindex fontSize, default and setting
1978 So if the @code{fontSize} property is set in a @code{\with} clause
1979 it sets the default value of the font size. If it is later changed
1980 with @code{\set}, this new default value may be restored with the
1981 @code{\unset fontSize} command.
1983 @subsubheading Setting context properties with @code{\context}
1985 @cindex context properties, setting with \context
1988 The values of context properties may be set in @emph{all} contexts
1989 of a particular type, such as all @code{Staff} contexts, with a single
1990 command. The context type is identified by using its
1991 type name, like @code{Staff}, prefixed by a back-slash: @code{\Staff}.
1992 The statement which sets the property value is the same as that in a
1993 @code{\with} block, introduced above. It is placed in a
1994 @code{\context} block within a @code{\layout} block. Each
1995 @code{\context} block will affect all contexts of the type specified
1996 throughout the @code{\score} or @code{\book} block in which the
1997 @code{\layout} block appears. Here is a example to show the format:
1999 @lilypond[verbatim,quote]
2016 Context properties set in this way may be overridden for particular
2017 instances of contexts by statements in a @code{\with} block, and by
2018 @code{\set} commands embedded in music statements.
2022 A kottaírás kézikönyve:
2023 @ruser{Changing context default settings}.
2024 @ruser{The set command}.
2026 Internals Reference:
2027 @rinternals{Contexts},
2028 @rinternals{Tunable context properties}.
2031 @node Ábrázolók hozzáadása és eltávolítása
2032 @subsection Ábrázolók hozzáadása és eltávolítása
2033 @translationof Adding and removing engravers
2035 @cindex engravers, adding
2036 @cindex adding engravers
2037 @cindex engravers, removing
2038 @cindex removing engravers
2043 We have seen that contexts each contain several engravers, each
2044 of which is responsible for producing a particular part of the
2045 output, like bar lines, staves, note heads, stems, etc. If an
2046 engraver is removed from a context, it can no longer produce its
2047 output. This is a crude way of modifying the output, but it
2048 can sometimes be useful.
2050 @subsubheading Changing a single context
2052 To remove an engraver from a single context we use the
2053 @code{\with} command placed immediately after the context creation
2054 command, as in the previous section.
2056 As an illustration, let's repeat an example from the previous section
2057 with the staff lines removed. Remember that the staff lines are
2058 produced by the @code{Staff_symbol_engraver}.
2060 @lilypond[quote,verbatim,ragged-right]
2062 \remove "Staff_symbol_engraver"
2066 \set fontSize = #-4 % make note heads smaller
2068 \set fontSize = #2.5 % make note heads larger
2070 \unset fontSize % return to default size
2075 @cindex ambitus engraver
2077 Engravers can also be added to individual contexts.
2078 The command to do this is
2080 @code{\consists @var{Engraver_name}},
2083 placed inside a @code{\with} block. Some vocal scores have an ambitus
2084 placed at the beginning of a staff to indicate the range of notes in
2085 that staff -- see @rglos{ambitus}. The ambitus is produced by the
2086 @code{Ambitus_engraver}, which is not normally included in any
2087 context. If we add it to the @code{Voice} context, it calculates the
2088 range from that voice only:
2090 @lilypond[quote,verbatim,ragged-right]
2093 \consists "Ambitus_engraver"
2108 but if we add the ambitus engraver to the
2109 @code{Staff} context, it calculates the range from all
2110 the notes in all the voices on that staff:
2112 @lilypond[quote,verbatim,ragged-right]
2114 \consists "Ambitus_engraver"
2130 @subsubheading Changing all contexts of the same type
2134 The examples above show how to remove or add engravers to
2135 individual contexts. It is also possible to remove or add
2136 engravers to every context of a specific type by placing the
2137 commands in the appropriate context in a @code{\layout}
2138 block. For example, if we wanted to show an ambitus for every
2139 staff in a four-staff score, we could write
2141 @lilypond[quote,verbatim,ragged-right]
2170 \consists "Ambitus_engraver"
2177 The values of context properties may also be set
2178 for all contexts of a particular type by including the
2179 @code{\set} command in a @code{\context} block in the
2184 A kottaírás kézikönyve:
2185 @ruser{Modifying context plug-ins},
2186 @ruser{Changing context default settings}.
2189 @node A sablonok kibővítése
2190 @section A sablonok kibővítése
2191 @translationof Extending the templates
2193 You've read the tutorial, you know how to write music, you
2194 understand the fundamental concepts. But how can you
2195 get the staves that you want? Well, you can find lots of
2196 templates (see @ref{Templates}) which may give you a start.
2197 But what if you want something that isn't covered there? Read on.
2200 * Szoprán és cselló::
2201 * Négyszólamú vegyeskar::
2202 * Kotta létrehozása az alapoktól::
2203 * Kevesebb gépelés változókkal és függvényekkel::
2204 * Partitúra és szólamkották::
2207 @node Szoprán és cselló
2208 @subsection Szoprán és cselló
2209 @translationof Soprano and cello
2211 @cindex template, modifying
2212 @cindex modifying templates
2214 Start off with the template that seems closest to what you want to
2215 end up with. Let's say that you want to write something for
2216 soprano and cello. In this case, we would start with the
2217 @q{Notes and lyrics} template (for the soprano part).
2220 \version @w{"@version{}"}
2221 melody = \relative @{
2228 text = \lyricmode @{
2234 \new Voice = "one" @{
2238 \new Lyrics \lyricsto "one" \text
2245 Now we want to add a cello part. Let's look at the @q{Notes only} example:
2248 \version @w{"@version{}"}
2249 melody = \relative @{
2263 We don't need two @code{\version} commands. We'll need the
2264 @code{melody} section. We don't want two @code{\score} sections
2265 -- if we had two @code{\score}s, we'd get the two parts separately.
2266 We want them together, as a duet. Within the @code{\score}
2267 section, we don't need two @code{\layout} or @code{\midi}.
2269 If we simply cut and paste the @code{melody} section, we would
2270 end up with two @code{melody} definitions. This would not generate
2271 an error, but the second one would be used for both melodies.
2272 So let's rename them to make them distinct. We'll call the
2273 section for the soprano @code{sopranoMusic} and the section for
2274 the cello @code{celloMusic}. While we're doing this, let's rename
2275 @code{text} to be @code{sopranoLyrics}. Remember to rename both
2276 instances of all these names -- both the initial definition (the
2277 @code{melody = \relative c' @{ } part) and the name's use (in the
2278 @code{\score} section).
2280 While we're doing this, let's change the cello part's staff --
2281 celli normally use bass clef. We'll also give the cello some
2285 \version @w{"@version{}"}
2286 sopranoMusic = \relative @{
2293 sopranoLyrics = \lyricmode @{
2297 celloMusic = \relative @{
2306 \new Voice = "one" @{
2310 \new Lyrics \lyricsto "one" \sopranoLyrics
2317 This is looking promising, but the cello part won't appear in the
2318 score -- we haven't used it in the @code{\score} section. If we
2319 want the cello part to appear under the soprano part, we need to add
2322 \new Staff \celloMusic
2326 underneath the soprano stuff. We also need to add @code{<<} and
2327 @code{>>} around the music -- that tells LilyPond that there's
2328 more than one thing (in this case, two @code{Staves}) happening
2329 at once. The @code{\score} looks like this now:
2331 @c Indentation in this example is deliberately poor
2336 \new Voice = "one" @{
2340 \new Lyrics \lyricsto "one" \sopranoLyrics
2342 \new Staff \celloMusic
2350 This looks a bit messy; the indentation is messed up now. That is
2351 easily fixed. Here's the complete soprano and cello template.
2353 @lilypond[quote,verbatim,ragged-right,addversion]
2354 sopranoMusic = \relative {
2361 sopranoLyrics = \lyricmode {
2365 celloMusic = \relative {
2375 \new Voice = "one" {
2379 \new Lyrics \lyricsto "one" \sopranoLyrics
2381 \new Staff \celloMusic
2390 The starting templates can be found in the @q{Templates} appendix,
2391 see @ref{Single staff}.
2394 @node Négyszólamú vegyeskar
2395 @subsection Négyszólamú vegyeskar
2396 @translationof Four-part SATB vocal score
2398 @cindex template, SATB
2399 @cindex SATB template
2401 Most vocal scores of music written for four-part mixed choir
2402 with orchestral accompaniment such as Mendelssohn's Elijah or
2403 Handel's Messiah have the choral music and words on four
2404 staves, one for each of SATB, with a piano reduction of the
2405 orchestral accompaniment underneath. Here's an example
2406 from Handel's Messiah:
2408 @c The following should appear as music without code
2409 @lilypond[quote,ragged-right]
2410 global = { \key d \major \time 4/4 }
2411 sopranoMusic = \relative {
2413 r4 d''2 a4 | d4. d8 a2 | cis4 d cis2 |
2415 sopranoWords = \lyricmode {
2416 Wor -- thy is the lamb that was slain
2418 altoMusic = \relative {
2420 r4 a'2 a4 | fis4. fis8 a2 | g4 fis e2 |
2422 altoWords = \sopranoWords
2423 tenorMusic = \relative {
2425 r4 fis'2 e4 | d4. d8 d2 | e4 a, cis2 |
2427 tenorWords = \sopranoWords
2428 bassMusic = \relative {
2430 r4 d'2 cis4 | b4. b8 fis2 | e4 d a'2 |
2432 bassWords = \sopranoWords
2436 r4 <a' d fis>2 <a e' a>4
2437 <d fis d'>4. <d fis d'>8 <a d a'>2
2438 <g cis g'>4 <a d fis> <a cis e>2
2443 <d, d'>4 <d d'>2 <cis cis'>4
2444 <b b'>4. <b' b'>8 <fis fis'>2
2445 <e e'>4 <d d'> <a' a'>2
2449 << % combine ChoirStaff and PianoStaff in parallel
2451 \new Staff = "sopranos" <<
2452 \set Staff.instrumentName = #"Soprano"
2453 \new Voice = "sopranos" {
2458 \new Lyrics \lyricsto "sopranos" {
2461 \new Staff = "altos" <<
2462 \set Staff.instrumentName = #"Alto"
2463 \new Voice = "altos" {
2468 \new Lyrics \lyricsto "altos" { \altoWords }
2469 \new Staff = "tenors" <<
2470 \set Staff.instrumentName = #"Tenor"
2471 \new Voice = "tenors" {
2476 \new Lyrics \lyricsto "tenors" { \tenorWords }
2477 \new Staff = "basses" <<
2478 \set Staff.instrumentName = #"Bass"
2479 \new Voice = "basses" {
2484 \new Lyrics \lyricsto "basses" {
2489 \set PianoStaff.instrumentName = #"Piano"
2490 \new Staff = "upper" \upper
2491 \new Staff = "lower" \lower
2497 None of the templates provides this layout exactly. The nearest is
2498 @q{SATB vocal score and automatic piano reduction} -- see @ref{Vocal
2499 ensembles} -- but we need to change the layout and add a piano
2500 accompaniment which is not derived automatically from the vocal parts.
2501 The variables holding the music and words for the vocal parts are
2502 fine, but we shall need to add variables for the piano reduction.
2504 The order in which the contexts appear in the ChoirStaff of the
2505 template do not correspond with the order in the vocal score shown
2506 above. We need to rearrange them so there are four staves with the
2507 words written directly underneath the notes for each part. All the
2508 voices should be @code{\voiceOne}, which is the default, so the
2509 @code{\voiceXXX} commands should be removed. We also need to specify
2510 the tenor clef for the tenors. The way in which lyrics are specified
2511 in the template has not yet been encountered so we need to use the
2512 method with which we are familiar. We should also add the names of
2515 Doing this gives for our ChoirStaff:
2519 \new Staff = "sopranos" <<
2520 \set Staff.instrumentName = #"Soprano"
2521 \new Voice = "sopranos" @{
2526 \new Lyrics \lyricsto "sopranos" @{
2529 \new Staff = "altos" <<
2530 \set Staff.instrumentName = #"Alto"
2531 \new Voice = "altos" @{
2536 \new Lyrics \lyricsto "altos" @{
2539 \new Staff = "tenors" <<
2540 \set Staff.instrumentName = #"Tenor"
2541 \new Voice = "tenors" @{
2546 \new Lyrics \lyricsto "tenors" @{
2549 \new Staff = "basses" <<
2550 \set Staff.instrumentName = #"Bass"
2551 \new Voice = "basses" @{
2556 \new Lyrics \lyricsto "basses" @{
2562 Next we must work out the piano part. This is
2563 easy - we just pull out the piano part from the
2564 @q{Solo piano} template:
2568 \set PianoStaff.instrumentName = #"Piano "
2569 \new Staff = "upper" \upper
2570 \new Staff = "lower" \lower
2574 and add the variable definitions for @code{upper}
2577 The ChoirStaff and PianoStaff must be combined
2578 using angle brackets as we want them to be
2579 stacked one above the other:
2582 << % combine ChoirStaff and PianoStaff one above the other
2584 \new Staff = "sopranos" <<
2585 \new Voice = "sopranos" @{
2590 \new Lyrics \lyricsto "sopranos" @{
2593 \new Staff = "altos" <<
2594 \new Voice = "altos" @{
2599 \new Lyrics \lyricsto "altos" @{
2602 \new Staff = "tenors" <<
2603 \clef "G_8" % tenor clef
2604 \new Voice = "tenors" @{
2609 \new Lyrics \lyricsto "tenors" @{
2612 \new Staff = "basses" <<
2614 \new Voice = "basses" @{
2619 \new Lyrics \lyricsto "basses" @{
2625 \set PianoStaff.instrumentName = #"Piano"
2626 \new Staff = "upper" \upper
2627 \new Staff = "lower" \lower
2632 Combining all these together and adding the music
2633 for the three bars of the example above gives:
2635 @lilypond[quote,verbatim,ragged-right,addversion]
2640 sopranoMusic = \relative {
2642 r4 d''2 a4 | d4. d8 a2 | cis4 d cis2 |
2644 sopranoWords = \lyricmode {
2645 Wor -- thy is the lamb that was slain
2647 altoMusic = \relative {
2649 r4 a'2 a4 | fis4. fis8 a2 | g4 fis fis2 |
2651 altoWords = \sopranoWords
2652 tenorMusic = \relative {
2654 r4 fis'2 e4 | d4. d8 d2 | e4 a, cis2 |
2656 tenorWords = \sopranoWords
2657 bassMusic = \relative {
2659 r4 d'2 cis4 | b4. b8 fis2 | e4 d a'2 |
2661 bassWords = \sopranoWords
2665 r4 <a' d fis>2 <a e' a>4
2666 <d fis d'>4. <d fis d'>8 <a d a'>2
2667 <g cis g'>4 <a d fis> <a cis e>2
2672 <d, d'>4 <d d'>2 <cis cis'>4
2673 <b b'>4. <b' b'>8 <fis fis'>2
2674 <e e'>4 <d d'> <a' a'>2
2678 << % combine ChoirStaff and PianoStaff in parallel
2680 \new Staff = "sopranos" <<
2681 \set Staff.instrumentName = #"Soprano"
2682 \new Voice = "sopranos" {
2687 \new Lyrics \lyricsto "sopranos" {
2690 \new Staff = "altos" <<
2691 \set Staff.instrumentName = #"Alto"
2692 \new Voice = "altos" {
2697 \new Lyrics \lyricsto "altos" {
2700 \new Staff = "tenors" <<
2701 \set Staff.instrumentName = #"Tenor"
2702 \new Voice = "tenors" {
2707 \new Lyrics \lyricsto "tenors" {
2710 \new Staff = "basses" <<
2711 \set Staff.instrumentName = #"Bass"
2712 \new Voice = "basses" {
2717 \new Lyrics \lyricsto "basses" {
2723 \set PianoStaff.instrumentName = #"Piano "
2724 \new Staff = "upper" \upper
2725 \new Staff = "lower" \lower
2732 @node Kotta létrehozása az alapoktól
2733 @subsection Kotta létrehozása az alapoktól
2734 @translationof Building a score from scratch
2736 @cindex template, writing your own
2737 @cindex example of writing a score
2738 @cindex writing a score, example
2739 @cindex score, example of writing
2741 After gaining some facility with writing LilyPond code, you
2742 may find that it is easier to build a score from scratch
2743 rather than modifying one of the templates. You can also
2744 develop your own style this way to suit the sort of music you
2745 like. Let's see how to put together the score for an organ
2746 prelude as an example.
2748 We begin with a header section. Here go the title, name
2749 of composer, etc, then come any variable definitions, and
2750 finally the score block. Let's start with these in outline
2751 and fill in the details later.
2753 We'll use the first two bars of Bach's prelude
2754 based on @emph{Jesu, meine Freude} which is written for two
2755 manuals and pedal organ. You can see these two bars of music
2756 at the bottom of this section. The top manual part has two voices,
2757 the lower and pedal organ one each. So we need four
2758 music definitions and one to define the time signature
2762 \version @w{"@version{}"}
2764 title = "Jesu, meine Freude"
2765 composer = "J S Bach"
2771 ManualOneVoiceOneMusic = @{ s1 @}
2772 ManualOneVoiceTwoMusic = @{ s1 @}
2773 ManualTwoMusic = @{ s1 @}
2774 PedalOrganMusic = @{ s1 @}
2780 For now we've just used a spacer note, @code{s1},
2781 instead of the real music. We'll add that later.
2783 Next let's see what should go in the score block.
2784 We simply mirror the staff structure we want.
2785 Organ music is usually written on three staves,
2786 one for each manual and one for the pedals. The
2787 manual staves should be bracketed together, so we
2788 need to use a PianoStaff for them. The first
2789 manual part needs two voices and the second manual
2794 \new Staff = "ManualOne" <<
2796 \ManualOneVoiceOneMusic
2799 \ManualOneVoiceTwoMusic
2801 >> % end ManualOne Staff context
2802 \new Staff = "ManualTwo" <<
2806 >> % end ManualTwo Staff context
2807 >> % end PianoStaff context
2810 Next we need to add a staff for the pedal organ.
2811 This goes underneath the PianoStaff, but it must
2812 be simultaneous with it, so we need angle brackets
2813 around the two. Missing these out would generate
2814 an error in the log file. It's a common mistake
2815 which you'll make sooner or later! Try copying
2816 the final example at the end of this section,
2817 remove these angle brackets, and compile it to
2818 see what errors it generates.
2821 << % PianoStaff and Pedal Staff must be simultaneous
2823 \new Staff = "ManualOne" <<
2825 \ManualOneVoiceOneMusic
2828 \ManualOneVoiceTwoMusic
2830 >> % end ManualOne Staff context
2831 \new Staff = "ManualTwo" <<
2835 >> % end ManualTwo Staff context
2836 >> % end PianoStaff context
2837 \new Staff = "PedalOrgan" <<
2845 It is not necessary to use the simultaneous construct
2846 @code{<< .. >>} for the manual two staff and the pedal organ staff,
2847 since they contain only one music expression, but it does no harm,
2848 and always using angle brackets after @code{\new Staff} is a good
2849 habit to cultivate in case there are multiple voices. The opposite
2850 is true for Voices: these should habitually be followed by braces
2851 @code{@{ .. @}} in case your music is coded in several variables
2852 which need to run consecutively.
2854 Let's add this structure to the score block, and adjust the indenting.
2855 We also add the appropriate clefs, ensure stems, ties and slurs in
2856 each voice on the upper staff point to the right direction with
2857 @code{\voiceOne} and @code{\voiceTwo}, and enter the time signature
2858 and key to each staff using our predefined variable, @code{\TimeKey}.
2862 << % PianoStaff and Pedal Staff must be simultaneous
2864 \new Staff = "ManualOne" <<
2865 \TimeKey % set time signature and key
2869 \ManualOneVoiceOneMusic
2873 \ManualOneVoiceTwoMusic
2875 >> % end ManualOne Staff context
2876 \new Staff = "ManualTwo" <<
2882 >> % end ManualTwo Staff context
2883 >> % end PianoStaff context
2884 \new Staff = "PedalOrgan" <<
2890 >> % end PedalOrgan Staff
2892 @} % end Score context
2895 That completes the structure. Any three-staff organ music
2896 will have a similar structure, although the number of voices
2897 may vary. All that remains now
2898 is to add the music, and combine all the parts together.
2900 @lilypond[quote,verbatim,ragged-right,addversion]
2902 title = "Jesu, meine Freude"
2903 composer = "J S Bach"
2909 ManualOneVoiceOneMusic = \relative {
2913 ManualOneVoiceTwoMusic = \relative {
2914 ees'16 d ees8~ 16 f ees d c8 d~ d c~
2915 c c4 b8 c8. g16 c b c d
2917 ManualTwoMusic = \relative {
2918 c'16 b c8~ 16 b c g a8 g~ 16 g aes ees
2919 f ees f d g aes g f ees d e8~ 8es16 f ees d
2921 PedalOrganMusic = \relative {
2922 r8 c16 d ees d ees8~ 16 a, b g c b c8
2923 r16 g ees f g f g8 c,2
2927 << % PianoStaff and Pedal Staff must be simultaneous
2929 \new Staff = "ManualOne" <<
2930 \TimeKey % set time signature and key
2934 \ManualOneVoiceOneMusic
2938 \ManualOneVoiceTwoMusic
2940 >> % end ManualOne Staff context
2941 \new Staff = "ManualTwo" <<
2947 >> % end ManualTwo Staff context
2948 >> % end PianoStaff context
2949 \new Staff = "PedalOrgan" <<
2955 >> % end PedalOrgan Staff context
2957 } % end Score context
2961 @node Kevesebb gépelés változókkal és függvényekkel
2962 @subsection Kevesebb gépelés változókkal és függvényekkel
2963 @translationof Saving typing with variables and functions
2968 By this point, you've seen this kind of thing:
2970 @lilypond[quote,verbatim,ragged-right]
2971 hornNotes = \relative { c''4 b dis c }
2979 You may even realize that this could be useful in minimalist music:
2981 @lilypond[quote,verbatim,ragged-right]
2982 fragmentA = \relative { a'4 a8. b16 }
2983 fragmentB = \relative { a'8. gis16 ees4 }
2984 violin = \new Staff {
2997 However, you can also use these variables (also known as
2998 macros, or user-defined commands) for tweaks:
3000 @c TODO Avoid padtext - not needed with skylining
3001 @lilypond[quote,verbatim,ragged-right]
3002 dolce = \markup { \italic \bold dolce }
3003 padText = { \once \override TextScript.padding = #5.0 }
3004 fthenp=_\markup { \dynamic f \italic \small { 2nd } \hspace #0.1 \dynamic p }
3005 violin = \relative {
3007 c''4._\dolce b8 a8 g a b
3009 c4.^"hi there!" d8 e' f g d
3010 c,4.\fthenp b8 c4 c-.
3017 \layout { ragged-right=##t }
3021 These variables are obviously useful for saving
3022 typing. But they're worth considering even if you
3023 only use them once -- they reduce complexity. Let's
3024 look at the previous example without any
3025 variables. It's a lot harder to read, especially
3029 violin = \relative @{
3031 c''4._\markup @{ \italic \bold dolce @} b8 a8 g a b
3032 \once \override TextScript.padding = #5.0
3033 c4.^"hi there!" d8 e' f g d
3034 c,4.\markup @{ \dynamic f \italic \small @{ 2nd @}
3035 \hspace #0.1 \dynamic p @}
3041 @c TODO Replace the following with a better example -td
3042 @c Skylining handles this correctly without padText
3044 So far we've seen static substitution -- when LilyPond
3045 sees @code{\padText}, it replaces it with the stuff that
3046 we've defined it to be (ie the stuff to the right of
3049 LilyPond can handle non-static substitution, too (you
3050 can think of these as functions).
3052 @lilypond[quote,verbatim,ragged-right]
3054 #(define-music-function (padding) (number?)
3056 \once \override TextScript.padding = #padding
3060 c'''4^"piu mosso" b a b
3062 c4^"piu mosso" d e f
3064 c4^"piu mosso" fis a g
3068 Using variables is also a good way to reduce work if the
3069 LilyPond input syntax changes (see
3070 @rprogram{Updating files with convert-ly}). If
3071 you have a single definition (such as @code{\dolce}) for all your
3072 input files (see @ref{Style sheets}), then if the syntax changes, you
3073 only need to update your single @code{\dolce} definition,
3074 instead of making changes throughout every @file{.ly} file.
3077 @node Partitúra és szólamkották
3078 @subsection Partitúra és szólamkották
3079 @translationof Scores and parts
3081 In orchestral music, all notes are printed twice. Once in a part for
3082 the musicians, and once in a full score for the conductor. Variables can
3083 be used to avoid double work. The music is entered once, and stored in
3084 a variable. The contents of that variable is then used to generate
3085 both the part and the full score.
3087 It is convenient to define the notes in a special file. For example,
3088 suppose that the file @file{horn-music.ly} contains the following part
3089 of a horn/@/bassoon duo
3092 hornNotes = \relative @{
3099 Then, an individual part is made by putting the following in a file
3102 \include "horn-music.ly"
3104 instrument = "Horn in F"
3108 \transpose f c' \hornNotes
3115 \include "horn-music.ly"
3119 substitutes the contents of @file{horn-music.ly} at this position in
3120 the file, so @code{hornNotes} is defined afterwards. The command
3121 @code{\transpose f@tie{}c'} indicates that the argument, being
3122 @code{\hornNotes}, should be transposed by a fifth upwards. Sounding
3123 @code{f} is denoted by notated @code{c'}, which corresponds with the
3124 tuning of a normal French Horn in@tie{}F. The transposition can be seen
3125 in the following output
3127 @lilypond[quote,ragged-right]
3128 \transpose f c' \relative {
3134 In ensemble pieces, one of the voices often does not play for many
3135 measures. This is denoted by a special rest, the multi-measure
3136 rest. It is entered with a capital @code{R} followed by a duration
3137 (@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
3138 etc.). By multiplying the
3139 duration, longer rests can be constructed. For example, this rest
3140 takes 3@tie{}measures in 2/4 time
3146 When printing the part, multi-rests
3147 must be condensed. This is done by setting a run-time variable
3150 \set Score.skipBars = ##t
3154 This command sets the property @code{skipBars} in the
3155 @code{Score} context to true (@code{##t}). Prepending the rest and
3156 this option to the music above, leads to the following result
3158 @lilypond[quote,ragged-right]
3159 \transpose f c' \relative {
3161 \set Score.skipBars = ##t
3168 The score is made by combining all of the music together. Assuming
3169 that the other voice is in @code{bassoonNotes} in the file
3170 @file{bassoon-music.ly}, a score is made with
3173 \include "bassoon-music.ly"
3174 \include "horn-music.ly"
3177 \new Staff \hornNotes
3178 \new Staff \bassoonNotes
3185 @lilypond[quote,ragged-right]
3194 r4 d,8 f | gis4 c | b bes |
3195 a8 e f4 | g d | gis f |