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.
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:
94 a következő rövidítése:
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
115 @cindex implicit kontextusok
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.
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.}
128 Egyelőre térjünk vissza az első példánkhoz, és vizsgáljuk meg csak a
129 @code{\score} parancsot.
131 A @code{\score} blokkon belül először pontosan egy zenei kifejezésnek kell
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:
139 @var{...egy teljes Wagner-opera zenei anyaga...}
145 Mivel mindez egy @code{@{ ... @}} blokkban szerepel, egy zenei
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:
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ó.
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.
185 @cindex implicit book blokk
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.
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.
201 Egy @code{\book} blokkon belül minden @code{\score} blokk különálló zenei
204 @cindex layout blokk helye
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.
213 A részletek a @ruser{Multiple scores in a book} c. részben olvashatók.
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:
222 dallam = \relative c' @{
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.
242 A bemeneti formátum teljes definíciója a
243 @ruser{File structure} c. szakaszban található.
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
253 @cindex összetett zenei kifejezés
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?
259 Valójában ez sokkal egyszerűbb, mint gondolnánk. Ez a mondat mindent
263 @emph{A @code{\score} blokknak egy összetett zenei kifejezéssel kell
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.
278 \new Staff = "ének" <<
280 \new PianoStaff = "zongora" <<
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.
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.
297 @lilypond[verbatim,quote,ragged-right]
300 \new Staff = "ének" <<
301 \new Voice = "dallam" { c'1 }
304 \new PianoStaff = "zongora" <<
305 \new Staff = "jobbkéz" { c'1 }
306 \new Staff = "balkéz" { c'1 }
313 Most megvan a teljes struktúra. Az énekszólam egy @code{Voice} kontextust
314 tartalmaz a hangoknak, és egy strófányi dalszöveget. A zongoraszólam pedig
315 a jobb- és balkéz kottasorait tartalmazza.
317 Most elkezdhetjük kitölteni a hangokat. Elkezdhetnénk közvetlenül a Voice
318 kontextus belsejébe beleírni, hogy:
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.)
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:
336 @lilypond[verbatim,quote,ragged-right]
337 dallam = \relative c'' { r4 d8\noBeam g, c4 r }
338 dalszöveg = \lyricmode { Szólt az Úr, }
339 jobbkéz = \relative c'' { <g d g,>2~ <g d g,> }
340 balkéz = \relative c { b2 e2 }
344 \new Staff = "ének" <<
345 \new Voice = "dallam" { \dallam }
346 \addlyrics { \dalszöveg }
348 \new PianoStaff = "zongora" <<
349 \new Staff = "jobbkéz" { \jobbkéz }
350 \new Staff = "balkéz" {
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.
367 Referencia: @ruser{Structure of a score}.
370 @node Zenei kifejezések egymásba ágyazása
371 @subsection Zenei kifejezések egymásba ágyazása
372 @translationof Nesting music expressions
374 @cindex ideiglenes kottasorok
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:
380 @lilypond[verbatim,quote,ragged-right]
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).
400 @cindex kottasorok pozíciója
402 Az ossia a kottasor fölött is elhelyezkedhet:
404 @lilypond[verbatim,quote,ragged-right]
405 \new Staff = "main" {
412 alignAboveContext = #"main" }
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).
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.
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
437 @cindex zárójeltípusok
438 @cindex zárójelek egymásba ágyazása
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
445 @multitable @columnfractions .3 .7
446 @headitem Zárójelfajta
448 @item @code{@{ .. @}}
449 @tab Egymás után megszólaló hangokat tartalmaz
451 @tab Egy akkord hangjait tartalmazza
452 @item @code{<< .. >>}
453 @tab Egyszerre megszólaló zenei kifejezéseket tartalmaz
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
459 @tab Egy kézi gerenda kezdetét és végét jelöli
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.
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
474 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
475 { g8\( a b[ c b\) a] }
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.
484 @lilypond[quote,verbatim,fragment,ragged-right]
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.\)
494 @node A szólamok zenét tartalmaznak
495 @section A szólamok zenét tartalmaznak
496 @translationof Voices contain music
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.
503 * Hangzatos szólamok::
504 * Szólamok kézi létrehozása::
505 * Szólamok és vokális zene::
508 @node Hangzatos szólamok
509 @subsection Hangzatos szólamok
510 @translationof I'm hearing Voices
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
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.
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.
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:
543 @lilypond[quote,verbatim,fragment,ragged-right,relative=1]
545 <d g>4 <d fis> <d a'> <d g>
548 A fenti példa leírható egyszerű, kúpos („kacsacsőr”) zárójelekkel, @code{< ... >},
549 így csak egy egyszeres szólamra volt szükségünk. De tegyük fel, hogy, hogy a FISZ
550 egy nyolcad, melyet egy másik G nyolcad követ. Ebben esetben két hangunk van,
551 mely ugyanakkor kezdődik, de különböző hanghosszúságú: a negyed D és a nyolcad FISZ.
552 Hogy írjuk ezt le? Nem írhatjuk akkordként, hiszen egy akkordban minden hang azonos
553 hosszúságú és nem írhatjuk egymást követő hangokként sem, hiszen egy időben kell kezdődniük a hangoknak. Ilyenkor van szükségünk két szólamra.
557 Nézzük, hogy néz ez ki a LilyPond szintaxisában.
562 A legegyszerűbb módja olyan részek rögzítésének, amelyek több mint egy hangot
563 tartalmaznak egy szólamban, hogy szekvenciát @code{@{...@}} használunk és ezt kombináljuk a szögletes zárójelekkel @code{<<...>>}.
564 Az ilyen a részeket @code{\\} segítségével kell elválasztani ahhoz, hogy különböző szólamként jelenjenek meg.
565 Az elválasztó jelek nélkül a hangok egyetlen szólamként szerepelnének, ami általában hibát okoz.
566 Ez a technika használható olyan daraboknál melyek leginkább monofonikusak és néhány részük polifón.
569 Itt egy példa, ami a fenti akkord egyik hangját két szólamra osztja és kötést is tartalmaz:
571 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
573 % 1. szólam 2. szólam
574 << { g4 fis8( g) a4 g } \\ { d4 d d d } >>
577 Vegyük észre, hogy a második hang szárai lefele mutatnak.
580 Íme egy másik egyszerű példa:
582 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
584 % 1. szólam 2. szólam
585 << { r4 g g4. a8 } \\ { d,2 d4 g } >>
586 << { bes4 bes c bes } \\ { g4 g g8( a) g4 } >>
587 << { a2. r4 } \\ { fis2. s4 } >>
590 Nem szükséges, hogy minden ütemet elválasszunk a @code{<< \\ >>} segítségével.
591 Olyan zenék esetén, ahol csak néhány hang van minden ütemben, ez a felépítés
592 segíti a kód olvashatóságát, de ha már sok hang van, akkor jobb, ha a hangokat külön-külön jegyezzük le, például így:
595 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
611 @cindex voices, naming
612 @cindex voices crossing brackets
613 @cindex slurs crossing brackets
614 @cindex ties crossing brackest
617 A fenti példában csak két szólam van, de ha három vagy több szólamot kell
618 lejegyezni, azt is hasonlóan lehet megoldani visszaperjelek (back-slash) használatával.
620 A szólam környezetek nevei @code{"1"}, @code{"2"}, stb.
621 Minden ilyen környezetben a függőleges elrendezés (kötések, szárak, dinamika, stb) megfelelően jelenik meg.
624 @lilypond[quote,verbatim,fragment]
625 \new Staff \relative c' {
628 % 1. szólam 2. szólam 3. szólam
629 << { g4 f e } \\ { r8 e4 d c8~ } >>
630 << { d2 e2 } \\ { c8 b16 a b8 g~ g2 } \\ { s4 b4 c2 } >>
635 A fő szólamtól különválasztva jelennek meg a @code{<< .. >>} között
636 szereplő szólamok (hangok). Ezt hívjuk @emph{szimultán felépítésnek}.
637 Az átkötések és kötőívek csak az azonos szólamon belül kötik
638 össze a hangokat, tehát ezek nem kerülhetnek belülre vagy kívülre a
639 szimultán felépítéshez képest.
640 Fordítva, szimultán felépítés esetén azok a párhuzamos szólamok,
641 amelyek ugyanabban az ötvonalban vannak, egy szólamnak minősülnek.
642 Egyéb szólamhoz kapcsolódó tulajdonságok átöröklődnek a szimultán
643 felépítésbe is. Itt egy másik példa, melynél a különböző szólamokban
644 különböző színű hangok szerepelnek. Vegyük észre, hogy
645 adott szólambeli változások nincsenek hatással más szólamokra,
646 de a változtatások ugyanabban a szólamban később is érvényesek.
647 Vegyük észre azt is, hogy az összekötött hangokat szétválaszthatja
648 az ütemhatár, ahogy a kék háromszöget jelző szólamban láthatjuk:
651 @lilypond[quote,verbatim]
652 \new Staff \relative c' {
667 % 1. szólam folytatása
670 % 2. szólam folytatása
671 { c8 b16 a b8 g ~ g2 }
681 @funindex \voiceOneStyle
682 @funindex \voiceTwoStyle
683 @funindex \voiceThreeStyle
684 @funindex \voiceFourStyle
685 @funindex \voiceNeutralStyle
688 A @code{\voiceXXXStyle} parancsot elsősorban oktatási célra érdemes
689 használni, olyan esetben, mint amilyet ez is. Ezek a parancsok
690 módosítják a hangok színét illetve a kottafejet, a szárat, a
691 gerendákat és a hangfejek stílusát, így lesznek a szólamok könnyen felismerhetőek.
693 Az első szólam piros rombusz, a második kék háromszög, a
694 harmadik zöld áthúzott kör, a negyedik (itt nem használt) magenta kereszt.
695 A @code{\voiceNeutralStyle} (szintén nem használt a fenti példában) visszaállítja
696 a stílust az alapértelmezettre. Később az @ref{Objektumok láthatósága és színe}
697 és @ref{Változók felhasználása a finomhangoláshoz} fejezetekben majd látni fogjuk,
698 hogyan lehet hasonló parancsokat létrehozni.
701 @cindex polyphony and relative note entry
702 @cindex relative note entry and polyphony
705 A polifónia nem változtatja meg a hangjegyek viszonyát a @code{\relative @{ @}} blokkon belül.
706 Minden hangjegy helyzetét az azt megelőző hang illetve első hang helyzete határozza meg.
709 \relative c' @{ noteA << < noteB noteC > \\ noteD >> noteE @}
713 @code{noteB} is relative to @code{noteA} @*
714 @code{noteC} is relative to @code{noteB}, not @code{noteA}; @*
715 @code{noteD} is relative to @code{noteB}, not @code{noteA} or
717 @code{noteE} is relative to @code{noteD}, not @code{noteA}.
720 Van egy másik módszer, ami egyszerűbb, ha a hangjegyek a
721 szólamokon belül teljesen szét vannak választva.
722 Ezt úgy érthetjük el, hogy a @code{\relative} parancsot használjuk minden szólam kezdetén:
726 \relative c' @{ noteA ... @}
728 \relative c'' @{ < noteB noteC > ... @}
730 \relative g' @{ noteD ... @}
732 \relative c' @{ noteE ... @}
735 Végül vizsgáljuk meg a szólamokat összetettebb zene esetén.
736 Nézzük Chopin Deux Nocturne, Op 32. művének első két ütemét.
737 A továbbiakban is ezt a példát fogjuk használni arra, hogy a
738 jelölésekre használható különböző technikákat szemléltessük,
739 ezért tekintsünk el attól, hogy az alábbi kód elsőre rejtélyesnek
740 tűnhet és koncentráljunk csak a zenére és a szólamokra -- a nehezebb részeket majd a későbbi fejezetekben áttekintjük.
744 @c The following should appear as music without code
745 @lilypond[quote,ragged-right]
746 \new Staff \relative c'' {
755 % Az alábbival nem foglalkozunk most, a 4. fejezetben megtalálhatjuk a kód magyarázatát
756 \once \override NoteColumn #'force-hshift = #0
758 \once \override NoteColumn #'force-hshift = #0.5
766 A szárak iránya gyakran jelzi két egyidejű dallamsor folytonosságát.
767 A fenti példánál a legfelső hangjegy szárai felfelé mutatnak, az alsóké mind lefelé.
768 Ez az első jelölés, amire szükségünk van több szólam lejegyzése során.
771 Leginkább viszont akkor van szükségünk többszörös szólamokra, amikor a hangok ugyanakkor kezdődnek ugyan, de különböző hosszúságúak. Nézzük azt a hangot, ami első ütem harmadik ütésekor kezdődik. Az ASZ egy pontozott negyed, az alatta levő F egy pontozatlan negyed, a DESZ pedig egy fél hang. Ezek nem írhatók le akkordként, hiszen akkord esetén minden hang azonos hosszúságú. Nem írhatóak le egymást követő hangokként sem, hiszen egy időben kell kezdődniük. Az ütemnek ebben a részében három szólamra van szükségünk, és normál esetben az egész ütem három szólamú, ahogy az alábbi példa mutatja, ahol különböző hangjegyfejeket használunk különböző színekkel a három szólamhoz. Szeretnénk ismét kihangsúlyozni, hogy az alábbi példa mögötti kódot később elmagyarázzuk, most csak hagyjuk figyelmen kívül azokat a részeket, amik nem érthetőek.
774 @c The following should appear as music without code
775 @c The three voice styles should be defined in -init
776 @lilypond[quote,ragged-right]
777 \new Staff \relative c'' {
788 \\ % Nincs 3. szólam (a hangjegyek szárait lefele szeretnénk)
791 % Az alábbival nem foglalkozunk most, a 4. fejezetben megtalálhatjuk a kód magyarázatát
792 \once \override NoteColumn #'force-hshift = #0
794 \once \override NoteColumn #'force-hshift = #0.5
802 Kezdjük a legelején a fenti zene kódolását.
803 Látni fogjuk, hogy beleütközünk majd több problémába is (de ez ne keserítsen el minket, a lényeg, hogy ezekből tanulunk :) ).
804 Kezdjük azzal, amit tanultunk: a @code{<< \\ >>} használatával.
805 Gépeljük be a három szólam első ütemét:
807 @lilypond[quote,verbatim,fragment,ragged-right]
808 \new Staff \relative c'' {
811 { c2 aes4. bes8 } \\ { aes2 f4 fes } \\ { <ees c>2 des2 }
818 @cindex voices and stem directions
819 @cindex stem directions and voices
823 A szárak iránya automatikusan hozzárendelődik a szólamokhoz, a páratlan-sorszámú szólamoknál felfelé, a párosoknál lefelé. Az első és második szólamhoz tartozó hangok szárai megfelelőek, de a harmadik szólamban a száraknak lefelé kellene állniuk. Ezt úgy javíthatjuk, hogy a harmadik szólamot átugorjuk (üresen hagyjuk) és a negyedik szólamba helyezzük az eredetileg harmadik szólamot. Ezt egyszerűen megtehetjük a @code{\\} segítségével:
826 @lilypond[quote,verbatim,fragment,ragged-right]
827 \new Staff \relative c'' {
833 \\ % 3. szólam - elhagyjuk
842 Látjuk, hogy ez megoldotta a problémát a szárak irányával kapcsolatban,
843 de előhozott egy másikat, ami többszörös szólamoknál néha előfordul --
844 a hangok szárai a szólamon belül ütköznek más kottafejekkel más szólamokban.
845 A hangok megtervezéséhez a LilyPond lehetővé teszi, hogy hangok illetve akkordok esetén, két hang ugyanazt a függőleges pozíciót foglalja el akár ellentétes szárirány esetén, viszont figyelembe veszi azt, hogy bizonyos esetekben a harmadik és a negyedik szólam elmozdulhat, ezzel elkerülve azt, hogy a kottafejek egymást fedjék. Ez általában működik, de a fenti példában egyértelmű, hogy az alacsonyabb szólamok alapértelmezetten nem jól helyezkednek el. Jelenleg még nem vagyunk készen rá, hogy ezt kijavítsuk, úgyhogy most ezt érintetlenül hagyjuk és visszatérünk rá egy későbbi fejezetben -- lásd @code{force-hshift} tulajdonság az @ref{Egymást átfedő jelek javítása} fejezetben.
849 Notation Reference: @ruser{Multiple voices}.
852 @node Szólamok kézi létrehozása
853 @subsection Szólamok kézi létrehozása
854 @translationof Explicitly instantiating voices
861 @funindex \voiceThree
868 @cindex voice contexts, creating
870 A @code{<< >>} blokkon belül is létrehozhatunk polifón zenét és ha szükséges,
871 a @code{\voiceOne} ... @code{\voiceFour} parancsokkal jelezhetjük a szárak, ívek, stb irányát.
872 Hosszabb kották esetén ez a módszer átláthatóbb, mert így külön-külön írhatjuk a szólamokat és beszédesebb neveket is adhatunk nekik.
874 Konkrétan a @code{<< \\ >>}szerkezet, amit az előző fejezetben használtunk:
879 << @{ e4 f g a @} \\ @{ c,4 d e f @} >>
885 egyenértékű az alábbival:
889 \new Voice = "1" @{ \voiceOne \relative c' @{ e4 f g a @} @}
890 \new Voice = "2" @{ \voiceTwo \relative c' @{ c4 d e f @} @}
894 Mindkét fenti esetben az alábbi kottát kapjuk
896 @c The following example should not display the code
897 @lilypond[ragged-right,quote]
899 \new Voice = "1" { \voiceOne \relative c' { e4 f g a } }
900 \new Voice = "2" { \voiceTwo \relative c' { c4 d e f } }
904 @cindex voices, reverting to single
905 @cindex reverting to a single voice
908 A @code{\voiceXXX} parancs meghatározza a szárak irányát, az
909 átkötéseket, a kötőíveket, az artikulációt, a szöveges magyarázatokat,
910 a pontozott hangokat és az ujjrendet. A @code{\voiceOne} és a @code{\voiceThree}
911 hatására a mutató elemek felfele mutatnak, míg a @code{\voiceTwo} és a
912 @code{\voiceFour} esetén lefelé. Ezen parancsok ha szükséges vízszintes
913 eltolást is létrehoznak minden szólam esetén, hogy elkerüljék a kottafejek
914 ütközését. A @code{\oneVoice} parancs visszaállítja a beállításokat a normál egyszeres szólamra.
917 Nézzünk egy egyszerű példát arra, hogy a @code{\oneVoice}, @code{\voiceOne} és @code{\voiceTwo}
918 parancsok milyen hatással vannak a jelzésekre, ívekre illetve dinamikára:
920 @lilypond[quote,ragged-right,verbatim]
922 % Alapértelmezett viselkedés vagy viselkedés \oneVoice után
923 c d8~ d e4( f g a) b-> c
927 @lilypond[quote,ragged-right,verbatim]
930 c d8~ d e4( f g a) b-> c
932 c, d8~ d e4( f g a) b-> c
936 @lilypond[quote,ragged-right,verbatim]
939 c d8~ d e4( f g a) b-> c
941 c, d8~ d e4( f g a) b-> c
945 Nézzük végig a három különböző lejegyzési módját ugyanannak a polifón dallamnak,
946 és vizsgáljuk meg melyik milyen esetben előnyös, használva az előző fejezetbeli példát.
949 A @code{<< >>} közt található kifejezés a főszólamhoz tartozik (jegyezzük meg, hogy a @code{<< >>} használata során ez @strong{nem} igaz).
950 Ez akkor hasznos, amikor további szólamok jelennek meg a főszólam mellett. Egy helyesebb megvalósítása a példánknak alább látható.
951 The red diamond-shaped notes demonstrate that the main melody is now in a single voice context,
952 permitting a phrasing slur to be drawn over them.
954 @lilypond[quote,ragged-right,verbatim]
955 \new Staff \relative c' {
957 % A következő hangok monofónok
959 % Szimultán rész három szólammal
961 % Continue the main voice in parallel
962 { g4 f e | d2 e2) | }
963 % Initiate second voice
965 % Set stems, etc., down
967 r8 e4 d c8~ | c8 b16 a b8 g~ g2 |
969 % Initiate third voice
979 @cindex nesting music expressions
980 @cindex nesting simultaneous constructs
981 @cindex nesting voices
982 @cindex voices, temporary
983 @cindex voices, nesting
985 Létrehozhatunk többszörösen beágyazott polifón szerkezetet is, és ha a szólamok rövidek, az alábbi módon természetesebbnek tűnik a leírásuk:
987 @lilypond[quote,ragged-right,verbatim]
988 \new Staff \relative c' {
991 { g4 f e | d2 e2) | }
996 { c8 b16 a b8 g~ g2 }
1007 @cindex spacing notes
1009 A szólamokat akkor érdemes így írni, ha a zene csak egy kis része polifón. Viszont amikor az egész ötvonalas kotta nagyrésze polifón, egyszerűbb, ha többszörös szólamokat használunk mindenütt, -- ritkított hangokkal, hogy átlépjük azokat a részeket, ahol a szólamok üresek. Az alábbi példa ezt mutatja:
1011 @lilypond[quote,ragged-right,verbatim]
1012 \new Staff \relative c' <<
1013 % Initiate first voice
1016 c16^( d e f g4 f e | d2 e2) |
1018 % Initiate second voice
1020 % Set stems, etc, down
1022 s4 r8 e4 d c8~ | c8 b16 a b8 g~ g2 |
1024 % Initiate third voice
1026 % Set stems, etc, up
1033 @subsubheading Hangoszlopok
1036 @cindex note collisions
1037 @cindex collisions, notes
1038 @cindex shift commands
1045 @funindex \shiftOnnn
1049 Egymáshoz közel elhelyezkedő, különböző szólamban levő hangok esetén
1050 kettő, esetenként több oszlopba rendezzük a hangokat, hogy a kottafejek
1051 fedését elkerüljük. Ezeket hangoszlopoknak hívjuk. Különálló oszlopokat
1052 hozunk létre minden szólamhoz és az éppen aktuális szólam-független eltolást
1053 minden oszlopra alkalmazzuk, ezzel elkerülve az ütközéseket. A fenti példában
1054 is ezt láthatjuk. A 2. ütemben a C a kettes szólamban eltolódik a D-tól jobbra
1055 (ami az első szólamban van) és a végső C akkord a hármas szólamban szintén eltolódik jobbra a többi hangtól.
1057 A @code{\shiftOn}, @code{\shiftOnn}, @code{\shiftOnnn}, és
1058 @code{\shiftOff} parancsok meghatározzák, hogy melyik hangot vagy akkordot milyen mértékben kell megemelnünk ahhoz, hogy az ütközést elkerüljük. Alapértelmezett esetben, a külső szólamokban (az egyes és a kettes szólamban) a @code{\shiftOff} érvényes, amíg a köztes szólamokban (hármas és négyes) a @code{\shiftOn}. Eltolás esetén az egyes és a hármas szólam jobbra a kettes és a négyes balra tolódik
1061 A @code{\shiftOnn} és @code{\shiftOnnn} további eltolási szinteket
1062 határoznak meg, melyek összetett esetekben ideiglenesen szükségesek
1063 lehetnek ahhoz, hogy elkerüljük az ütközéseket – lásd @ref{Valós zenei példa}.
1065 Egy hangoszlop egyszerre csak egy hangot (vagy akkordot) tartalmazhat egy szólamból
1066 szárral felfelé és egy másikat szárral lefelé. Ha két különböző szólambeli hang
1067 azonos irányú szárral kerül ugyanabba a pozícióba és egyik szólamban sincs eltolás
1068 vagy ugyanazt az eltolást adjuk meg, akkor a @qq{Too many clashing note columns} hibaüzenetet kapjuk.
1072 Notation Reference: @ruser{Multiple voices}.
1075 @node Szólamok és vokális zene
1076 @subsection Szólamok és vokális zene
1077 @translationof Voices and vocals
1079 Vocal music presents a special difficulty: we need to combine two
1080 expressions -- notes and lyrics.
1082 @funindex \new Lyrics
1086 @cindex Lyrics context, creating
1087 @cindex lyrics, linking to voice
1089 You have already seen the @code{\addlyrics@{@}} command, which
1090 handles simple scores well. However, this technique is
1091 quite limited. For more complex music, you must introduce the
1092 lyrics in a @code{Lyrics} context using @code{\new Lyrics} and
1094 the lyrics to the notes with @code{\lyricsto@{@}}, using the
1095 name assigned to the Voice.
1097 @lilypond[quote,verbatim,fragment]
1099 \new Voice = "one" \relative c'' {
1102 c4 b8. a16 g4. f8 e4 d c2
1104 \new Lyrics \lyricsto "one" {
1105 No more let sins and sor -- rows grow.
1110 Note that the lyrics must be linked to a @code{Voice} context,
1111 @emph{not} a @code{Staff} context. This is a case where it is
1112 necessary to create @code{Staff} and @code{Voice} contexts
1115 @cindex lyrics and beaming
1116 @cindex beaming and lyrics
1117 @funindex \autoBeamOff
1118 @funindex autoBeamOff
1120 The automatic beaming which LilyPond uses by default works well
1121 for instrumental music, but not so well for music with lyrics,
1122 where beaming is either not required at all or is used to indicate
1123 melismata in the lyrics. In the example above we use the command
1124 @code{\autoBeamOff} to turn off the automatic beaming.
1126 @funindex \new ChoirStaff
1127 @funindex ChoirStaff
1128 @funindex \lyricmode
1130 @cindex vocal score structure
1133 Let us reuse the earlier example from Judas Maccabæus to
1134 illustrate this more flexible technique. We first recast
1135 it to use variables so the music and lyrics can be separated
1136 from the staff structure. We also introduce a ChoirStaff
1137 bracket. The lyrics themselves must be introduced with
1138 @code{\lyricmode} to ensure they are interpreted as lyrics
1141 @lilypond[quote,verbatim]
1142 global = { \time 6/8 \partial 8 \key f \major}
1143 SopOneMusic = \relative c'' {
1144 c8 | c([ bes)] a a([ g)] f | f'4. b, | c4.~ 4 | }
1145 SopTwoMusic = \relative c' {
1146 r8 | r4. r4 c8 | a'([ g)] f f([ e)] d | e([ d)] c bes' | }
1147 SopOneLyrics = \lyricmode {
1148 Let | flee -- cy flocks the | hills a -- dorn, __ | }
1149 SopTwoLyrics = \lyricmode {
1150 Let | flee -- cy flocks the | hills a -- dorn, | }
1155 \new Voice = "SopOne" {
1159 \new Lyrics \lyricsto "SopOne" {
1164 \new Voice = "SopTwo" {
1168 \new Lyrics \lyricsto "SopTwo" {
1176 This is the basic structure of all vocal scores. More staves may be
1177 added as required, more voices may be added to the staves, more verses
1178 may be added to the lyrics, and the variables containing the music can
1179 easily be placed in separate files should they become too long.
1181 @cindex hymn structure
1182 @cindex SATB structure
1183 @cindex vocal scores with multiple verses
1184 @cindex multiple vocal verses
1185 @cindex verses, multiple vocal
1187 Here is an example of the first line of a hymn with four
1188 verses, set for SATB. In this case the words for all four
1189 parts are the same. Note how we use variables to separate the
1190 music notation and words from the staff structure. See too
1191 how a variable, which we have chosen to call @q{TimeKey}, is used
1192 to hold several commands for use within the two staves. In other
1193 examples this is often called @q{global}.
1195 @lilypond[quote,verbatim]
1196 TimeKey = { \time 4/4 \partial 4 \key c \major}
1197 SopMusic = \relative c' { c4 | e4. e8 g4 g | a a g | }
1198 AltoMusic = \relative c' { c4 | c4. c8 e4 e | f f e | }
1199 TenorMusic = \relative c { e4 | g4. g8 c4. b8 | a8 b c d e4 | }
1200 BassMusic = \relative c { c4 | c4. c8 c4 c | f8 g a b c4 | }
1201 VerseOne = \lyricmode {
1202 E -- | ter -- nal fa -- ther, | strong to save, | }
1203 VerseTwo = \lyricmode {
1204 O | Christ, whose voice the | wa -- ters heard, | }
1205 VerseThree = \lyricmode {
1206 O | Ho -- ly Spi -- rit, | who didst brood | }
1207 VerseFour = \lyricmode {
1208 O | Tri -- ni -- ty of | love and pow'r | }
1214 \new Voice = "Sop" { \voiceOne \TimeKey \SopMusic }
1215 \new Voice = "Alto" { \voiceTwo \AltoMusic }
1216 \new Lyrics \lyricsto "Sop" { \VerseOne }
1217 \new Lyrics \lyricsto "Sop" { \VerseTwo }
1218 \new Lyrics \lyricsto "Sop" { \VerseThree }
1219 \new Lyrics \lyricsto "Sop" { \VerseFour }
1223 \new Voice = "Tenor" { \voiceOne \TimeKey \TenorMusic }
1224 \new Voice = "Bass" { \voiceTwo \BassMusic }
1230 @cindex verse and refrain
1232 We end with an example to show how we might code a solo verse which
1233 continues into a two-part refrain in two staves. The positioning
1234 of the sequential and simultaneous sections to achieve this within
1235 a single score is quite tricky, so follow the explanation carefully!
1237 Let's start with a score block containing a @code{ChoirStaff}, as
1238 we would like the brace to appear at the start of the chorus.
1239 Normally you would need angle brackets after @code{\new ChoirStaff}
1240 to bring in all the staves in parallel, but here we want to
1241 defer the parallelism during the solo so we use braces, although
1242 angle brackets here wouldn't hurt. Inside the @code{ChoirStaff} we
1243 want first the staff which will contain the verse. This must
1244 contain notes and lyrics in parallel, so here we need angle
1245 brackets around the @code{\new Voice} and @code{\new Lyrics} to
1246 start them at the same time:
1248 @lilypond[quote,verbatim,ragged-right]
1249 versenotes = \relative c'' {
1255 versewords = \lyricmode {
1256 One two three four five six
1261 \new Voice = "verse" {
1264 \new Lyrics \lyricsto verse {
1272 That gives the verse line.
1274 Now we want to continue with refrainA on the same staff while a
1275 second staff is introduced in parallel with it for refrainB, so
1276 this is a parallel section which must be positioned immediately
1277 following the @code{\break} in the verse Voice. Yes, @emph{within}
1278 the verse Voice! Here's that parallel section. More staves
1279 could be introduced here in the same way.
1284 \new Lyrics \lyricsto verse @{
1288 \new Voice = "refrainB" @{
1291 \new Lyrics \lyricsto "refrainB" @{
1298 Here's the final result with two staves in the chorus showing
1299 how the parallel section is positioned within the verse Voice:
1301 @lilypond[quote,verbatim, ragged-right]
1302 versenotes = \relative c'' {
1308 refrainnotesA = \relative c'' {
1312 refrainnotesB = \relative c {
1317 versewords = \lyricmode {
1318 One two three four five six
1320 refrainwordsA = \lyricmode {
1323 refrainwordsB = \lyricmode {
1329 \new Voice = "verse" {
1333 \new Lyrics \lyricsto "verse" {
1337 \new Voice = "refrainB" {
1340 \new Lyrics \lyricsto "refrainB" {
1346 \new Lyrics \lyricsto "verse" {
1354 @cindex book, example of using
1358 However, although this is an interesting and useful exercise to
1359 help you to understand how sequential and simultaneous blocks work,
1360 in practice one would perhaps choose to code this as two
1361 @code{\score} blocks within an implicit @code{\book} block, as
1364 @lilypond[quote,verbatim,ragged-right]
1365 versenotes = \relative c'' {
1371 refrainnotesA = \relative c'' {
1375 refrainnotesB = \relative c {
1380 versewords = \lyricmode {
1381 One two three four five six
1383 refrainwordsA = \lyricmode {
1386 refrainwordsB = \lyricmode {
1391 \new Voice = "verse" {
1394 \new Lyrics \lyricsto "verse" {
1403 \new Voice = "refrainA" {
1406 \new Lyrics \lyricsto "refrainA" {
1411 \new Voice = "refrainB" {
1414 \new Lyrics \lyricsto "refrainB" {
1424 Notation Reference: @ruser{Vocal music}.
1427 @node Kontextusok és ábrázolók
1428 @section Kontextusok és ábrázolók
1429 @translationof Contexts and engravers
1432 Kontextusok és ábrázolók have been mentioned informally
1433 in earlier sections; we now must look at
1434 these concepts in more detail, as they are important
1435 in the fine-tuning of LilyPond output.
1439 * A kontextus fogalma::
1440 * Kontextusok létrehozása::
1441 * Az ábrázoló fogalma::
1442 * Kontextusok tulajdonságainak módosítása::
1443 * Ábrázolók hozzáadása és eltávolítása::
1446 @node A kontextus fogalma
1447 @subsection A kontextus fogalma
1448 @translationof Contexts explained
1450 @cindex contexts explained
1452 When music is printed, many notational elements which do not
1453 appear explicitly in the input file must be added to the
1454 output. For example, compare the input and output of the
1457 @lilypond[quote,verbatim,relative=2,fragment]
1461 The input is rather sparse, but in the output, bar lines,
1462 accidentals, clef, and time signature have been added. When
1463 LilyPond @emph{interprets} the input the musical information
1464 is parsed from left to right, similar to the way a performer
1465 reads the score. While reading the input, the program remembers
1466 where measure boundaries are, and which pitches require explicit
1467 accidentals. This information must be held on several levels.
1468 For example, an accidental affects only a single staff, while
1469 a bar line must be synchronized across the entire score.
1471 Within LilyPond, these rules and bits of information are grouped in
1472 @emph{Contexts}. We have already introduced the @code{Voice} context.
1473 Others are the @code{Staff} and @code{Score} contexts. Contexts are
1474 hierarchical to reflect the hierarchical nature of a musical score.
1475 For example: a @code{Staff} context can contain many @code{Voice}
1476 contexts, and a @code{Score} context can contain many @code{Staff}
1480 @sourceimage{context-example,5cm,,}
1483 Each context has the responsibility for enforcing some notation rules,
1484 creating some notation objects and maintaining the associated
1485 properties. For example, the @code{Voice} context may introduce an
1486 accidental and then the @code{Staff} context maintains the rule to
1487 show or suppress the accidental for the remainder of the measure.
1489 As another example, the synchronization of bar lines is, by default,
1490 handled in the @code{Score} context.
1491 However, in some music we may not want the bar lines to be
1492 synchronized -- consider a polymetric score in 4/4 and 3/4 time.
1493 In such cases, we must modify the default settings of the
1494 @code{Score} and @code{Staff} contexts.
1496 For very simple scores, contexts are created implicitly, and you need
1497 not be aware of them. For larger pieces, such as anything with more
1498 than one staff, they must be
1499 created explicitly to make sure that you get as many staves as you
1500 need, and that they are in the correct order. For typesetting pieces
1501 with specialized notation, it is usual to modify existing, or
1502 even to define totally new, contexts.
1504 In addition to the @code{Score,} @code{Staff} and
1505 @code{Voice} contexts there are contexts which fit between
1506 the score and staff levels to control staff groups, such as the
1507 @code{PianoStaff} and @code{ChoirStaff} contexts. There
1508 are also alternative staff and voice contexts, and contexts for
1509 lyrics, percussion, fret boards, figured bass, etc.
1511 The names of all context types are formed from one or more
1512 words, each word being capitalized and joined immediately to the
1513 preceding word with no hyphen or underscore, e.g.,
1514 @code{GregorianTranscriptionStaff}.
1518 Notation Reference: @ruser{A kontextus fogalma}.
1521 @node Kontextusok létrehozása
1522 @subsection Kontextusok létrehozása
1523 @translationof Creating contexts
1528 @cindex new contexts
1529 @cindex creating contexts
1530 @cindex contexts, creating
1532 In an input file a score block, introduced with a @code{\score}
1533 command, contains a single music expression and an associated
1534 output definition (either a @code{\layout} or a @code{\midi} block).
1535 The @code{Score} context is usually left to be created automatically
1536 when the interpretation of that music expression starts.
1538 For scores with only one voice and one staff, the @code{Voice} and
1539 @code{Staff} contexts may also be left to be created automatically,
1540 but for more complex scores it is necessary to create them by hand.
1541 The simplest command that does this is @code{\new}. It is prepended
1542 to a music expression, for example
1545 \new @var{type} @var{music-expression}
1549 where @var{type} is a context name (like @code{Staff} or
1550 @code{Voice}). This command creates a new context, and starts
1551 interpreting the @var{music-expression} within that context.
1553 (Note that a @code{\new Score} command is not normally required,
1554 as the essential top-level @code{Score} context is created
1555 automatically when the music expression within the @code{\score}
1556 block is interpreted. The only reason for creating a @code{Score}
1557 context explicitly using @code{\new Score} is to introduce a
1558 @code{\with} block in which one or more score-wide default values
1559 of context properties may be specified. Information on using
1560 @code{\with} blocks can be found under the heading
1561 @qq{Setting context properties with @code{\\with} } in
1562 @ref{Kontextusok tulajdonságainak módosítása}.)
1564 You have seen many practical examples which created new
1565 @code{Staff} and @code{Voice} contexts in earlier sections, but
1566 to remind you how these commands are used in practice, here's an
1567 annotated real-music example:
1569 @lilypond[quote,verbatim,ragged-right]
1570 \score { % start of single compound music expression
1571 << % start of simultaneous staves section
1573 \new Staff { % create RH staff
1576 \new Voice { % create voice for RH notes
1577 \relative c'' { % start of RH notes
1583 \new Staff << % create LH staff; needs two simultaneous voices
1586 \new Voice { % create LH voice one
1588 \relative g { % start of LH voice one notes
1589 g8 <bes d> ees, <g c>
1590 g8 <bes d> ees, <g c>
1591 } % end of LH voice one notes
1592 } % end of LH voice one
1593 \new Voice { % create LH voice two
1595 \relative g { % start of LH voice two notes
1598 } % end of LH voice two notes
1599 } % end of LH voice two
1600 >> % end of LH staff
1601 >> % end of simultaneous staves section
1602 } % end of single compound music expression
1605 (Note how all the statements which open a block with either a
1606 curly bracket, @code{@{}, or double angle brackets, @code{<<},
1607 are indented by two further spaces, and the corresponding
1608 closing bracket is indented by exactly the same amount. While
1609 this is not required, following this practice will greatly
1610 reduce the number of @q{unmatched bracket} errors, and is
1611 strongly recommended. It enables the structure of the music to
1612 be seen at a glance, and any unmatched brackets will be obvious.
1613 Note too how the LH staff is created using double angle brackets
1614 because it requires two voices for its music, whereas the RH staff
1615 is created with a single music expression surrounded by curly
1616 brackets because it requires only one voice.)
1618 @cindex contexts, naming
1619 @cindex naming contexts
1621 The @code{\new} command may also give an identifying name to the
1622 context to distinguish it from other contexts of the same type,
1625 \new @var{type} = @var{id} @var{music-expression}
1628 Note the distinction between the name of the context type,
1629 @code{Staff}, @code{Voice}, etc, and the identifying name of a
1630 particular instance of that type, which can be any sequence of letters
1631 invented by the user. Digits and spaces can also be used in the
1632 identifying name, but then it has to be placed in quotes,
1633 i.e. @code{\new Staff = "MyStaff 1" @var{music-expression}}.
1634 The identifying name is used to
1635 refer back to that particular instance of a context. We saw this in
1636 use in the section on lyrics, see @ref{Szólamok és vokális zene}.
1640 Notation Reference: @ruser{Kontextusok létrehozása}.
1643 @node Az ábrázoló fogalma
1644 @subsection Az ábrázoló fogalma
1645 @translationof Engravers explained
1649 Every mark on the printed output of a score produced by LilyPond
1650 is produced by an @code{Engraver}. Thus there is an engraver
1651 to print staves, one to print note heads, one for stems, one for
1652 beams, etc, etc. In total there are over 120 such engravers!
1653 Fortunately, for most scores it is not necessary to know about
1654 more than a few, and for simple scores you do not need to know
1657 Engravers live and operate in Contexts. Engravers such as the
1658 @code{Metronome_mark_engraver}, whose action and output apply to the
1659 score as a whole, operate in the highest level context -- the
1660 @code{Score} context.
1662 The @code{Clef_engraver} and @code{Key_engraver} are to be
1663 found in every @code{Staff} Context, as different staves may require
1664 different clefs and keys.
1666 The @code{Note_heads_engraver} and @code{Stem_engraver} live
1667 in every @code{Voice} context, the lowest level context of all.
1669 Each engraver processes the particular objects associated
1670 with its function, and maintains the properties that relate
1671 to that function. These properties, like the properties
1672 associated with contexts, may be modified to change the
1673 operation of the engraver or the appearance of those elements
1674 in the printed score.
1676 Engravers all have compound names formed from words which
1677 describe their function. Just the first word is capitalized,
1678 and the remainder are joined to it with underscores. Thus
1679 the @code{Staff_symbol_engraver} is responsible for creating the
1680 lines of the staff, the @code{Clef_engraver} determines and sets
1681 the pitch reference point on the staff by drawing a clef symbol.
1683 Here are some of the most common engravers together with their
1684 function. You will see it is usually easy to guess the function
1685 from the name, or vice versa.
1687 @multitable @columnfractions .3 .7
1690 @item Accidental_engraver
1691 @tab Makes accidentals, cautionary and suggested accidentals
1696 @item Completion_heads_engraver
1697 @tab Splits notes which cross bar lines
1698 @item Dynamic_engraver
1699 @tab Creates hairpins and dynamic texts
1700 @item Forbid_line_break_engraver
1701 @tab Prevents line breaks if a musical element is still active
1703 @tab Creates the key signature
1704 @item Metronome_mark_engraver
1705 @tab Engraves metronome marking
1706 @item Note_heads_engraver
1707 @tab Engraves note heads
1710 @item Staff_symbol_engraver
1711 @tab Engraves the five (by default) lines of the staff
1713 @tab Creates stems and single-stem tremolos
1714 @item Time_signature_engraver
1715 @tab Creates time signatures
1720 We shall see later how the output of LilyPond can be changed
1721 by modifying the action of Engravers.
1725 Internals reference: @rinternals{Engravers and Performers}.
1728 @node Kontextusok tulajdonságainak módosítása
1729 @subsection Kontextusok tulajdonságainak módosítása
1730 @translationof Modifying context properties
1732 @cindex context properties
1733 @cindex context properties, modifying
1734 @cindex modifying context properties
1740 Contexts are responsible for holding the values of a number of
1741 context @emph{properties}. Many of them can be changed to
1742 influence the interpretation of the input and so change the
1743 appearance of the output. They are changed by the
1744 @code{\set} command. This takes the form
1747 \set @emph{ContextName}.@emph{propertyName} = #@emph{value}
1750 Where the @emph{ContextName} is usually @code{Score},
1751 @code{Staff} or @code{Voice}. It may be omitted,
1752 in which case the current context (typically @code{Voice}) is assumed.
1754 The names of context properties consist of words joined
1755 together with no hyphens or underscores, all except the
1756 first having a capital letter. Here are a few examples
1757 of some commonly used ones. There are many more.
1759 @c attempt to force this onto a new page
1761 @multitable @columnfractions .25 .15 .45 .15
1762 @headitem propertyName
1768 @tab If true, set extra natural signs before accidentals
1769 @tab @code{#t}, @code{#f}
1770 @item currentBarNumber
1772 @tab Set the current bar number
1776 @tab If true, print slurs both above and below notes
1777 @tab @code{#t}, @code{#f}
1778 @item instrumentName
1780 @tab Set the name to be placed at the start of the staff
1781 @tab @code{"Cello I"}
1784 @tab Increase or decrease the font size
1788 @tab Set the text to print before the start of a verse
1793 where a Boolean is either True (@code{#t}) or False (@code{#f}),
1794 an Integer is a positive whole number, a Real is a positive
1795 or negative decimal number, and text is enclosed in double
1796 apostrophes. Note the occurrence of hash signs,
1797 (@code{#}), in two different places -- as part of the Boolean
1798 value before the @code{t} or @code{f}, and before @emph{value}
1799 in the @code{\set} statement. So when a Boolean is being
1800 entered you need to code two hash signs, e.g., @code{##t}.
1802 @cindex properties operating in contexts
1803 @cindex setting properties within contexts
1805 Before we can set any of these properties we need to know
1806 in which context they operate. Sometimes this is obvious,
1807 but occasionally it can be tricky. If the wrong context
1808 is specified, no error message is produced, but the expected
1809 action will not take place. For example, the
1810 @code{instrumentName} clearly lives in the @code{Staff} context, since
1811 it is the staff that is to be named.
1812 In this example the first staff is labeled, but not the second,
1813 because we omitted the context name.
1815 @lilypond[quote,verbatim,ragged-right]
1817 \new Staff \relative c'' {
1818 \set Staff.instrumentName = #"Soprano"
1821 \new Staff \relative c' {
1822 \set instrumentName = #"Alto" % Wrong!
1828 Remember the default context name is @code{Voice}, so the second
1829 @code{\set} command set the property @code{instrumentName} in the
1830 @code{Voice} context to @qq{Alto}, but as LilyPond does not look
1831 for any such property in the @code{Voice} context, no
1832 further action took place. This is not an error, and no error
1833 message is logged in the log file.
1835 Similarly, if the property name is mis-spelt no error message is
1836 produced, and clearly the expected action cannot be performed. In
1837 fact, you can set any (fictitious) @q{property} using any name you
1838 like in any context that exists by using the @code{\set} command. But
1839 if the name is not known to LilyPond it will not cause any action to
1840 be taken. Some text editors with special support for LilyPond input
1841 files document property names with bullets when you hover them with
1842 the mouse, like JEdit with LilyPondTool, or highlight unknown property
1843 names differently, like ConTEXT. If you do not use an editor with
1844 such features, it is recommended to check the property name in the
1845 Internals Reference: see @rinternals{Tunable context properties}, or
1846 @rinternals{Contexts}.
1848 The @code{instrumentName} property will take effect only
1849 if it is set in the @code{Staff} context, but
1850 some properties can be set in more than one context.
1851 For example, the property @code{extraNatural} is by
1852 default set to ##t (true) for all staves.
1853 If it is set to ##f (false) in one particular @code{Staff}
1854 context it applies just to the accidentals on that staff.
1855 If it is set to false in the @code{Score} context
1856 it applies to all staves.
1858 So this turns off extra naturals in one staff:
1860 @lilypond[quote,verbatim,ragged-right]
1862 \new Staff \relative c'' {
1865 \new Staff \relative c'' {
1866 \set Staff.extraNatural = ##f
1873 and this turns them off in all staves:
1875 @lilypond[quote,verbatim,ragged-right]
1877 \new Staff \relative c'' {
1880 \new Staff \relative c'' {
1881 \set Score.extraNatural = ##f
1887 As another example, if @code{clefTransposition} is set in
1888 the @code{Score} context this immediately changes the value
1889 of the octavation in all current staves and sets a new default
1890 value which will be applied to all staves.
1892 The opposite command, @code{\unset}, effectively removes the
1893 property from the context, which causes most properties to
1894 revert to their default value. Usually @code{\unset} is not
1895 required as a new @code{\set} command will achieve what is
1898 The @code{\set} and @code{\unset} commands can appear anywhere
1899 in the input file and will take effect from the time they are
1900 encountered until the end of the score or until the property is
1901 @code{\set} or @code{\unset} again. Let's try changing the
1902 font size, which affects the size of the note heads (among
1903 other things) several times. The change is from the default
1904 value, not the most recently set value.
1906 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
1908 % make note heads smaller
1911 % make note heads larger
1912 \set fontSize = #2.5
1914 % return to default size
1919 We have now seen how to set the values of several different types of
1920 property. Note that integers and numbers are always preceded by a
1921 hash sign, @code{#}, while a true or false value is specified by
1922 @code{##t} and @code{##f}, with two hash signs. A text property
1923 should be enclosed in double quotation signs, as above, although we
1924 shall see later that text can actually be specified in a much more
1925 general way by using the very powerful @code{\markup} command.
1927 @subsubheading Setting context properties with @code{\with}
1931 @cindex context properties, setting with \with
1933 The default value of context properties may be set at the time the
1934 context is created. Sometimes this is a clearer way of setting a
1935 property value if it is to remain fixed for the duration of
1936 the context. When a context is created with a @code{\new}
1937 command it may be followed immediately by a @code{\with @{ .. @}}
1938 block in which the default property values are set. For example,
1939 if we wish to suppress the printing of extra naturals for the
1940 duration of a staff we would write:
1943 \new Staff \with @{ extraNatural = ##f @}
1949 @lilypond[quote,verbatim,ragged-right]
1955 \new Staff \with { extraNatural = ##f }
1962 Or, if the property override is to be applied to all staves
1963 within the score, it may be appended to an explicit
1964 @code{\new Score} command, like this:
1966 @lilypond[quote,verbatim,ragged-right]
1968 \new Score \with { extraNatural = ##f } <<
1983 Properties set in this way may still be changed dynamically using
1984 @code{\set} and returned to the default value set in the
1985 @code{\with} block with @code{\unset}.
1987 @cindex fontSize, default and setting
1989 So if the @code{fontSize} property is set in a @code{\with} clause
1990 it sets the default value of the font size. If it is later changed
1991 with @code{\set}, this new default value may be restored with the
1992 @code{\unset fontSize} command.
1994 @subsubheading Setting context properties with @code{\context}
1996 @cindex context properties, setting with \context
2000 The values of context properties may be set in @emph{all} contexts
2001 of a particular type, such as all @code{Staff} contexts, with a single
2002 command. The context type is identified by using its
2003 type name, like @code{Staff}, prefixed by a back-slash: @code{\Staff}.
2004 The statement which sets the property value is the same as that in a
2005 @code{\with} block, introduced above. It is placed in a
2006 @code{\context} block within a @code{\layout} block. Each
2007 @code{\context} block will affect all contexts of the type specified
2008 throughout the @code{\score} or @code{\book} block in which the
2009 @code{\layout} block appears. Here is a example to show the format:
2011 @lilypond[verbatim,quote]
2028 Context properties set in this way may be overridden for particular
2029 instances of contexts by statements in a @code{\with} block, and by
2030 @code{\set} commands embedded in music statements.
2035 @ruser{Changing context default settings}.
2036 @ruser{The set command}.
2038 Internals Reference:
2039 @rinternals{Contexts},
2040 @rinternals{Tunable context properties}.
2043 @node Ábrázolók hozzáadása és eltávolítása
2044 @subsection Ábrázolók hozzáadása és eltávolítása
2045 @translationof Adding and removing engravers
2047 @cindex engravers, adding
2048 @cindex adding engravers
2049 @cindex engravers, removing
2050 @cindex removing engravers
2057 We have seen that contexts each contain several engravers, each
2058 of which is responsible for producing a particular part of the
2059 output, like bar lines, staves, note heads, stems, etc. If an
2060 engraver is removed from a context, it can no longer produce its
2061 output. This is a crude way of modifying the output, but it
2062 can sometimes be useful.
2064 @subsubheading Changing a single context
2066 To remove an engraver from a single context we use the
2067 @code{\with} command placed immediately after the context creation
2068 command, as in the previous section.
2070 As an illustration, let's repeat an example from the previous section
2071 with the staff lines removed. Remember that the staff lines are
2072 produced by the @code{Staff_symbol_engraver}.
2074 @lilypond[quote,verbatim,ragged-right]
2076 \remove "Staff_symbol_engraver"
2080 \set fontSize = #-4 % make note heads smaller
2082 \set fontSize = #2.5 % make note heads larger
2084 \unset fontSize % return to default size
2089 @cindex ambitus engraver
2091 Engravers can also be added to individual contexts.
2092 The command to do this is
2094 @code{\consists @var{Engraver_name}},
2097 placed inside a @code{\with} block. Some vocal scores have an ambitus
2098 placed at the beginning of a staff to indicate the range of notes in
2099 that staff -- see @rglos{ambitus}. The ambitus is produced by the
2100 @code{Ambitus_engraver}, which is not normally included in any
2101 context. If we add it to the @code{Voice} context, it calculates the
2102 range from that voice only:
2104 @lilypond[quote,verbatim,ragged-right]
2107 \consists "Ambitus_engraver"
2122 but if we add the ambitus engraver to the
2123 @code{Staff} context, it calculates the range from all
2124 the notes in all the voices on that staff:
2126 @lilypond[quote,verbatim,ragged-right]
2128 \consists "Ambitus_engraver"
2144 @subsubheading Changing all contexts of the same type
2149 The examples above show how to remove or add engravers to
2150 individual contexts. It is also possible to remove or add
2151 engravers to every context of a specific type by placing the
2152 commands in the appropriate context in a @code{\layout}
2153 block. For example, if we wanted to show an ambitus for every
2154 staff in a four-staff score, we could write
2156 @lilypond[quote,verbatim,ragged-right]
2185 \consists "Ambitus_engraver"
2192 The values of context properties may also be set
2193 for all contexts of a particular type by including the
2194 @code{\set} command in a @code{\context} block in the
2199 Notation Reference: @ruser{Modifying context plug-ins},
2200 @ruser{Changing context default settings}.
2203 @node A sablonok kibővítése
2204 @section A sablonok kibővítése
2205 @translationof Extending the templates
2207 You've read the tutorial, you know how to write music, you
2208 understand the fundamental concepts. But how can you
2209 get the staves that you want? Well, you can find lots of
2210 templates (see @ref{Templates}) which may give you a start.
2211 But what if you want something that isn't covered there? Read on.
2214 * Szoprán és cselló::
2215 * Négyszólamú vegyeskar::
2216 * Kotta létrehozása az alapoktól::
2217 * Kevesebb gépelés változókkal és függvényekkel::
2218 * Partitúra és szólamkották::
2221 @node Szoprán és cselló
2222 @subsection Szoprán és cselló
2223 @translationof Soprano and cello
2225 @cindex template, modifying
2226 @cindex modifying templates
2228 Start off with the template that seems closest to what you want to
2229 end up with. Let's say that you want to write something for
2230 soprano and cello. In this case, we would start with the
2231 @q{Notes and lyrics} template (for the soprano part).
2234 \version @w{"@version{}"}
2235 melody = \relative c' @{
2242 text = \lyricmode @{
2248 \new Voice = "one" @{
2252 \new Lyrics \lyricsto "one" \text
2259 Now we want to add a cello part. Let's look at the @q{Notes only} example:
2262 \version @w{"@version{}"}
2263 melody = \relative c' @{
2277 We don't need two @code{\version} commands. We'll need the
2278 @code{melody} section. We don't want two @code{\score} sections
2279 -- if we had two @code{\score}s, we'd get the two parts separately.
2280 We want them together, as a duet. Within the @code{\score}
2281 section, we don't need two @code{\layout} or @code{\midi}.
2283 If we simply cut and paste the @code{melody} section, we would
2284 end up with two @code{melody} definitions. This would not generate
2285 an error, but the second one would be used for both melodies.
2286 So let's rename them to make them distinct. We'll call the
2287 section for the soprano @code{sopranoMusic} and the section for
2288 the cello @code{celloMusic}. While we're doing this, let's rename
2289 @code{text} to be @code{sopranoLyrics}. Remember to rename both
2290 instances of all these names -- both the initial definition (the
2291 @code{melody = \relative c' @{ } part) and the name's use (in the
2292 @code{\score} section).
2294 While we're doing this, let's change the cello part's staff --
2295 celli normally use bass clef. We'll also give the cello some
2299 \version @w{"@version{}"}
2300 sopranoMusic = \relative c' @{
2307 sopranoLyrics = \lyricmode @{
2311 celloMusic = \relative c @{
2320 \new Voice = "one" @{
2324 \new Lyrics \lyricsto "one" \sopranoLyrics
2331 This is looking promising, but the cello part won't appear in the
2332 score -- we haven't used it in the @code{\score} section. If we
2333 want the cello part to appear under the soprano part, we need to add
2336 \new Staff \celloMusic
2340 underneath the soprano stuff. We also need to add @code{<<} and
2341 @code{>>} around the music -- that tells LilyPond that there's
2342 more than one thing (in this case, two @code{Staves}) happening
2343 at once. The @code{\score} looks like this now:
2345 @c Indentation in this example is deliberately poor
2350 \new Voice = "one" @{
2354 \new Lyrics \lyricsto "one" \sopranoLyrics
2356 \new Staff \celloMusic
2364 This looks a bit messy; the indentation is messed up now. That is
2365 easily fixed. Here's the complete soprano and cello template.
2367 @lilypond[quote,verbatim,ragged-right,addversion]
2368 sopranoMusic = \relative c' {
2375 sopranoLyrics = \lyricmode {
2379 celloMusic = \relative c {
2389 \new Voice = "one" {
2393 \new Lyrics \lyricsto "one" \sopranoLyrics
2395 \new Staff \celloMusic
2404 The starting templates can be found in the @q{Templates} appendix,
2405 see @ref{Single staff}.
2408 @node Négyszólamú vegyeskar
2409 @subsection Négyszólamú vegyeskar
2410 @translationof Four-part SATB vocal score
2412 @cindex template, SATB
2413 @cindex SATB template
2415 Most vocal scores of music written for four-part mixed choir
2416 with orchestral accompaniment such as Mendelssohn's Elijah or
2417 Handel's Messiah have the choral music and words on four
2418 staves, one for each of SATB, with a piano reduction of the
2419 orchestral accompaniment underneath. Here's an example
2420 from Handel's Messiah:
2422 @c The following should appear as music without code
2423 @lilypond[quote,ragged-right]
2424 global = { \key d \major \time 4/4 }
2425 sopranoMusic = \relative c'' {
2427 r4 d2 a4 | d4. d8 a2 | cis4 d cis2 |
2429 sopranoWords = \lyricmode {
2430 Wor -- thy is the lamb that was slain
2432 altoMusic = \relative a' {
2434 r4 a2 a4 | fis4. fis8 a2 | g4 fis e2 |
2436 altoWords = \sopranoWords
2437 tenorMusic = \relative c' {
2439 r4 fis2 e4 | d4. d8 d2 | e4 a, cis2 |
2441 tenorWords = \sopranoWords
2442 bassMusic = \relative c' {
2444 r4 d2 cis4 | b4. b8 fis2 | e4 d a'2 |
2446 bassWords = \sopranoWords
2447 upper = \relative a' {
2450 r4 <a d fis>2 <a e' a>4
2451 <d fis d'>4. <d fis d'>8 <a d a'>2
2452 <g cis g'>4 <a d fis> <a cis e>2
2454 lower = \relative c, {
2457 <d d'>4 <d d'>2 <cis cis'>4
2458 <b b'>4. <b' b'>8 <fis fis'>2
2459 <e e'>4 <d d'> <a' a'>2
2463 << % combine ChoirStaff and PianoStaff in parallel
2465 \new Staff = "sopranos" <<
2466 \set Staff.instrumentName = #"Soprano"
2467 \new Voice = "sopranos" {
2472 \new Lyrics \lyricsto "sopranos" {
2475 \new Staff = "altos" <<
2476 \set Staff.instrumentName = #"Alto"
2477 \new Voice = "altos" {
2482 \new Lyrics \lyricsto "altos" { \altoWords }
2483 \new Staff = "tenors" <<
2484 \set Staff.instrumentName = #"Tenor"
2485 \new Voice = "tenors" {
2490 \new Lyrics \lyricsto "tenors" { \tenorWords }
2491 \new Staff = "basses" <<
2492 \set Staff.instrumentName = #"Bass"
2493 \new Voice = "basses" {
2498 \new Lyrics \lyricsto "basses" {
2503 \set PianoStaff.instrumentName = #"Piano"
2504 \new Staff = "upper" \upper
2505 \new Staff = "lower" \lower
2511 None of the templates provides this layout exactly. The nearest is
2512 @q{SATB vocal score and automatic piano reduction} -- see @ref{Vocal
2513 ensembles} -- but we need to change the layout and add a piano
2514 accompaniment which is not derived automatically from the vocal parts.
2515 The variables holding the music and words for the vocal parts are
2516 fine, but we shall need to add variables for the piano reduction.
2518 The order in which the contexts appear in the ChoirStaff of the
2519 template do not correspond with the order in the vocal score shown
2520 above. We need to rearrange them so there are four staves with the
2521 words written directly underneath the notes for each part. All the
2522 voices should be @code{\voiceOne}, which is the default, so the
2523 @code{\voiceXXX} commands should be removed. We also need to specify
2524 the tenor clef for the tenors. The way in which lyrics are specified
2525 in the template has not yet been encountered so we need to use the
2526 method with which we are familiar. We should also add the names of
2529 Doing this gives for our ChoirStaff:
2533 \new Staff = "sopranos" <<
2534 \set Staff.instrumentName = #"Soprano"
2535 \new Voice = "sopranos" @{
2540 \new Lyrics \lyricsto "sopranos" @{
2543 \new Staff = "altos" <<
2544 \set Staff.instrumentName = #"Alto"
2545 \new Voice = "altos" @{
2550 \new Lyrics \lyricsto "altos" @{
2553 \new Staff = "tenors" <<
2554 \set Staff.instrumentName = #"Tenor"
2555 \new Voice = "tenors" @{
2560 \new Lyrics \lyricsto "tenors" @{
2563 \new Staff = "basses" <<
2564 \set Staff.instrumentName = #"Bass"
2565 \new Voice = "basses" @{
2570 \new Lyrics \lyricsto "basses" @{
2576 Next we must work out the piano part. This is
2577 easy - we just pull out the piano part from the
2578 @q{Solo piano} template:
2582 \set PianoStaff.instrumentName = #"Piano "
2583 \new Staff = "upper" \upper
2584 \new Staff = "lower" \lower
2588 and add the variable definitions for @code{upper}
2591 The ChoirStaff and PianoStaff must be combined
2592 using angle brackets as we want them to be
2593 stacked one above the other:
2596 << % combine ChoirStaff and PianoStaff one above the other
2598 \new Staff = "sopranos" <<
2599 \new Voice = "sopranos" @{
2604 \new Lyrics \lyricsto "sopranos" @{
2607 \new Staff = "altos" <<
2608 \new Voice = "altos" @{
2613 \new Lyrics \lyricsto "altos" @{
2616 \new Staff = "tenors" <<
2617 \clef "G_8" % tenor clef
2618 \new Voice = "tenors" @{
2623 \new Lyrics \lyricsto "tenors" @{
2626 \new Staff = "basses" <<
2628 \new Voice = "basses" @{
2633 \new Lyrics \lyricsto "basses" @{
2639 \set PianoStaff.instrumentName = #"Piano"
2640 \new Staff = "upper" \upper
2641 \new Staff = "lower" \lower
2646 Combining all these together and adding the music
2647 for the three bars of the example above gives:
2649 @lilypond[quote,verbatim,ragged-right,addversion]
2654 sopranoMusic = \relative c'' {
2656 r4 d2 a4 | d4. d8 a2 | cis4 d cis2 |
2658 sopranoWords = \lyricmode {
2659 Wor -- thy is the lamb that was slain
2661 altoMusic = \relative a' {
2663 r4 a2 a4 | fis4. fis8 a2 | g4 fis fis2 |
2665 altoWords = \sopranoWords
2666 tenorMusic = \relative c' {
2668 r4 fis2 e4 | d4. d8 d2 | e4 a, cis2 |
2670 tenorWords = \sopranoWords
2671 bassMusic = \relative c' {
2673 r4 d2 cis4 | b4. b8 fis2 | e4 d a'2 |
2675 bassWords = \sopranoWords
2676 upper = \relative a' {
2679 r4 <a d fis>2 <a e' a>4
2680 <d fis d'>4. <d fis d'>8 <a d a'>2
2681 <g cis g'>4 <a d fis> <a cis e>2
2683 lower = \relative c, {
2686 <d d'>4 <d d'>2 <cis cis'>4
2687 <b b'>4. <b' b'>8 <fis fis'>2
2688 <e e'>4 <d d'> <a' a'>2
2692 << % combine ChoirStaff and PianoStaff in parallel
2694 \new Staff = "sopranos" <<
2695 \set Staff.instrumentName = #"Soprano"
2696 \new Voice = "sopranos" {
2701 \new Lyrics \lyricsto "sopranos" {
2704 \new Staff = "altos" <<
2705 \set Staff.instrumentName = #"Alto"
2706 \new Voice = "altos" {
2711 \new Lyrics \lyricsto "altos" {
2714 \new Staff = "tenors" <<
2715 \set Staff.instrumentName = #"Tenor"
2716 \new Voice = "tenors" {
2721 \new Lyrics \lyricsto "tenors" {
2724 \new Staff = "basses" <<
2725 \set Staff.instrumentName = #"Bass"
2726 \new Voice = "basses" {
2731 \new Lyrics \lyricsto "basses" {
2737 \set PianoStaff.instrumentName = #"Piano "
2738 \new Staff = "upper" \upper
2739 \new Staff = "lower" \lower
2746 @node Kotta létrehozása az alapoktól
2747 @subsection Kotta létrehozása az alapoktól
2748 @translationof Building a score from scratch
2750 @cindex template, writing your own
2751 @cindex example of writing a score
2752 @cindex writing a score, example
2753 @cindex score, example of writing
2755 After gaining some facility with writing LilyPond code, you
2756 may find that it is easier to build a score from scratch
2757 rather than modifying one of the templates. You can also
2758 develop your own style this way to suit the sort of music you
2759 like. Let's see how to put together the score for an organ
2760 prelude as an example.
2762 We begin with a header section. Here go the title, name
2763 of composer, etc, then come any variable definitions, and
2764 finally the score block. Let's start with these in outline
2765 and fill in the details later.
2767 We'll use the first two bars of Bach's prelude
2768 based on @emph{Jesu, meine Freude} which is written for two
2769 manuals and pedal organ. You can see these two bars of music
2770 at the bottom of this section. The top manual part has two voices,
2771 the lower and pedal organ one each. So we need four
2772 music definitions and one to define the time signature
2776 \version @w{"@version{}"}
2778 title = "Jesu, meine Freude"
2779 composer = "J S Bach"
2785 ManualOneVoiceOneMusic = @{ s1 @}
2786 ManualOneVoiceTwoMusic = @{ s1 @}
2787 ManualTwoMusic = @{ s1 @}
2788 PedalOrganMusic = @{ s1 @}
2794 For now we've just used a spacer note, @code{s1},
2795 instead of the real music. We'll add that later.
2797 Next let's see what should go in the score block.
2798 We simply mirror the staff structure we want.
2799 Organ music is usually written on three staves,
2800 one for each manual and one for the pedals. The
2801 manual staves should be bracketed together, so we
2802 need to use a PianoStaff for them. The first
2803 manual part needs two voices and the second manual
2808 \new Staff = "ManualOne" <<
2810 \ManualOneVoiceOneMusic
2813 \ManualOneVoiceTwoMusic
2815 >> % end ManualOne Staff context
2816 \new Staff = "ManualTwo" <<
2820 >> % end ManualTwo Staff context
2821 >> % end PianoStaff context
2824 Next we need to add a staff for the pedal organ.
2825 This goes underneath the PianoStaff, but it must
2826 be simultaneous with it, so we need angle brackets
2827 around the two. Missing these out would generate
2828 an error in the log file. It's a common mistake
2829 which you'll make sooner or later! Try copying
2830 the final example at the end of this section,
2831 remove these angle brackets, and compile it to
2832 see what errors it generates.
2835 << % PianoStaff and Pedal Staff must be simultaneous
2837 \new Staff = "ManualOne" <<
2839 \ManualOneVoiceOneMusic
2842 \ManualOneVoiceTwoMusic
2844 >> % end ManualOne Staff context
2845 \new Staff = "ManualTwo" <<
2849 >> % end ManualTwo Staff context
2850 >> % end PianoStaff context
2851 \new Staff = "PedalOrgan" <<
2859 It is not necessary to use the simultaneous construct
2860 @code{<< .. >>} for the manual two staff and the pedal organ staff,
2861 since they contain only one music expression, but it does no harm,
2862 and always using angle brackets after @code{\new Staff} is a good
2863 habit to cultivate in case there are multiple voices. The opposite
2864 is true for Voices: these should habitually be followed by braces
2865 @code{@{ .. @}} in case your music is coded in several variables
2866 which need to run consecutively.
2868 Let's add this structure to the score block, and adjust the indenting.
2869 We also add the appropriate clefs, ensure stems, ties and slurs in
2870 each voice on the upper staff point to the right direction with
2871 @code{\voiceOne} and @code{\voiceTwo}, and enter the time signature
2872 and key to each staff using our predefined variable, @code{\TimeKey}.
2876 << % PianoStaff and Pedal Staff must be simultaneous
2878 \new Staff = "ManualOne" <<
2879 \TimeKey % set time signature and key
2883 \ManualOneVoiceOneMusic
2887 \ManualOneVoiceTwoMusic
2889 >> % end ManualOne Staff context
2890 \new Staff = "ManualTwo" <<
2896 >> % end ManualTwo Staff context
2897 >> % end PianoStaff context
2898 \new Staff = "PedalOrgan" <<
2904 >> % end PedalOrgan Staff
2906 @} % end Score context
2909 That completes the structure. Any three-staff organ music
2910 will have a similar structure, although the number of voices
2911 may vary. All that remains now
2912 is to add the music, and combine all the parts together.
2914 @lilypond[quote,verbatim,ragged-right,addversion]
2916 title = "Jesu, meine Freude"
2917 composer = "J S Bach"
2923 ManualOneVoiceOneMusic = \relative g' {
2927 ManualOneVoiceTwoMusic = \relative c' {
2928 ees16 d ees8~ 16 f ees d c8 d~ d c~
2929 c c4 b8 c8. g16 c b c d
2931 ManualTwoMusic = \relative c' {
2932 c16 b c8~ 16 b c g a8 g~ 16 g aes ees
2933 f ees f d g aes g f ees d e8~ 8es16 f ees d
2935 PedalOrganMusic = \relative c {
2936 r8 c16 d ees d ees8~ 16 a, b g c b c8
2937 r16 g ees f g f g8 c,2
2941 << % PianoStaff and Pedal Staff must be simultaneous
2943 \new Staff = "ManualOne" <<
2944 \TimeKey % set time signature and key
2948 \ManualOneVoiceOneMusic
2952 \ManualOneVoiceTwoMusic
2954 >> % end ManualOne Staff context
2955 \new Staff = "ManualTwo" <<
2961 >> % end ManualTwo Staff context
2962 >> % end PianoStaff context
2963 \new Staff = "PedalOrgan" <<
2969 >> % end PedalOrgan Staff context
2971 } % end Score context
2975 @node Kevesebb gépelés változókkal és függvényekkel
2976 @subsection Kevesebb gépelés változókkal és függvényekkel
2977 @translationof Saving typing with variables and functions
2982 By this point, you've seen this kind of thing:
2984 @lilypond[quote,verbatim,ragged-right]
2985 hornNotes = \relative c'' { c4 b dis c }
2993 You may even realize that this could be useful in minimalist music:
2995 @lilypond[quote,verbatim,ragged-right]
2996 fragmentA = \relative c'' { a4 a8. b16 }
2997 fragmentB = \relative c'' { a8. gis16 ees4 }
2998 violin = \new Staff {
3011 However, you can also use these variables (also known as
3012 macros, or user-defined commands) for tweaks:
3014 @c TODO Avoid padtext - not needed with skylining
3015 @lilypond[quote,verbatim,ragged-right]
3016 dolce = \markup { \italic \bold dolce }
3017 padText = { \once \override TextScript.padding = #5.0 }
3018 fthenp=_\markup { \dynamic f \italic \small { 2nd } \hspace #0.1 \dynamic p }
3019 violin = \relative c'' {
3021 c4._\dolce b8 a8 g a b
3023 c4.^"hi there!" d8 e' f g d
3024 c,4.\fthenp b8 c4 c-.
3031 \layout { ragged-right=##t }
3035 These variables are obviously useful for saving
3036 typing. But they're worth considering even if you
3037 only use them once -- they reduce complexity. Let's
3038 look at the previous example without any
3039 variables. It's a lot harder to read, especially
3043 violin = \relative c'' @{
3045 c4._\markup @{ \italic \bold dolce @} b8 a8 g a b
3046 \once \override TextScript.padding = #5.0
3047 c4.^"hi there!" d8 e' f g d
3048 c,4.\markup @{ \dynamic f \italic \small @{ 2nd @}
3049 \hspace #0.1 \dynamic p @}
3055 @c TODO Replace the following with a better example -td
3056 @c Skylining handles this correctly without padText
3058 So far we've seen static substitution -- when LilyPond
3059 sees @code{\padText}, it replaces it with the stuff that
3060 we've defined it to be (ie the stuff to the right of
3063 LilyPond can handle non-static substitution, too (you
3064 can think of these as functions).
3066 @lilypond[quote,verbatim,ragged-right]
3068 #(define-music-function (parser location padding) (number?)
3070 \once \override TextScript.padding = #padding
3074 c4^"piu mosso" b a b
3076 c4^"piu mosso" d e f
3078 c4^"piu mosso" fis a g
3082 Using variables is also a good way to reduce work if the
3083 LilyPond input syntax changes (see
3084 @rprogram{Updating files with convert-ly}). If
3085 you have a single definition (such as @code{\dolce}) for all your
3086 input files (see @ref{Style sheets}), then if the syntax changes, you
3087 only need to update your single @code{\dolce} definition,
3088 instead of making changes throughout every @file{.ly} file.
3091 @node Partitúra és szólamkották
3092 @subsection Partitúra és szólamkották
3093 @translationof Scores and parts
3095 In orchestral music, all notes are printed twice. Once in a part for
3096 the musicians, and once in a full score for the conductor. Variables can
3097 be used to avoid double work. The music is entered once, and stored in
3098 a variable. The contents of that variable is then used to generate
3099 both the part and the full score.
3101 It is convenient to define the notes in a special file. For example,
3102 suppose that the file @file{horn-music.ly} contains the following part
3103 of a horn/@/bassoon duo
3106 hornNotes = \relative c @{
3113 Then, an individual part is made by putting the following in a file
3116 \include "horn-music.ly"
3118 instrument = "Horn in F"
3122 \transpose f c' \hornNotes
3129 \include "horn-music.ly"
3133 substitutes the contents of @file{horn-music.ly} at this position in
3134 the file, so @code{hornNotes} is defined afterwards. The command
3135 @code{\transpose f@tie{}c'} indicates that the argument, being
3136 @code{\hornNotes}, should be transposed by a fifth upwards. Sounding
3137 @code{f} is denoted by notated @code{c'}, which corresponds with the
3138 tuning of a normal French Horn in@tie{}F. The transposition can be seen
3139 in the following output
3141 @lilypond[quote,ragged-right]
3142 \transpose f c' \relative c {
3148 In ensemble pieces, one of the voices often does not play for many
3149 measures. This is denoted by a special rest, the multi-measure
3150 rest. It is entered with a capital @code{R} followed by a duration
3151 (@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
3152 etc.). By multiplying the
3153 duration, longer rests can be constructed. For example, this rest
3154 takes 3@tie{}measures in 2/4 time
3160 When printing the part, multi-rests
3161 must be condensed. This is done by setting a run-time variable
3164 \set Score.skipBars = ##t
3168 This command sets the property @code{skipBars} in the
3169 @code{Score} context to true (@code{##t}). Prepending the rest and
3170 this option to the music above, leads to the following result
3172 @lilypond[quote,ragged-right]
3173 \transpose f c' \relative c {
3175 \set Score.skipBars = ##t
3182 The score is made by combining all of the music together. Assuming
3183 that the other voice is in @code{bassoonNotes} in the file
3184 @file{bassoon-music.ly}, a score is made with
3187 \include "bassoon-music.ly"
3188 \include "horn-music.ly"
3191 \new Staff \hornNotes
3192 \new Staff \bassoonNotes
3199 @lilypond[quote,ragged-right]
3208 r4 d,8 f | gis4 c | b bes |
3209 a8 e f4 | g d | gis f |