lydown 0.10.0 → 0.12.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8609e6ea7dff78ec0b444ea4aeecb7156f24742b
4
- data.tar.gz: 523985930d61e49ddbbffb093e2af2b256862ba1
3
+ metadata.gz: f12383235250037392916c2a69ff03fe5f366100
4
+ data.tar.gz: cf26fbac37decc03b9a271e4f3dc50340e7cb4a6
5
5
  SHA512:
6
- metadata.gz: 825b276f2582fd0bb3cbaed37e1a579978f59da333afffe39f203667e948ce467a6154d65fea6df28cb07218a9f1671aa95257b84e08c8030efdf7863b19bef7
7
- data.tar.gz: b676b5b4f22cb575968435084d3e5ecb1a3759c3dd1d4a3e9b3df5fa81b57af529e92f2d4d60f91bc1e0ad93918a3e140e31f239441a4296d4c38bbe2ca5e9b7
6
+ metadata.gz: fe50eac747f03ee7afd072b8fccaab45664e6503f76a6413d40044f2e86a233ae5168ffd9d4b9e4bf8b44c3d4736a1a64bbc629de943ec1445ec2002527b4f95
7
+ data.tar.gz: fe3e4da8045b8b7aca9ba8e287568a8a1f9e5081af05901475654b8e5135aca4271aee51f87d79dbe6d577f2269301cb921809f6678c912773d2a931c957fa87
data/README.md CHANGED
@@ -1,29 +1,43 @@
1
+ [![Build Status](https://travis-ci.org/ciconia/lydown.svg?branch=master)](https://travis-ci.org/ciconia/lydown)
2
+
1
3
  Lydown is a language and compiler for creating music scores, parts and snippets. The lydown code is compiled to [lilypond](http://lilypond.org/) code and then compiled to PDF, PNG or MIDI files.
2
4
 
3
- - [About](#)
4
- - [Installation](#)
5
- - [Hello world in lydown](#)
6
- - [Compiling the lydown code](#)
7
- - [Proofing mode](#)
8
- - [The lydown syntax](#)
9
- - [Notes and durations](#)
10
- - [Accidentals](#)
11
- - [Octaves](#)
12
- - [Barlines](#)
13
- - [Rests](#)
14
- - [Beams, slurs and ties](#)
15
- - [Articulation and expression marks](#)
16
- - [Repeated articulation and rhythmic patterns: macros](#)
17
- - [Named macros](#)
18
- - [Clefs, key and time signatures](#)
19
- - [Pickup bars](#)
20
- - [Lilypond Commands and inline settings](#)
21
- - [Inline lyrics](#)
22
- - [Stream switching](#)
23
- - [Figured bass](#)
24
- - [Multiple parts](#)
25
- - [Multiple movements](#)
26
- - [Multiple voices](#)
5
+ - [About](#about)
6
+ - [Installation](#installation)
7
+ - [Hello world in lydown](#hello-world-in-lydown)
8
+ - [More examples and resources](#more-examples-and-resources)
9
+ - [Compiling lydown code](#compiling-lydown-code)
10
+ - [Proofing mode](#proofing-mode)
11
+ - [Interactive mode](#interactive-mode)
12
+ - [The lydown syntax](#the-lydown-syntax)
13
+ - [Notes and durations](#notes-and-durations)
14
+ - [Accidentals](#accidentals)
15
+ - [Octaves](#otaves)
16
+ - [Barlines](#barlines)
17
+ - [Rests](#rests)
18
+ - [Beams, slurs and ties](#beams-slurs-and-ties)
19
+ - [Articulation and expression marks](#articulation-and-expression-marks)
20
+ - [Repeated articulation and rhythmic patterns: macros](#repeated-articulation-and-rhythmic-patterns-macros)
21
+ - [Named macros](#named-macros)
22
+ - [Clefs, key and time signatures](#clefs-key-and-time-signatures)
23
+ - [Pickup bars](#pickup-bars)
24
+ - [Lilypond Commands and inline settings](#lilypond-commands-and-inline-settings)
25
+ - [Inline lyrics](#inline-lyrics)
26
+ - [Stream switching](#stream-switching)
27
+ - [Figured bass](#figured-bass)
28
+ - [Multiple parts](#multiple-parts)
29
+ - [Multiple movements](#multiple-movements)
30
+ - [Multiple voices](#multiple-voices)
31
+ - [Piano scores](#piano-scores)
32
+ - [multi-part scores and part extraction](#multi-part-scores-and-part-extraction)
33
+ - [Colla parte and part sources](#colla-parte-and-part-sources)
34
+ - [Mode specific code](#mode-specific-code)
35
+ - [Staff and system appearance](#staff-and-system-appearance)
36
+ - [Rendering MIDI && mp3 files](#rendering-midi-mp3-files)
37
+ - [Including files](#including-files)
38
+ - [Including templates](#including-templates)
39
+ - [Adding a front cover](#adding-a-front-cover)
40
+
27
41
 
28
42
  ## About
29
43
 
@@ -37,39 +51,66 @@ Lydown builds on the ideas put forth by lilypond and makes the following improve
37
51
 
38
52
  ## Installation
39
53
 
40
- Before installing lydown, you'll need to have installed [lilypond](http://lilypond.org/download.html).
54
+ If you have Ruby on your machine, you can simply install lydown as a gem:
41
55
 
42
- You can verify that lilypond is correctly installed by running the following command:
56
+ ```bash
57
+ gem install lydown
58
+ ```
43
59
 
44
- lilypond --version
60
+ If not, you can simply grab the [release file](https://github.com/ciconia/lydown/releases) for your OS, which already includes Ruby.
45
61
 
46
- If everything's ok, you can proceed by installing lydown:
62
+ Once you got lydown installed, you can verify it woks correctly by running:
47
63
 
48
- gem install lydown
64
+ ```bash
65
+ lydown version
66
+ ```
49
67
 
50
- and verifying that it too works:
68
+ Lydown will display its version and also the version lilypond installed. If lilypond is not installed on your machine, you can install it by either running:
51
69
 
52
- lydown --version
70
+ ```bash
71
+ lydown install lilypond
72
+ ```
73
+
74
+ Or by downloading it from the [lilypond website](http://lilypond.org/download.html).
53
75
 
54
76
  ## Hello world in lydown
55
77
 
56
- // helloworld.lydown
57
- - key: d major
58
- - time: 2/4
59
- 4d\"Hello world!" 6c#bag 3f#gag6f#d 4e
78
+ The following is a basic example of the lydown syntax:
79
+
80
+ ```lydown
81
+ // helloworld.ld
82
+ \key:D \time:2/4
83
+ 4d''\"Hello world!" 6cbag 3fgag6fd 4e
84
+ ```
60
85
 
61
86
  And here's the equivalent lilypond code:
62
87
 
63
- \version "2.18.2"
64
- relative c' {
65
- \key d major
66
- \time 2/4
67
- d'4\"Hello world!" cs16 b a g fs32 g a g fs16 d e4
68
- }
88
+ ```lilypond
89
+ \version "2.18.2"
90
+ relative c' {
91
+ \key d major
92
+ \time 2/4
93
+ d'4\"Hello world!" cs16 b a g fs32 g a g fs16 d e4
94
+ }
95
+ ```
96
+
97
+ To compile the lydown source file into a PDF and then display it, invoke lydown as follows:
98
+
99
+ ```bash
100
+ lydown -O helloworld.ld
101
+ ```
102
+
103
+ ## More examples and resources
104
+
105
+ Examples of lydown code, used to test lydown, could be found in the [specs directory of the lydown repository](https://github.com/ciconia/lydown/tree/master/spec/examples).
69
106
 
70
- ## Compiling the lydown code
107
+ A recent reconstruction of Bach's [Markuspassion BWV 247](https://github.com/ciconia/music/tree/master/bach/BWV247) is the first large-scale work to be written in Lydown.
71
108
 
72
- The lydown command line tool can compile the code into lilypond code, PDF, PNG, or MIDI. The program creates an output file with the same name as the input file and the corresponding extension. Specifiying the -O switch causes the output to be opened immediately.
109
+ Additional information and resources could be found on the [lydown wiki](https://github.com/ciconia/lydown/wiki).
110
+
111
+ ## Compiling lydown code
112
+
113
+ The lydown command line tool can compile the code into lilypond code, PDF, PNG, [MIDI or MP3](#rendering-midi-mp3-files). The program creates an output file with the same name as the input file and the corresponding extension. Specifiying the -O switch causes the output to be opened immediately.
73
114
 
74
115
  To create a lilypond file:
75
116
 
@@ -103,6 +144,14 @@ In proof mode, lydown will generate parts and not a score. To include another pa
103
144
 
104
145
  This is useful when editing baroque music for example, or when any other part can give context and aid in verifying the music.
105
146
 
147
+ ## Interactive mode
148
+
149
+ When invoked without any parameters, an interactive lydown session is started. This mode is useful when working on music involving multiple movements or multiple parts. In this mode, you can move between directories, edit files (using vim), and compile specific movements or specific parts.
150
+
151
+ Just like in proofing mode, any changes you make to files within the working directory are immediately compiled and shown in the system viewer.
152
+
153
+ To get a list of available commands, type <code>help</code>.
154
+
106
155
  ## The lydown syntax
107
156
 
108
157
  The lydown syntax is designed for faster note entry, better legibility and minimal boilerplate. The lydown syntax takes the basic ideas put forth by lilypond and simplifies them, with the following main differences:
@@ -120,69 +169,112 @@ For the sake of this tutorial, some familiarity with the concepts and syntax of
120
169
 
121
170
  In lydown, durations are entered before the note to which they refer, and they stay valid for subsequent notes, until a new value is entered:
122
171
 
123
- 4c8de2f => c4 d8 e f2
172
+ ```lydown
173
+ 4c8de2f => c4 d8 e f2
174
+ ```
124
175
 
125
176
  In addition to the usual values (1, 2, 4, 8, 16, 32 etc), lydown adds two shortcuts for commonly used values: 6 for 16th notes and 3 for 32th notes:
126
177
 
127
- 8c6de3fefefede2f => c8 d16 e f32 e f e f e d e f2
178
+ ```lydown
179
+ 8c6de3fefefede2f => c8 d16 e f32 e f e f e d e f2
180
+ ```
181
+ Lydown recognizes the following values:
182
+
183
+ ```lydown
184
+ l // longa
185
+ 0 // breve
186
+ 1 // whole note (semi breve)
187
+ 2 // half note
188
+ 4 // 1/4 note
189
+ 8 // 1/8 note
190
+ 6 // 1/16 note
191
+ 16 // 1/16 note
192
+ 3 // 1/32 note
193
+ 32 // 1/32 note
194
+ 64 // 1/64 note
195
+ 128 // 1/128 note
196
+ 256 // 1/256 note
197
+ ```
128
198
 
129
199
  Augmentation dots are entered like in lilypond:
130
200
 
131
- 8.c6d 8.e6f 2g => c8. d16 e8. f16 g2
132
- 8..g 3g 4c => g8.. g32 c4
201
+ ```lydown
202
+ 8.c6d 8.e6f 2g => c8. d16 e8. f16 g2
203
+ 8..g 3g 4c => g8.. g32 c4
204
+ ```
133
205
 
134
206
  Notes can be repeated using the <code>@</code> placeholder:
135
207
 
136
- 4c@@@ => c4 c c c
208
+ ```lydown
209
+ 4c@@@ => c4 c c c
210
+ ```
137
211
 
138
212
  (The repeating note placeholder is useful when entering repeated notes with accidentals).
139
213
 
140
214
  Chords are written using angled brackets, like in lilypond:
141
215
 
142
- (2<fd>4<ge>) => <f d>2( <g e>4)
216
+ ```lydown
217
+ (2<fd>4<ge>) => <f d>2( <g e>4)
218
+ ```
143
219
 
144
220
  ### Accidentals
145
221
 
146
- Accidentals can be entered using + and -
222
+ Accidentals can be entered using <code>+</code> and <code>-</code>, altering the note relative to the key signature.
147
223
 
148
- 8cgb-c2a => c8 g bes c a2
224
+ ```lydown
225
+ 8cgb-c2a => c8 g bes c a2
226
+ - key: D
227
+ 4dc-2b- => d4 c bes2
228
+ ```
149
229
 
150
230
  But can also be entered using the characters # for sharp, ß for flat and h for natural:
151
231
 
152
- c#dßeh => cis des e
232
+ ```lydown
233
+ c#dßeh => cis des e
234
+ ```
153
235
 
154
236
  In lydown notes follow the key signature by default:
155
237
 
156
- - key: g major
157
- ff#fhfßd#bß => fis fisis f f dis bes
238
+ ```lydown
239
+ - key: g major
240
+ ff#fhfßd#bß => fis fisis f f dis bes
241
+ ```
158
242
 
159
243
  The accidental mode can be changed by specifiying the manual accidental mode:
160
244
 
161
- - key: g major
162
- - accidentals: manual
163
- 8g6f+edcba2g
245
+ ```lydown
246
+ - key: g major
247
+ - accidentals: manual
248
+ 8g6f+edcba2g
249
+ ```
164
250
 
165
251
  In the default, automatic mode, when deviating from the key signature the accidental must be repeated for each note, regardless of barlines.
166
252
 
167
253
  In the [same manner as lilypond](http://www.lilypond.org/doc/v2.18/Documentation/notation/writing-pitches#accidentals), accidentals can be forced by following the note name and accidental with a ! (for a reminder), or ? (for a cautionary accidental in parentheses):
168
254
 
169
- cc+c+!cc? => c cs cs! c c?
255
+ ```lydown
256
+ cc+c+!cc? => c cs cs! c c?
257
+ ```
170
258
 
171
259
  A ficta accidental (an non-original accidental that appears above the staff) can be entered using the ^ symbol after the accidental:
172
260
 
173
- cdef+^g
261
+ ```lydown
262
+ cdef+^g
263
+ ```
174
264
 
175
265
  ### Octaves
176
266
 
177
267
  In Lydown, the first note in the document carries an absolute octave marker, using the <code>'</code> and <code>,</code> signs:
178
268
 
179
- c,, // contrabass octave
180
- c, // great octave
181
- c // small octave
182
- c' // first octave (middle c)
183
- c'' // second octave
184
- c''' // third octave
185
- ... // etc.
269
+ ```lydown
270
+ c,, // contrabass octave
271
+ c, // great octave
272
+ c // small octave
273
+ c' // first octave (middle c)
274
+ c'' // second octave
275
+ c''' // third octave
276
+ ... // etc.
277
+ ```
186
278
 
187
279
  For the following notes, the octave markers <code>'</code> and <code>,</code> are used for jumping between octaves, using the same rules as
188
280
  lilypond's [relative mode](http://www.lilypond.org/doc/v2.18/Documentation/notation/writing-pitches#relative-octave-entry):
@@ -191,24 +283,40 @@ For the following notes, the octave markers <code>'</code> and <code>,</code> ar
191
283
 
192
284
  Just like in lilypond, barlines are taken care of automatically according to the time signature. Final bar lines and repeat bar lines can be entered explicitly by using shorthand syntax:
193
285
 
194
- |: cege :|: cfaf :|
286
+ ```lydown
287
+ |: cege :|: cfaf :|
288
+ ```
195
289
 
196
290
  When entering unmetered music, an invisible barline can be added in order to provide line breaks:
197
291
 
198
- -time: unmetered
199
- cdef ?| gag
292
+ ```lydown
293
+ -time: unmetered
294
+ cdef ?| gag
295
+ ```
200
296
 
201
- ### Rests
297
+ ### Rests and silences
202
298
 
203
299
  Normal rests are written [like in lilypond](http://www.lilypond.org/doc/v2.18/Documentation/notation/writing-rests#rests):
204
300
 
205
- 4ce2r => c4 e r2
301
+ ```lydown
302
+ 4ce2r => c4 e r2
303
+ ```
206
304
 
207
305
  Full bar rests are [similar to lilypond](http://www.lilypond.org/doc/v2.18/Documentation/notation/writing-rests#full-measure-rests), except there's no need to enter the rest value (it is implicit in the time signature):
208
306
 
209
- - time: 3/4
210
- // 4 bar rest in the middle
211
- 2c4e R*4 2.g
307
+ ```lydown
308
+ - time: 3/4
309
+ // 4 bar rest in the middle
310
+ 2c4e R*4 2.g
311
+ ```
312
+
313
+ Silences ([Invisible rests](http://lilypond.org/doc/v2.19/Documentation/notation/writing-rests.html#invisible-rests)) are signified using <code>s</code> for normal silences and <code>S</code> for whole measure silences:
314
+
315
+ ```lydown
316
+ 4ddsd
317
+ S*2
318
+ 2.s4d
319
+ ```
212
320
 
213
321
  ### Beams, slurs and ties
214
322
 
@@ -216,46 +324,64 @@ Lydown uses automatic beaming as the default, except in the case of vocal parts
216
324
 
217
325
  Beaming and sluring is similar to lilypond, except the beam/slur start comes before the note:
218
326
 
219
- 8(cdef)g[6fe]4f => c8( d e f) g f16[ e] f4
327
+ ```lydown
328
+ 8(cdef)g[6fe]4f => c8( d e f) g f16[ e] f4
329
+ ```
220
330
 
221
331
  a regular tie is written just like in lilypond:
222
332
 
223
- 4g~6gfed2c => g4 ~ g16 f e d c2
333
+ ```lydown
334
+ 4g~6gfed2c => g4 ~ g16 f e d c2
335
+ ```
224
336
 
225
337
  Lydown also supports a shortened tie form, where the tied note is not repeated:
226
338
 
227
- 4g6&fed2c => g4 ~ g16 f e d c2
339
+ ```lydown
340
+ 4g6&fed2c => g4 ~ g16 f e d c2
341
+ ```
228
342
 
229
343
  ### Articulation and expression marks
230
344
 
231
345
  Lilypond [shorthand articulation marks](http://www.lilypond.org/doc/v2.18/Documentation/notation/expressive-marks-attached-to-notes#articulations-and-ornamentations) can be entered after a backslash
232
346
 
233
- c\^ e\+ g\_ => c-^ e-+ g-_
347
+ ```lydown
348
+ c\^ e\+ g\_ => c-^ e-+ g-_
349
+ ```
234
350
 
235
351
  Common articulation marks can be entered immediately after the note:
236
352
 
237
- // tenuto, staccato, staccatissimo
238
- c_e.g` => c-- e-. g-!
353
+ ```lydown
354
+ // tenuto, staccato, staccatissimo
355
+ c_e.g` => c-- e-. g-!
356
+ ```
239
357
 
240
358
  Other arbitrary lilypond articulations can be entered after a backslash:
241
359
 
242
- c\staccato e\mordent g\turn => c\staccato e\mordent g\turn
360
+ ```lydown
361
+ c\staccato e\mordent g\turn => c\staccato e\mordent g\turn
362
+ ```
363
+
364
+ __Note__: While whitespace between notes is usually optional, in the case of backslashed articulations you will have to add a whitespace after the articulation, so lydown will be able to parse it.
243
365
 
244
366
  [Dynamic marks](http://www.lilypond.org/doc/v2.18/Documentation/notation/expressive-marks-attached-to-notes#dynamics) are entered before the note to which they apply:
245
367
 
246
- c\f eg
368
+ ```lydown
369
+ c\f eg
247
370
 
248
- \f cege \p cfaf => c\f e g e c\p f a f
371
+ \f cege \p cfaf => c\f e g e c\p f a f
372
+ ```
249
373
 
250
374
  Arbitrary expression markup can be entered as a string following a backslash. Lydown supports basic markdown syntax for formatting the expression:
251
375
 
252
- c\"hello" // displayed above the note
253
- c\_"hello" // displayed below the note
254
- c\<"hello" // right-aligned
255
- c\|"hello" // centered
256
- c\_|"hello" // centered, below the note
257
- c\"_hello_" // italic
258
- c\"__hello__" // bold
376
+ ```lydown
377
+ c\"hello" // displayed above the note
378
+ c\_"hello" // displayed below the note
379
+ c\<"hello" // right-aligned
380
+ c\|"hello" // centered
381
+ c\_|"hello" // centered, below the note
382
+ c\"_hello_" // italic
383
+ c\"__hello__" // bold
384
+ ```
259
385
 
260
386
  ### Repeated articulation and rhythmic patterns: macros
261
387
 
@@ -263,199 +389,258 @@ An important feature of lydown is the macro, which facilitates rapid entry of re
263
389
 
264
390
  A common scenario is repeated articulation, for example a sequence of staccato notes:
265
391
 
266
- {.}cdefgabc => c-. d-. e-. f-. g-. a-. b-. c-.
392
+ ```lydown
393
+ {.}cdefgabc => c-. d-. e-. f-. g-. a-. b-. c-.
394
+ ```
267
395
 
268
396
  A macro can also contain a fully qualified lilypond articulation specifier:
269
397
 
270
- {\tenuto}cege => c\tenuto e\tenuto g\tenuto e\tenuto
398
+ ```lydown
399
+ {\tenuto}cege => c\tenuto e\tenuto g\tenuto e\tenuto
400
+ ```
271
401
 
272
402
  Rhythmic macros can be used for repeated rhythmic patterns. A common scenario is a dotted rhythm:
273
403
 
274
- // The _ symbol denotes a note placeholder
275
- {8._6_}cdefgfed => c8. d16 e8. f16 g8. f16 e8. d16
404
+ ```lydown
405
+ // The _ symbol denotes a note placeholder
406
+ {8._6_}cdefgfed => c8. d16 e8. f16 g8. f16 e8. d16
407
+ ```
276
408
 
277
409
  A repeating diminution may also be expressed succintly:
278
410
 
279
- // The @ symbol denotes a repeated pitch
280
- {16_@@@}cfgf => c16 c c c f f f f g g g g f f f f
411
+ ```lydown
412
+ // The @ symbol denotes a repeated pitch
413
+ {16_@@@}cfgf => c16 c c c f f f f g g g g f f f f
414
+ ```
281
415
 
282
416
  A macro can include both durations and articulation marks:
283
417
 
284
- {4_~6@(_._._.)}cdefgfed => c4 ~ c16 d-.( e-. f-.) g4 ~ g16 f-.( e-. d-.)
418
+ ```lydown
419
+ {4_~6@(_._._.)}cdefgfed => c4 ~ c16 d-.( e-. f-.) g4 ~ g16 f-.( e-. d-.)
420
+ ```
285
421
 
286
422
  A macro containing durations will remain valid until another duration or duration macro is encountered. A macro containing articulation only will be valid until another duration, macro or empty macro is encountered:
287
423
 
288
- 6{.}gg{}aa => g16-. g-. a a
424
+ ```lydown
425
+ 6{.}gg{}aa => g16-. g-. a a
426
+ ```
289
427
 
290
428
  ### Named macros
291
429
 
292
430
  Macros can be defined with a name and reused:
293
431
 
294
- - macros:
295
- - dotted: 8._6_
296
- {dotted}gaba2g{dotted}abcb2a => g8. a16 b8. a16 g2 a8. b16 c8. b16 a2
432
+ ```lydown
433
+ - macros:
434
+ - dotted: 8._6_
435
+ {dotted}gaba2g{dotted}abcb2a => g8. a16 b8. a16 g2 a8. b16 c8. b16 a2
436
+ ```
297
437
 
298
438
  ### Clefs, key and time signatures
299
439
 
300
440
  Clefs are determined automatically by lydown based on the specified part. In case no part is specified, the default clef is a treble clef. The clef values are the same as in [lilypond](http://www.lilypond.org/doc/v2.18/Documentation/notation/displaying-pitches#clef). The clef can be changed at any time with a clef setting:
301
441
 
302
- - clef: bass
303
- 8cdefgabc
304
- - clef: tenor
305
- defedcbd
306
- - clef: bass
307
- 1c
442
+ ```lydown
443
+ - clef: bass
444
+ 8cdefgabc
445
+ - clef: tenor
446
+ defedcbd
447
+ - clef: bass
448
+ 1c
449
+ ```
308
450
 
309
451
  Key and time signatures are entered inline as document settings ([see below](#settings)). The [key](http://www.lilypond.org/doc/v2.18/Documentation/notation/displaying-pitches#key-signature) and [time](http://www.lilypond.org/doc/v2.18/Documentation/notation/displaying-rhythms#time-signature) values follow the lilypond syntax:
310
452
 
311
- - key: d major
312
- - time: 3/4
453
+ ```lydown
454
+ - key: d major
455
+ - time: 3/4
456
+ ```
313
457
 
314
458
  In the case of key signatures, accidentals will follow the lydown syntax:
315
459
 
316
- - key: b- major
317
- - key: f+ minor
460
+ ```lydown
461
+ - key: b- major
462
+ - key: f+ minor
463
+ ```
318
464
 
319
465
  Key signatures can also be specified using shorthand notation (upper case for major, lower case for minor):
320
466
 
321
- - key: B- // b flat major
322
- - key: f+ // f sharp minor
467
+ ```lydown
468
+ - key: B- // b flat major
469
+ - key: f+ // f sharp minor
470
+ ```
323
471
 
324
472
  The default key signature is C major, and the default time signature is 4/4.
325
473
 
326
474
  Key or time signatures can be changed on the fly:
327
475
 
328
- - time: 4/4
329
- 4c e g b
330
- - time: 3/4
331
- c e g 2.c
476
+ ```lydown
477
+ - time: 4/4
478
+ 4c e g b
479
+ - time: 3/4
480
+ c e g 2.c
481
+ ```
332
482
 
333
483
  ### Pickup bars
334
484
 
335
485
  [Pickup bars](http://www.lilypond.org/doc/v2.18/Documentation/notation/displaying-rhythms#upbeats) (anacrusis, upbeat) are defined with the pickup setting:
336
486
 
337
- - time: 3/4
338
- - pickup: 4
339
- 4g
340
- c8cdcb4aaa
341
- d8dedc4bb
487
+ ```lydown
488
+ - time: 3/4
489
+ - pickup: 4
490
+ 4g
491
+ c8cdcb4aaa
492
+ d8dedc4bb
493
+ ```
342
494
 
343
495
  ### Lilypond Commands and inline settings
344
496
 
345
497
  Lilypond commands and settings can be entered inline as part of the note stream:
346
498
 
347
- cd \key:E- e \stemDown f
499
+ ```lydown
500
+ cd \key:E- e \stemDown f
501
+ ```
348
502
 
349
503
  A useful shorthand is for one-time (<code>\once</code>) overrides, with an exclamation mark between the backslash and the command:
350
504
 
351
- \!override:"NoteHead.color = #red"
505
+ ```lydown
506
+ \!override:"NoteHead.color = #red"
507
+ ```
352
508
 
353
509
  Multiple arguments can be given, separated by colons. Arguments need to be quoted only if they contain whitespace, or colons:
354
510
 
355
- \!override:AccidentalSuggestion:"#'avoid-slur = #'outside"
511
+ ```lydown
512
+ \!override:AccidentalSuggestion:"#'avoid-slur = #'outside"
513
+ ```
356
514
 
357
515
  Some lilypond command arguments are expected to be quoted. Quotes can be escaped by prefixing them with a backslash:
358
516
 
359
- \footnote:"#'(-1 . 1)":"\"slurred?\""
517
+ ```lydown
518
+ \footnote:"#'(-1 . 1)":"\"slurred?\""
519
+ ```
360
520
 
361
521
  ### Inline lyrics
362
522
 
363
523
  Lyrics for vocal parts can be entered on separate lines prefixed by a > symbol:
364
524
 
365
- 4c[8de]4fd(4c[8de]2f)
366
- > Ly-down is the bomb__
525
+ ```lydown
526
+ 4c[8de]4fd(4c[8de]2f)
527
+ > Ly-down is the bomb__
528
+ ```
367
529
 
368
530
  Or between notes using quotes:
369
531
 
370
- 4c[8de]4fd(4c[8de]2f) >"Ly-down is the bomb__"
532
+ ```lydown
533
+ 4c[8de]4fd(4c[8de]2f) >"Ly-down is the bomb__"
534
+ ```
371
535
 
372
536
  Text alignment follows the duration, beaming and slurring of the music, [just like in lilypond](http://www.lilypond.org/doc/v2.18/Documentation/notation/common-notation-for-vocal-music#automatic-syllable-durations). Sillables are expected to be separated by a dash. Melismas, i.e. a single sillable streched over multiple notes, is signified by one or more underscores.
373
537
 
374
538
  Multiple stanzas for the same music can be specified by including the stanza number in parens:
375
539
 
376
- 4cege1c
377
- > Ly-down is the bomb.
378
- >(2) Li-ly-pond is too.
540
+ ```lydown
541
+ 4cege1c
542
+ > Ly-down is the bomb.
543
+ >(2) Li-ly-pond is too.
544
+ ```
379
545
 
380
546
  ### Stream switching
381
547
 
382
548
  Lyrics can be entered in a block, before or after musical notation, by switching streams:
383
549
 
384
- 8ccg'gaa4g
385
- 8ffeedd4c
386
- =lyrics
387
- Twin-kle twin-kle lit-tle star,
388
- How I won-der what you are.
389
- =music
390
- 8g'gffeed4
391
- ...
550
+ ```lydown
551
+ 8ccg'gaa4g
552
+ 8ffeedd4c
553
+ =lyrics
554
+ Twin-kle twin-kle lit-tle star,
555
+ How I won-der what you are.
556
+ =music
557
+ 8g'gffeed4
558
+ ...
559
+ ```
392
560
 
393
561
  Multiple lyrics stanzas can be written by including the stanza number in parens:
394
562
 
395
- =lyrics(1) // optional, same as =lyrics
396
- ...
397
- =lyrics(2)
398
- ...
563
+ ```lydown
564
+ =lyrics(1) // the numbering is optional, same as =lyrics
565
+ ...
566
+ =lyrics(2)
567
+ ...
568
+ ```
399
569
 
400
570
  ### Figured bass
401
571
 
402
572
  Figured bass is entered inline, following notes or even between notes, when
403
573
  multiple figures align with a single note.
404
574
 
405
- c<6>de<5>c // figures are automatically rhythmically aligned
406
- e<7`> // barred figure
407
- f<6+> // sharp 6th
408
- g<6-> // flat 6th
409
- g<6!> // natural sixth
410
- a<h> // natural third
411
- a<#> // sharp third
412
- a<b> // flat third
413
- b<7#>b<6_> // extender (tenue) line on sharp third
414
- 1c2<6><7-> // use durations to change figures over a long note
415
- 1c2<><7-> // <> is an empty figure
416
- c<->dec<.> // extender (tenue) line without figures over the four notes
575
+ ```lydown
576
+ c<6>de<5>c // figures are automatically rhythmically aligned
577
+ e<7`> // barred figure
578
+ f<6+> // sharp 6th
579
+ g<6-> // flat 6th
580
+ g<6!> // natural sixth
581
+ a<h> // natural third
582
+ a<#> // sharp third
583
+ a<b> // flat third
584
+ b<7#>b<6_> // extender (tenue) line on sharp third
585
+ 1c2<6><7-> // use durations to change figures over a long note
586
+ 1c2<><7-> // <> is an empty figure
587
+ c<->dec<.> // extender (tenue) line without figures over the four notes
588
+ ```
417
589
 
418
590
  ## Multiple parts
419
591
 
420
592
  Multiple parts can be entered in the same file by prefixing each part's content with a -part setting:
421
593
 
422
- - part: violino1
423
- 8c'cg'gaa4g
424
- - part: continuo
425
- 4cefe
594
+ ```lydown
595
+ - part: violino1
596
+ 8c'cg'gaa4g
597
+ - part: continuo
598
+ 4cefe
599
+ ```
426
600
 
427
601
  ## Multiple movements
428
602
 
429
603
  For multi-movement works, prefix each movement with a -movement setting:
430
604
 
431
- - movement: Adagio
432
- ...
433
- - movement: Allegro
434
- ...
605
+ ```lydown
606
+ - movement: Adagio
607
+ ...
608
+ - movement: Allegro
609
+ ...
610
+ ```
435
611
 
436
612
  ## Multiple voices
437
613
 
438
614
  [Multiple voices](http://www.lilypond.org/doc/v2.18/Documentation/notation/multiple-voices#single_002dstaff-polyphony) on the same staff can be easily entered using the following notation:
439
615
 
440
- 1: 8egfdeg4f 2: 4cded u: ...
616
+ ```lydown
617
+ 1: 8egfdeg4f 2: 4cded u: ...
618
+ ```
441
619
 
442
620
  the <code>u:<\code> command is used to return to single voice (_unisono_) mode.
443
621
 
444
622
  Lyrics can be added for individual voices by using inline lyrics:
445
623
 
446
- 1: ceg >"yeah yeah yeah" 2: gbd >"no no no" u: ...
624
+ ```lydown
625
+ 1: ceg >"yeah yeah yeah" 2: gbd >"no no no" u: ...
626
+ ```
447
627
 
448
628
  ## Piano scores
449
629
 
450
630
  [Piano/keyboard scores](http://www.lilypond.org/doc/v2.18/Documentation/notation/common-notation-for-keyboards) can be created by using the <code>r/l</code> (right/left) prefixes:
451
631
 
452
- r: 8cdeccdec
453
- l: 4cgcg
632
+ ```lydown
633
+ - part: piano
634
+ r: 8cdeccdec
635
+ l: 4cgcg
636
+ ```
454
637
 
455
638
  In order to jump between staves, you can use the special commands <code>\r, \l</code>
456
639
 
457
- r: 8<e'c'> \l g,f+g \r <g'' c'> \l e,,d+e \r
458
- l: 1s
640
+ ```lydown
641
+ r: 8<e'c'> \l g,f+g \r <g'' c'> \l e,,d+e \r
642
+ l: 1s
643
+ ```
459
644
 
460
645
  ## multi-part scores and part extraction
461
646
 
@@ -463,6 +648,7 @@ As the example above shows, lydown supports multiple parts in the same file, but
463
648
 
464
649
  For this we create a main file which defines the score structure:
465
650
 
651
+ ```lydown
466
652
  // score.lydown
467
653
  - score:
468
654
  - [violino1, violino2]
@@ -470,37 +656,44 @@ For this we create a main file which defines the score structure:
470
656
  - violoncello
471
657
  - time: 4/4
472
658
  - key: c major
659
+ ```
473
660
 
474
661
  Then we enter the music in a separate file for each part:
475
662
 
663
+ ```lydown
476
664
  // violino1.lydown
477
665
  8c''cg'gaa4g 8ffeedd4c
666
+ ```
478
667
 
479
668
  And so forth.
480
669
 
481
670
  To compile the score, we use the following command:
482
671
 
483
- lydown -o -s score.lydown
672
+ lydown -o -s score.lydown
484
673
 
485
674
  To extract a specific part, we use the -p switch:
486
675
 
487
- lydown -o -p violino1 score.lydown
676
+ lydown -o -p violino1 score.lydown
488
677
 
489
678
  ## Colla parte and part sources
490
679
 
491
680
  lydown provides two ways to reuse a part's music in another part. The first is by defining a part source:
492
681
 
493
- - parts:
494
- - violino1:
495
- - source: soprano
682
+ ```lydown
683
+ - parts:
684
+ - violino1:
685
+ - source: soprano
686
+ ```
496
687
 
497
688
  When dealing situations such as a choral being doubled by many instruments, a more convenient approach would be the <code>colla_parte</code> setting:
498
689
 
499
- - colla_parte:
500
- - soprano: violino1, flute1, flute2, oboe1
501
- - alto: violino2, oboe2
502
- - tenor: viola, gamba1
503
- - basso: gamba2
690
+ ```lydown
691
+ - colla_parte:
692
+ - soprano: violino1, flute1, flute2, oboe1
693
+ - alto: violino2, oboe2
694
+ - tenor: viola, gamba1
695
+ - basso: gamba2
696
+ ```
504
697
 
505
698
  It is important to remember that the <code>colla_parte</code> setting is the opposite of the part source. Instead of defining a source for a part, it defines the parts that follow the source part.
506
699
 
@@ -508,9 +701,11 @@ It is important to remember that the <code>colla_parte</code> setting is the opp
508
701
 
509
702
  When extracing parts, some cases, such as recitatives, require displaying another part together with the part to be extracted. Parts can be included in extracted parts using the <code>include_parts</code> setting:
510
703
 
511
- - parts:
512
- - continuo:
513
- - include_parts: tenore
704
+ ```lydown
705
+ - parts:
706
+ - continuo:
707
+ - include_parts: tenore
708
+ ```
514
709
 
515
710
  multiple parts can be specified by comma separating them.
516
711
 
@@ -518,7 +713,9 @@ multiple parts can be specified by comma separating them.
518
713
 
519
714
  The <code>\mode</code> and <code>\nomode</code> commands can be used to render code for specific modes. This can be useful when the extracted part should display a different music than the score. The mode command causes anything after it to be rendered only when the rendering mode matches the specified mode.
520
715
 
521
- \mode:score 4cege \mode:part 4cded \mode:none 1c
716
+ ```lydown
717
+ \mode:score 4cege \mode:part 4cded \mode:none 1c
718
+ ```
522
719
 
523
720
  The example above will be render as <code>4cege1c</code> when in score mode, and as <code>4cded1c</code> in the extracted part.
524
721
 
@@ -530,31 +727,39 @@ Numerous settings can be used to control the way staves and systems are displaye
530
727
 
531
728
  When a single movement switches between different ensembles, for example a recitativo secco followed by a recitativo accompagnato, empty staves may be hidden using setting <code>empty_staves</code> setting:
532
729
 
533
- - empty_staves: hide
730
+ ```lydown
731
+ - empty_staves: hide
732
+ ```
534
733
 
535
734
  Normally, instrument names are shown according to convention, to the left of each staff in the first system. To hide the instrument names on the first system, use the <code>instrument_names</code> setting:
536
735
 
537
- - instrument_names: hide
736
+ ```lydown
737
+ - instrument_names: hide
738
+ ```
538
739
 
539
740
  The <code>instrument_names</code> setting can also be set to <inline>, in which case the instrument name will be displayed above the beginning of each staff in the first system.
540
741
 
541
742
  To show the instrument name inline at any point in the music, use the <code>\instr</code> command:
542
743
 
543
- - part: flute
544
- R*4
545
- // when no parameter is given, the part name is used,
546
- // and engraved capitalized with numbers formatted to roman numerals
547
- \instr 4c8eg2c
548
- ...
549
- // when the instrument name is specifed, it is used in place of the
550
- // part name:
551
- \instr:"Flute II" 4c8eg2c
744
+ ```lydown
745
+ - part: flute
746
+ R*4
747
+ // when no parameter is given, the part name is used,
748
+ // and engraved capitalized with numbers formatted to roman numerals
749
+ \instr 4c8eg2c
750
+ ...
751
+ // when the instrument name is specifed, it is used in place of the
752
+ // part name:
753
+ \instr:"Flute II" 4c8eg2c
754
+ ```
552
755
 
553
756
  The <code>\instr</code> command can also accept an alignment modifier:
554
757
 
555
- \<instr // right-aligned
556
- \>instr // left-aligned (default)
557
- \|instr // centered
758
+ ```lydown
759
+ \<instr // right-aligned
760
+ \>instr // left-aligned (default)
761
+ \|instr // centered
762
+ ```
558
763
 
559
764
  Another setting which controls the display of instrument names is <code>instrument_name_style</code> which can be set to <code>normal</code> or <code>smallcaps</code>, in which case the instrument name will be engraved using small caps.
560
765
 
@@ -566,19 +771,60 @@ In order to render the source code into MIDI, the midi format should be specifie
566
771
 
567
772
  The playback tempo can be specified either using the <code>midi_tempo</code> setting:
568
773
 
569
- - midi_tempo: 4=96
774
+ ```lydown
775
+ - midi_tempo: 4=96
776
+ ```
570
777
 
571
778
  Or inline using the <code>tempo</code> command, putting the tempo in parens:
572
779
 
573
- \tempo:(4=120)
574
- cdef
575
- /tempo:(4=54)
576
- gabc
780
+ ```lydown
781
+ \tempo:(4=120)
782
+ cdef
783
+ /tempo:(4=54)
784
+ gabc
785
+ ```
577
786
 
578
- Rendering of mp3 files requires both [timidity](http://timidity.sourceforge.net/) and [LAME](http://lame.sourceforge.net/) to be installed. The mp3 format needs to be
787
+ Rendering of mp3 files requires both [timidity](http://timidity.sourceforge.net/) and [LAME](http://lame.sourceforge.net/) to be installed.
579
788
 
580
- ## Adding a front cover
789
+ ## Including files
790
+
791
+ Lilypond files can be included into the generated lilypond code by using <code>include</code> settings:
792
+
793
+ ```lydown
794
+ - include: abc.ly
795
+ ```
796
+
797
+ Multiple files can be included by adding an include setting for each file. Mode-specific include files can be defined by nesting include statements inside of <code>score</code> or <code>parts</code> settings:
798
+
799
+ ```lydown
800
+ - score:
801
+ - include: def.ly // included only in score mode
802
+ - parts:
803
+ - include: ghi.ly // included only in part mode
804
+ ```
581
805
 
582
- When creating professional scores and parts, it is customary to add a cover page, with the title of the piece, the composer's name and other general information.
806
+ The include statements are placed inside of a movement's score block as lilypond [\include](http://lilypond.org/doc/v2.19/Documentation/notation/including-lilypond-files.html) commands, so for each movement different includes can be defined.
583
807
 
808
+ To place includes at the beginning of the lilypond document, includes should be defined under the <code>document</code> setting:
809
+
810
+ ```lydown
811
+ - document:
812
+ - include: def.ly // this will be included at the top of the lilypond doc
813
+ ```
814
+
815
+ Pathnames are relative to the lydown source file.
816
+
817
+ ### Including templates
818
+
819
+ In addition to including normal lilypond files, Lydown also supports the rendering of templates into the generated lilypond doc, by using the <code>.ely</code> extension. The templates should be written using Ruby's [ERB](http://www.stuartellis.eu/articles/erb/) syntax, and are supplied with the lydown context object as <code>self</code>. A trivial example:
820
+
821
+ ```lilypond
822
+ \markup {
823
+ % will output either 'score' or 'part' according to the rendering mode
824
+ <%= self.render_mode %>
825
+ }
826
+ ```
827
+
828
+ ## Adding a front cover
584
829
 
830
+ To be continued...