| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
@translationof How LilyPond input files work
Het LilyPond invoerformaat is tamelijk vrij, wat ervaren gebruikers veel flexibiliteit geeft hun bestanden te structureren zoals ze dat wensen. Deze flexibiliteit kan verwarrend zijn voor nieuwe gebruikers. Deze paragraaf legt het een en ander uit over deze structuur. Om het leesbaar te houden worden details weggelaten. Een complete beschrijving van het invoerformaat is te vinden in (notation)File structure section ‘File structure’ in Notatie-handleiding.
| 3.1.1 Inleiding in de LilyPond-bestandsstructuur | ||
| 3.1.2 Score is a (single) compound musical expression | ||
| 3.1.3 Nesting music expressions | ||
| 3.1.4 On the un-nestedness of brackets and ties |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
@translationof Introduction to the LilyPond file structure
Een basisvoorbeeld van een LilyPond-invoerbestand is
\version "2.21.3"
\header { }
\score {
...samengestelde muziekuitdrukking... % alle muziek komt hier!
\layout { }
\midi { }
}
|
Er zijn veel variaties op dit basispatroon maar dit voorbeeld dient als een handig beginpunt.
Tot nu toe heeft geen van de voorbeelden het
\score{}-commando gebruikt. Dit kan omdat LilyPond
automatisch de extra commando’s toevoegt die benodigt zijn
als je het eenvoudige invoer geeft. LilyPond behandelt invoer
zoals dit:
\relative {
c''4 a d c
}
|
als een afkorting voor dit:
\book {
\score {
\new Staff {
\new Voice {
\relative {
c''4 a b c
}
}
}
\layout { }
}
}
|
Anders gezegd, als de invoer een enkelvoudige muziekuitdrukking bevat, interpreteert LilyPond het bestand alsof die muziekuitdrukking ingepakt is in bovenstaande commando’s.
Een kleine waarschuwing! In veel van de voorbeelden
in de LilyPond-documentatie worden de \new Staff- en
\new Voice-commando’s weggelaten en worden ze
impliciet aangemaakt. Voor eenvoudige voorbeelden werkt dat
goed, maar voor ingewikkelde voorbeelden, vooral wanneer
additionele commando’s worden gebruikt, kan het impliciete
aanmaken van contexten verrassende resultaten opleveren,
zoals extra ongewenste notebalken. Hoe je contexten
expliciet specificeert, wordt uitgelegd in Contexts and engravers.
Nota bene : Voor het invoeren van meer dan enkele regels muziek wordt aangeraden altijd notenbalken en stemmen expliciet te specificeren.
Laten we terugkeren naar het eerste voorbeeld en het
\score-commando beter bekijken.
Een \score-blok moet altijd precies één
muziekuitdrukking bevatten, en die moet direct na het
\score-commando staan. Herrinner je dat een
muziekuitdrukking alles kan zijn van een enkele noot
tot een enorme samengestelde uitdrukking zoals
{
\new StaffGroup <<
...vul de volledige partituur van een Wagner opera hier in...
>>
}
|
Omdat alles tussen { ... } staat, telt het als één
muziekuitdrukking.
Zoals we eerder al zagen, kan het \score-blok
allerlei andere dingen bevatten, zoals
\score {
{ c'4 a b c' }
\header { }
\layout { }
\midi { }
}
|
Merk op dat deze drie commando’s – \header,
\layout en \midi – speciaal zijn: in
tegenstelling tot veel andere commando’s die met een
backslash (\) beginnen zijn het geen
muziekuitdrukkingen en ze zijn ook geen onderdeel van een
muziekuitdrukking. Ze kunnen zowel binnen als buiten het
\score-blok worden geplaatst. Deze commando’s worden
gewoonlijk dan ook buiten het \score-blok gezet
– bijvoorbeeld, \header staat meestal boven het
\score-commando, zoals het in eerste voorbeeld van
deze paragraaf.
De twee andere commando’s die je niet eerder hebt gezien
zijn \layout { } en \midi {}. Als deze
gebruikt worden als hierboven laten ze LilyPond
respectievelijk geprinte- en MIDI-uitvoer genereren. Een
volledige beschrijving van deze commando’s is te vinden in
de Notatiehandleiding –
(notation)Score layout section ‘Score layout’ in Notatie-handleiding, en
(notation)Creating MIDI files section ‘Creating MIDI files’ in Notatie-handleiding.
Je kunt meer dan een \score-blok gebruiken. Elk
wordt behandeld als een afzonderlijke partituur en ze worden
allemaal samengevoegd in een enkel uitvoerbestand. Een
\book-commando is niet nodig – die wordt impliciet
aangemaakt. Echter, als je afzonderlijke uitvoerbestanden
vanuit een ‘.ly’-bestand wil maken, dan moet het
\book-commando worden gebruikt om de verschillende
secties aan te geven: elk \book-blok produceert
een apart uitvoerbestand.
Samengevat:
Elk \book-blok geeft een apart uitvoerbestand (bijv.,
een PDF-bestand). Als je er geen expliciet toevoegt, stopt
LilyPond je gehele invoercode impliciet in een
\book-blok.
Elk \score-blok is een apart brok muziek binnen een
\book-blok.
Elk \layout-blok beïnvloedt het \score- of
\book-blok waarin het voorkomt – d.w.z., een
\layout-blok binnen een \score-blok heeft
uitsluitend invloed op dat \score-blok, maar een
\layout-blok buiten een \score-blok (en dus
binnen een \book-blok, expliciet danwel impliciet)
beïnvloedt elke \score in dat \book.
Voor details zie (notation)Multiple scores in a book section ‘Multiple scores in a book’ in Notatie-handleiding.
Een andere manier van afkorten is het gebruik van variabelen, zoals getoond in Stukken organiseren met variabelen. Alle sjablonen gebruiken dat:
melodie = \relative {
c'4 a b c
}
\score {
\melodie
}
|
Als LilyPond naar dit bestand kijkt, neemt het de waarde van
melodie (alles na het isgelijkteken) en voegt die in
zodra ergens \melody staat. De naam van de variable
heeft verder geen speciale betekenis – het kan net zo goed
melodie, globaal, TijdSleutel,
pianorechterhand, of iets anders zijn. Bedenk dat je
vrijwel elke naam kunt gebruiken die je wilt, zolang die
maar bestaat uit letters en het niet de naam is van een
LilyPond-commando. Voor meer details, zie Saving typing with variables and functions. De precieze
beperkingen van variabelenamen staan beschreven in
(notation)File structure section ‘File structure’ in Notatie-handleiding.
Voor een volledige definitie van het invoerformaat, zie (notation)File structure section ‘File structure’ in Notatie-handleiding.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We saw the general organization of LilyPond input files in the
previous section, @ref{Introduction to the LilyPond file structure}.
But we seemed to skip over the most important part: how do we figure
out what to write after \score?
We didn’t skip over it at all. The big mystery is simply that there is no mystery. This line explains it all:
A
\scoreblock must begin with a compound music expression.
To understand what is meant by a music expression and a compound
music expression, you may find it useful to review the tutorial,
@ref{Music expressions explained}. In that section, we saw how to
build big music expressions from small pieces – we started from
notes, then chords, etc. Now we’re going to start from a big
music expression and work our way down. For simplicity, we’ll use
just a singer and piano in our example. We don’t need a
StaffGroup for this ensemble, which simply groups a number
of staves together with a bracket at the left, but we do need
staves for a singer and a piano, though.
\score {
<<
\new Staff = "singer" <<
>>
\new PianoStaff = "piano" <<
>>
>>
\layout { }
}
|
Here we have given names to the staves – “singer” and “piano”. This is not essential here, but it is a useful habit to cultivate so that you can see at a glance what each stave is for.
Remember that we use << ... >> instead of { ... } to
show simultaneous music. This causes the vocal part and piano part
to appear one above the other in the score. The << ... >>
construct would not be necessary for the Singer staff in the example
above if it were going to contain only one sequential music
expression, but << ... >> rather than braces is necessary if
the music in the Staff is to contain two or more simultaneous
expressions, e.g. two simultaneous Voices, or a Voice with lyrics.
We’re going to have a voice with lyrics, so angle brackets are
required. We’ll add some real music later; for now let’s just put
in some dummy notes and lyrics. If you’ve forgotten how to add lyrics
you may wish to review \addlyrics in @ref{Setting simple songs}.
\score { << \new Staff = "singer" << \new Voice = "vocal" { c'1 } \addlyrics { And } >> \new PianoStaff = "piano" << \new Staff = "upper" { c'1 } \new Staff = "lower" { c'1 } >> >> \layout { } }
Now we have a lot more details. We have the singer’s staff: it
contains a Voice (in LilyPond, this term refers to a set of
notes, not necessarily vocal notes – for example, a violin
generally plays one voice) and some lyrics. We also have a piano
staff: it contains an upper staff (right hand) and a lower staff
(left hand), although the lower staff has yet to be given a bass
clef.
At this stage, we could start filling in notes. Inside the curly
braces next to \new Voice = "vocal", we could start writing
\relative {
r4 d''8\noBeam g, c4 r
}
|
But if we did that, the \score section would get pretty
long, and it would be harder to understand what was happening. So
let’s use variables instead. These were introduced at the end
of the previous section, remember? To ensure the contents of the
text variable are interpreted as lyrics we preface them with
\lyricmode. Like \addlyrics, this switches the input
mode to lyrics. Without that, LilyPond would try to interpret the
contents as notes, which would generate errors. (Several other
input modes are available, see
(notation)Input modes section ‘Input modes’ in Notatie-handleiding.)
So, adding a few notes and a bass clef for the left hand, we now have a piece of real music:
melody = \relative { r4 d''8\noBeam g, c4 r } text = \lyricmode { And God said, } upper = \relative { <g' d g,>2~ <g d g,> } lower = \relative { b,2 e } \score { << \new Staff = "singer" << \new Voice = "vocal" { \melody } \addlyrics { \text } >> \new PianoStaff = "piano" << \new Staff = "upper" { \upper } \new Staff = "lower" { \clef "bass" \lower } >> >> \layout { } }
When writing (or reading) a \score section, just take it
slowly and carefully. Start with the outer level, then work on
each smaller level. It also really helps to be strict with
indentation – make sure that each item on the same level starts
on the same horizontal position in your text editor.
Notation Reference: (notation)Structure of a score section ‘Structure of a score’ in Notatie-handleiding.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is not essential to declare all staves at the beginning; they may be introduced temporarily at any point. This is particularly useful for creating ossia sections – see (music-glossary)ossia section ‘ossia’ in Terminologie. Here is a simple example showing how to introduce a new staff temporarily for the duration of three notes:
\new Staff { \relative { r4 g'8 g c4 c8 d | e4 r8 << { f8 c c } \new Staff { f8 f c } >> r4 | } }
Note that the size of the clef is the same as a clef printed following a clef change – slightly smaller than the clef at the beginning of the line. This is usual for clefs printed in the middle of a line.
The ossia section may be placed above the staff as follows:
\new Staff = "main" { \relative { r4 g'8 g c4 c8 d | e4 r8 << { f8 c c } \new Staff \with { alignAboveContext = "main" } { f8 f c } >> r4 | } }
This example uses \with, which will be explained more
fully later. It is a means of modifying the default behavior
of a single Staff. Here it says that the new staff should be
placed above the staff called “main” instead of the default
position which is below.
Ossia are often written without clef and without time signature and are usually in a smaller font. These require further commands which have not yet been introduced. See Size of objects, and (notation)Ossia staves section ‘Ossia staves’ in Notatie-handleiding.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You have already met a number of different types of bracket and bracket-like constructs in writing the input file to LilyPond. These obey different rules which can be confusing at first. Let’s first review the different types of brackets and bracket-like constructs.
| Bracket Type | Function |
|---|---|
{ .. } | Encloses a sequential segment of music |
< .. > | Encloses the notes of a chord |
<< .. >> | Encloses simultaneous music expressions |
( .. ) | Marks the start and end of a slur |
\( .. \) | Marks the start and end of a phrasing slur |
[ .. ] | Marks the start and end of a manual beam |
To these we should add other constructs which generate lines
between or across notes: ties (marked by a tilde, ~),
tuplets written as \times x/y {..}, and grace notes
written as \grace{..}.
Outside LilyPond, the conventional use of brackets requires the
different types to be properly nested, like this, << [ { ( .. )
} ] >>, with the closing brackets being encountered in exactly the
opposite order to the opening brackets. This is a
requirement for the three types of bracket described by the word
‘Encloses’ in the table above – they must nest properly. However,
the remaining bracket-like constructs, described with the word
‘Marks’ in the table above together with ties and tuplets, do
not have to nest properly with any of the brackets or
bracket-like constructs. In fact, these are not brackets in
the sense that they enclose something – they are simply markers to
indicate where something starts and ends.
So, for example, a phrasing slur can start before a manually inserted beam and end before the end of the beam – not very musical, perhaps, but possible:
\relative { g'8\( a b[ c b\) a] g4 }
In general, different kinds of brackets, bracket-like constructs, and those implied by tuplets, ties and grace notes, may be mixed freely. This example shows a beam extending into a tuplet (line 1), a slur extending into a tuplet (line 2), a beam and a slur extending into a tuplet, a tie crossing two tuplets, and a phrasing slur extending out of a tuplet (lines 3 and 4).
\relative { r16[ g' \tuplet 3/2 { r16 e'8] } g,16( a \tuplet 3/2 { b16 d) e } g,8[( a \tuplet 3/2 { b8 d) e~] } | \tuplet 5/4 { e32\( a, b d e } a4.\) }
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by gub on Juli 13, 2020 using texi2html 1.82.
Andere talen: English, català, česky, deutsch, español, français, magyar, italiano, 日本語.
Gebruik van automatische taalkeuze.