lilylet-live-editor 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,932 @@
1
+ # Lilylet Language Tutorial
2
+
3
+ Lilylet is a text-based music notation language inspired by [LilyPond](https://lilypond.org/). It uses a simplified syntax optimized for embedding music snippets in Markdown documents—ideal for tutorials, analyses, exercises, and documentation where music examples appear alongside explanatory text.
4
+
5
+ **Audience:** readers with music theory background who understand Markdown. Some may know LilyPond; others may not.
6
+ **Goal:** learn Lilylet basics quickly and use it effectively inside Markdown documents.
7
+
8
+ ---
9
+
10
+ ## Table of Contents
11
+
12
+ 1. [Quick Start: Lilylet inside Markdown](#quick-start-lilylet-inside-markdown)
13
+ 2. [Pitches](#pitches)
14
+ 3. [Rhythms and Durations](#rhythms-and-durations)
15
+ 4. [Rests](#rests)
16
+ 5. [Accidentals](#accidentals)
17
+ 6. [Key and Time Signatures](#key-and-time-signatures)
18
+ 7. [Barlines](#barlines)
19
+ 8. [Chords](#chords)
20
+ 9. [Articulations](#articulations)
21
+ 10. [Fingering](#fingering)
22
+ 11. [Dynamics](#dynamics)
23
+ 12. [Slurs, Ties, and Beams](#slurs-ties-and-beams)
24
+ 13. [Ornaments](#ornaments)
25
+ 14. [Grace Notes](#grace-notes)
26
+ 15. [Tuplets](#tuplets)
27
+ 16. [Tremolo](#tremolo)
28
+ 17. [Multiple Voices](#multiple-voices)
29
+ 18. [Multiple Staves](#multiple-staves)
30
+ 19. [Advanced Features](#advanced-features)
31
+ 20. [Complete Examples](#complete-examples)
32
+ 21. [Practical Writing Tips](#practical-writing-tips)
33
+
34
+ ---
35
+
36
+ ## Quick Start: Lilylet inside Markdown
37
+
38
+ Lilylet is a text-based music notation language with a LilyPond-like command style, but optimized for quick entry and editing. The typical workflow is to embed Lilylet snippets in Markdown code blocks (```lilylet), next to explanations, analyses, exercises, or version comparisons.
39
+
40
+ **Your first score:**
41
+
42
+ ```lilylet
43
+ \time 4/4 \clef "treble"
44
+ c4 d e f | g2 g | a4 a a a | g1
45
+ ```
46
+
47
+ Notes:
48
+ - Commands like `\time`, `\key`, `\clef`, articulations, and dynamics follow familiar LilyPond conventions.
49
+ - Bar lines `|` help you explain or revise music **measure by measure**, which fits well with Markdown-based teaching materials and documentation.
50
+
51
+ ---
52
+
53
+ ## Pitches
54
+
55
+ ### Note names
56
+
57
+ Use lowercase `a`–`g`:
58
+
59
+ ```lilylet
60
+ \time 4/4
61
+ c4 d e f | g a b c
62
+ ```
63
+
64
+ ### Relative pitch (default)
65
+
66
+ Lilylet always uses relative pitch (similar to LilyPond): if you omit octave markers, Lilylet picks the octave so the interval from the previous note is **less than a fifth** (keeps motion local and predictable).
67
+
68
+ - Reference pitch at the start: **middle C (C4)**
69
+ - Each next pitch is interpreted relative to the previous one
70
+
71
+ ```lilylet
72
+ \time 4/4
73
+ c4 d e f | g a b c | c b a g | f e d c
74
+ ```
75
+
76
+ ### Why "less than a fifth" matters
77
+
78
+ ```lilylet
79
+ \time 4/4 \clef "C"
80
+ c4 e c f | c g c a
81
+ ```
82
+
83
+ From middle C, writing `g` after `c` selects the nearer G (the one below, a fourth down) rather than jumping up a fifth. This rule reduces unintended octave jumps.
84
+
85
+ ### Octave markers
86
+
87
+ Use octave markers to force larger leaps:
88
+
89
+ | Marker | Effect |
90
+ |--------|--------|
91
+ | `'` (apostrophe) | Raise one octave |
92
+ | `,` (comma) | Lower one octave |
93
+
94
+ ```lilylet
95
+ \time 4/4
96
+ c4 c' c' c' | c,,, c'' c, c'
97
+ ```
98
+
99
+ ```lilylet
100
+ \time 4/4
101
+ c4 g' c g | c' g e c
102
+ ```
103
+
104
+ ### Newlines reset pitch (Lilylet-specific)
105
+
106
+ Different from LilyPond: inserting a **line break** (newline) resets the relative-pitch reference to **middle C**. This is useful when your Markdown is organized as "one line = one bar/phrase", because moving or inserting lines won't unexpectedly shift later octaves.
107
+
108
+ ```lilylet
109
+ \time 4/4
110
+ c4 d e f | g a b c |
111
+ c4 b a g | f e d c |
112
+ ```
113
+
114
+ If you want the second line to start higher, specify it explicitly:
115
+
116
+ ```lilylet
117
+ \time 4/4
118
+ c4 d e f | g a b c |
119
+ c'4 b a g | f e d c |
120
+ ```
121
+
122
+ #### Why Lilylet differs from LilyPond here
123
+
124
+ Unlike LilyPond's typical workflow of writing an entire voice from start to finish, Lilylet favors interleaved, measure-by-measure voice entry: write all voices for a measure before advancing to the next. This makes multi-voice alignment and live editing simpler, and ensures relative-pitch decisions (octave choice, small-interval preference) are resolved locally within each measure.
125
+
126
+ Resetting the pitch reference on newlines keeps short snippets stable when copied, reordered, or edited inside a Markdown document. Long, continuous monophonic lines remain supported but are primarily useful for educational examples; in practical Lilylet usage, prefer short, interleaved voice segments for clearer notation and more predictable rendering.
127
+
128
+ ---
129
+
130
+ ## Rhythms and Durations
131
+
132
+ ### Duration values
133
+
134
+ Append a number to a note name:
135
+
136
+ | Number | Duration | Name |
137
+ |--------|----------|------|
138
+ | 1 | Whole note | Semibreve |
139
+ | 2 | Half note | Minim |
140
+ | 4 | Quarter note | Crotchet |
141
+ | 8 | Eighth note | Quaver |
142
+ | 16 | Sixteenth note | Semiquaver |
143
+ | 32 | Thirty-second note | Demisemiquaver |
144
+ | 64 | Sixty-fourth note | Hemidemisemiquaver |
145
+
146
+ ```lilylet
147
+ \time 4/4
148
+ g'1 | g2 g2 | g4 g4 g4 g4 | g8 g8 g8 g8 g8 g8 g8 g16 g32 g64 g128 g128\rest |
149
+ ```
150
+
151
+ ### Duration persistence
152
+
153
+ If you omit the duration, Lilylet reuses the previous one:
154
+
155
+ ```lilylet
156
+ \time 4/4
157
+ c4 d e f | g a b c
158
+ ```
159
+
160
+ ### Dotted notes
161
+
162
+ Add dots after the duration:
163
+
164
+ | Notation | Duration |
165
+ |----------|----------|
166
+ | `c4.` | Dotted quarter |
167
+ | `c2.` | Dotted half |
168
+ | `c4..` | Double-dotted quarter |
169
+
170
+ ```lilylet
171
+ \time 6/8
172
+ c4. d4. | e8 e e f4.
173
+ ```
174
+
175
+ ```lilylet
176
+ \time 12/8
177
+ c2. e | g8. g16 g4.. g16
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Rests
183
+
184
+ ### Basic rests
185
+
186
+ Use `r` plus a duration:
187
+
188
+ ```lilylet
189
+ \time 4/4
190
+ c4 r4 e4 r4 | g2 r2
191
+ ```
192
+
193
+ ### Full-measure rests
194
+
195
+ Use `R` for a centered full-measure rest (display style), while duration may vary:
196
+
197
+ ```lilylet
198
+ \time 4/4
199
+ R1 | g'4 a b c
200
+ ```
201
+
202
+ ```lilylet
203
+ \time 3/4
204
+ R2. | c4 d e
205
+ ```
206
+
207
+ ### Space rests (invisible)
208
+
209
+ Use `s` to reserve rhythmic space without printing a rest (common in multi-voice alignment):
210
+
211
+ ```lilylet
212
+ \time 4/4 \clef "bass"
213
+ r4 d, b b \\
214
+ s4 g,2 e4
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Accidentals
220
+
221
+ Lilylet uses LilyPond's English pitch spelling:
222
+ - `s` for sharp
223
+ - `f` for flat
224
+
225
+ | Notation | Meaning |
226
+ |----------|---------|
227
+ | `cs` | C sharp |
228
+ | `cf` | C flat |
229
+ | `ds` | D sharp |
230
+ | `ef` | E flat |
231
+
232
+ ```lilylet
233
+ \time 4/4
234
+ c4 cs d ds | e f fs g | gs a as b | c1
235
+ ```
236
+
237
+ Double accidentals:
238
+ - `ss` double-sharp
239
+ - `ff` double-flat
240
+
241
+ ```lilylet
242
+ \time 4/4
243
+ c4 css d dff | e1
244
+ ```
245
+
246
+ ```lilylet
247
+ \key e \minor
248
+ \time 4/4
249
+ e4 fs g a | b cs ds e | e d c b | a g fs e
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Key and Time Signatures
255
+
256
+ ### Time signature: `\time`
257
+
258
+ ```lilylet
259
+ \time 3/4
260
+ c4 d e | f g a | b c d | e2.
261
+ ```
262
+
263
+ Common meters:
264
+
265
+ ```lilylet
266
+ \time 4/4
267
+ c4 d e f | g1
268
+ ```
269
+
270
+ ```lilylet
271
+ \time 3/4
272
+ c4 d e | f2.
273
+ ```
274
+
275
+ ```lilylet
276
+ \time 6/8
277
+ c4. d | e4. f
278
+ ```
279
+
280
+ ```lilylet
281
+ \time 2/2
282
+ c2 d | e f | g1
283
+ ```
284
+
285
+ ### Key signature: `\key`
286
+
287
+ Use `\key` + tonic + mode:
288
+
289
+ ```lilylet
290
+ \key g \major
291
+ \time 4/4
292
+ g4 a b c | d e fs g
293
+ ```
294
+
295
+ ```lilylet
296
+ \key d \minor
297
+ \time 4/4
298
+ d4 e f g | a bf cs d
299
+ ```
300
+
301
+ More examples:
302
+
303
+ ```lilylet
304
+ \key c \major
305
+ \time 4/4
306
+ c4 d e f | g a b c
307
+ ```
308
+
309
+ ```lilylet
310
+ \key f \major
311
+ \time 4/4
312
+ f4 g a bf | c d e f
313
+ ```
314
+
315
+ ```lilylet
316
+ \key a \minor
317
+ \time 4/4
318
+ a4 b c d | e f gs a
319
+ ```
320
+
321
+ ### Clef: `\clef`
322
+
323
+ ```lilylet
324
+ \clef "bass"
325
+ \time 4/4
326
+ c,4 d e f | g a b c
327
+ ```
328
+
329
+ ```lilylet
330
+ \clef "alto"
331
+ \time 4/4
332
+ c4 d e f | g a b c
333
+ ```
334
+
335
+ Supported clefs: `treble`, `bass`, `alto`
336
+
337
+ ---
338
+
339
+ ## Barlines
340
+
341
+ By default, Lilylet uses standard single barlines `|` to separate measures. For special barlines, use the `\bar` command.
342
+
343
+ ### Barline types
344
+
345
+ | Notation | Meaning |
346
+ |----------|---------|
347
+ | `\bar "\|\|"` | Double barline |
348
+ | `\bar "\|."` | Final barline (end of piece) |
349
+ | `\bar ":\|."` | End repeat |
350
+ | `\bar ".\|:"` | Start repeat |
351
+
352
+ ```lilylet
353
+ \time 4/4
354
+ c4 d e f \bar "||" | g a b c
355
+ ```
356
+
357
+ ```lilylet
358
+ \time 4/4
359
+ c4 d e f | g a b c \bar "|."
360
+ ```
361
+
362
+ ### Repeat barlines
363
+
364
+ ```lilylet
365
+ \time 4/4
366
+ c4 d e f \bar ".|:" | g a b c | d e f g \bar ":|."
367
+ ```
368
+
369
+ ---
370
+
371
+ ## Chords
372
+
373
+ ### Basic chords
374
+
375
+ Enclose pitches in angle brackets `< >`:
376
+
377
+ ```lilylet
378
+ \time 4/4
379
+ <c e g>4 <d f a> <e g b> <f a c> | <g b d>1
380
+ ```
381
+
382
+ ### Progressions / texture examples
383
+
384
+ ```lilylet
385
+ \time 4/4
386
+ <c e g>2 <f, a c> | <g b d> <c e g> | <c e g>1
387
+ ```
388
+
389
+ ```lilylet
390
+ \time 4/4
391
+ <cs e a cs>4 \arpeggio <b d g b>2. \arpeggio | <a cs e a>1 \arpeggio
392
+ ```
393
+
394
+ **Note**: only the first pitch in a chord will pass the relative pitch base to next music event. And inside a chord, pitches also follow relative pitch rules.
395
+
396
+ ```
397
+ Example: <c e g> <d f a> <e g b>
398
+
399
+ Chord 1 Chord 2 Chord 3
400
+ g a b
401
+ ↓ ↓ ↓
402
+ e f g (relative to previous pitch in chord)
403
+ ↓ ↓ ↓
404
+ c ←───────── d ←───────── e (relative pitch bass passing by the root pitch in chords)
405
+ ```
406
+
407
+ ### Chord duration
408
+
409
+ The duration applies to the entire chord:
410
+
411
+ ```lilylet
412
+ \time 4/4
413
+ <c e g>4 <c e g>8 <c e g>8 <c e g>2
414
+ ```
415
+
416
+ ### Chord symbols (lead sheet style)
417
+
418
+ Use `\chords "symbol"` to add chord symbols above the staff, commonly used in lead sheets and jazz charts:
419
+
420
+ ```lilylet
421
+ \time 4/4
422
+ c'4 \chords "C" e g c | a, \chords "Am" c e a
423
+ ```
424
+
425
+ ```lilylet
426
+ \time 4/4
427
+ c'4 \chords "Cmaj7" d e f | g \chords "G7" a b c
428
+ ```
429
+
430
+ ---
431
+
432
+ ## Articulations
433
+
434
+ Lilylet supports LilyPond-style commands and common shorthand:
435
+
436
+ | Command | Shorthand | Name |
437
+ |---------|-----------|------|
438
+ | `\staccato` | `-.` or `.` | Staccato |
439
+ | `\tenuto` | `--` or `-` | Tenuto |
440
+ | `\accent` | `->` or `>` | Accent |
441
+ | `\marcato` | `-^` or `^` | Marcato |
442
+ | `\staccatissimo` | `-!` or `!` | Staccatissimo |
443
+ | `\portato` | `-_` or `_` | Portato |
444
+
445
+ **Dot warning (`.`):**
446
+ - After a duration number: `c4.` = dotted rhythm
447
+ - As an articulation: `c4-.` or `c.` = staccato
448
+
449
+ ```lilylet
450
+ \time 4/4
451
+ c4-. d-. e-. f-. | g4\staccato a\staccato b\staccato c\staccato
452
+ ```
453
+
454
+ ```lilylet
455
+ \time 4/4
456
+ c4\staccato d\tenuto e\accent f\marcato | g4-. a-- b-> c-^
457
+ ```
458
+
459
+ ### Placement (above/below)
460
+
461
+ Prefix the articulation with:
462
+ - `^` above
463
+ - `_` below
464
+
465
+ ```lilylet
466
+ \time 4/4
467
+ c4^. d_. e^> f_>
468
+ ```
469
+
470
+ ---
471
+
472
+ ## Fingering
473
+
474
+ Use `-1` through `-5` to add fingering numbers to notes, commonly used in piano and guitar music:
475
+
476
+ ```lilylet
477
+ \time 4/4
478
+ c'4-1 d-2 e-3 f-4 | g-5 a-3 b-2 c-1
479
+ ```
480
+
481
+ Fingering can also be applied to chords:
482
+
483
+ ```lilylet
484
+ \time 4/4
485
+ <c e c'>2-1-2-5 <e g c>-2-3-5 | <e g b>-1-2-4 <f a c>-1-2-3
486
+ ```
487
+
488
+ ### Fingering placement
489
+
490
+ Use `^` for above or `_` for below.
491
+
492
+ ```lilylet
493
+ \time 4/4
494
+ c'4^1 d^2 e^3 f^4 | g_5 a_3 b_2 c_1
495
+ ```
496
+
497
+ ---
498
+
499
+ ## Dynamics
500
+
501
+ ### Dynamic markings
502
+
503
+ | Notation | Meaning |
504
+ |----------|---------|
505
+ | `\ppp` | Pianississimo |
506
+ | `\pp` | Pianissimo |
507
+ | `\p` | Piano |
508
+ | `\mp` | Mezzo-piano |
509
+ | `\mf` | Mezzo-forte |
510
+ | `\f` | Forte |
511
+ | `\ff` | Fortissimo |
512
+ | `\fff` | Fortississimo |
513
+ | `\sfz` | Sforzando |
514
+
515
+ ```lilylet
516
+ \time 4/4
517
+ c4\pp d e f | g\mf a b c | d\f e f g | a\ff b c d\sfz
518
+ ```
519
+
520
+ ### Hairpins (crescendo/diminuendo)
521
+
522
+ | Notation | Meaning |
523
+ |----------|---------|
524
+ | `\<` | Start crescendo |
525
+ | `\>` | Start diminuendo |
526
+ | `\!` | End hairpin |
527
+
528
+ ```lilylet
529
+ \time 4/4
530
+ c4\< d e f | g a b c\!
531
+ ```
532
+
533
+ ```lilylet
534
+ \time 4/4
535
+ c'4\> b a g | f e d c\!
536
+ ```
537
+
538
+ ```lilylet
539
+ \time 4/4
540
+ c4\pp\< d e f | g\mf a b c | d e f g\! | a\ff\> b a g | f\p\! e d c
541
+ ```
542
+
543
+ ---
544
+
545
+ ## Slurs, Ties, and Beams
546
+
547
+ ### Slurs
548
+
549
+ Use `(` to start and `)` to end:
550
+
551
+ ```lilylet
552
+ \time 4/4
553
+ c4( d e f) | g( a b c) | c( b a g) | f1
554
+ ```
555
+
556
+ ### Ties
557
+
558
+ Use `~` between the same pitch:
559
+
560
+ ```lilylet
561
+ \time 4/4
562
+ c2~ c4 d | e2~ e4 f | g1~ | g2 r2
563
+ ```
564
+
565
+ ```lilylet
566
+ \time 4/4
567
+ c4 d8~ d c4 d | e8~ e d4~ d e | f2~ f4 g | a1
568
+ ```
569
+
570
+ ### Beams
571
+
572
+ Use `[` and `]`:
573
+
574
+ ```lilylet
575
+ \time 4/4
576
+ c8[ d e f] g[ a b c] | c[ b a g] f4 r
577
+ ```
578
+
579
+ ```lilylet
580
+ \time 6/8
581
+ c8[ d e] f[ g a] | b[ c d] e4.
582
+ ```
583
+
584
+ **Note**: As in LilyPond, `(` `)` `[` `]` are postfixes on musical events, not scope delimiters.
585
+
586
+ ---
587
+
588
+ ## Ornaments
589
+
590
+ | Notation | Name |
591
+ |----------|------|
592
+ | `\trill` | Trill |
593
+ | `\turn` | Turn |
594
+ | `\mordent` | Mordent |
595
+ | `\prall` | Pralltriller |
596
+ | `\fermata` | Fermata |
597
+ | `\shortfermata` | Short fermata |
598
+ | `\arpeggio` | Arpeggio (for chords) |
599
+
600
+ ```lilylet
601
+ \time 4/4
602
+ c2\trill d | e4\trill f g2 | a1\trill
603
+ ```
604
+
605
+ ```lilylet
606
+ \time 4/4
607
+ c4 d e f | g2\fermata r2 | a4 b c d | e1\fermata
608
+ ```
609
+
610
+ ```lilylet
611
+ \time 4/4
612
+ <c e g>2\arpeggio <d f a>\arpeggio | <e g b>1\arpeggio
613
+ ```
614
+
615
+ ---
616
+
617
+ ## Grace Notes
618
+
619
+ Use `\grace` before a note or a group:
620
+
621
+ ```lilylet
622
+ \time 4/4
623
+ \grace d16 c4 e g c | \grace { b,16 c } d4 f a d
624
+ ```
625
+
626
+ ```lilylet
627
+ \time 4/4
628
+ \grace e16 d4 f a d | \grace fs16 g4 b d g
629
+ ```
630
+
631
+ ```lilylet
632
+ \time 4/4
633
+ \grace { c16[ d e] } f4 a c f | \grace { g16[ a] } b4 d f b
634
+ ```
635
+
636
+ ---
637
+
638
+ ## Tuplets
639
+
640
+ Use `\times numerator/denominator { notes }`:
641
+
642
+ ```lilylet
643
+ \time 4/4
644
+ \times 2/3 { c4 d e } \times 2/3 { f g a } | b2 c
645
+ ```
646
+
647
+ ```lilylet
648
+ \time 4/4
649
+ c4 \times 2/3 { d8[ e f] } g4 \times 2/3 { a8[ b c] } | d1
650
+ ```
651
+
652
+ ```lilylet
653
+ \time 4/4
654
+ \times 4/5 { c8[ d e f g] } \times 4/5 { a[ b c d e] } | f1
655
+ ```
656
+
657
+ ---
658
+
659
+ ## Tremolo
660
+
661
+ ### Single-note tremolo
662
+
663
+ Use `:` followed by the tremolo division:
664
+
665
+ ```lilylet
666
+ \time 4/4
667
+ c2:16 d:16 | e1:32
668
+ ```
669
+
670
+ ### Two-note tremolo
671
+
672
+ Use `\repeat tremolo`:
673
+
674
+ ```lilylet
675
+ \time 4/4
676
+ \repeat tremolo 4 { c16 e } \repeat tremolo 4 { d f } | <c e g>1
677
+ ```
678
+
679
+ ---
680
+
681
+ ## Multiple Voices
682
+
683
+ ### Voice separator: `\\`
684
+
685
+ Use `\\` to separate voices on the same staff:
686
+
687
+ ```lilylet
688
+ \time 4/4 \stemUp c'2 d \\
689
+ \stemDown g2 a | % 1
690
+
691
+ \stemUp e'2 f \\
692
+ \stemDown b2 c | % 2
693
+ ```
694
+
695
+ ```lilylet
696
+ \time 4/4 \stemUp e'4 d c b \\
697
+ \stemDown c4 g a e | % 1
698
+
699
+ \stemUp c'2 b \\
700
+ \stemDown f2 g | % 2
701
+
702
+ \stemUp c'1 \\
703
+ \stemDown c1 | % 3
704
+ ```
705
+
706
+ ### Stem direction
707
+
708
+ | Command | Effect |
709
+ |---------|--------|
710
+ | `\stemUp` | Force stems up |
711
+ | `\stemDown` | Force stems down |
712
+
713
+ ---
714
+
715
+ ## Multiple Staves
716
+
717
+ ### Staff assignment: `\staff "N"`
718
+
719
+ ```lilylet
720
+ \time 4/4
721
+ \staff "1" \clef "treble" c'4 e g c \\
722
+ \staff "2" \clef "bass" c4 g c g | % 1
723
+
724
+ \staff "1" d'4 f a d \\
725
+ \staff "2" d4 a d a | % 2
726
+ ```
727
+
728
+ ### Part separator: `\\\` (triple backslash)
729
+
730
+ Use `\\\` to separate different staves/parts:
731
+
732
+ ```lilylet
733
+ \staff "1" \time 4/4 \clef "treble" c'4 d e f \\
734
+ \staff "2" \clef "treble" r4 g' r g \\\
735
+ \clef "bass" <c, g' c>1 ~ | % 1
736
+
737
+ \staff "1" g'1 \\
738
+ \staff "2" r4 c r c \\\
739
+ <c, g' c>1 | % 2
740
+ ```
741
+
742
+ ---
743
+
744
+ ## Advanced Features
745
+
746
+ ### Tempo markings
747
+
748
+ ```lilylet
749
+ \tempo "Allegro" 4=120
750
+ \time 4/4
751
+ c4 d e f | g a b c
752
+ ```
753
+
754
+ ```lilylet
755
+ \tempo "Andante" 4=72
756
+ \time 3/4
757
+ c4 e g | c2.
758
+ ```
759
+
760
+ ### Ottava (octave transposition)
761
+
762
+ ```lilylet
763
+ \time 4/4
764
+ c''4 d e f | \ottava #1 g a b c | b a g f | \ottava #0 e d c2
765
+ ```
766
+
767
+ ### Pedal markings
768
+
769
+ ```lilylet
770
+ \time 4/4
771
+ c4\sustainOn e g c\sustainOff | d\sustainOn fs a d\sustainOff |
772
+ ```
773
+
774
+ ### Text markup
775
+
776
+ Use `\markup "text"` to add text annotations to your score. Control placement with `^` (above) or `_` (below):
777
+
778
+ ```lilylet
779
+ \time 4/4
780
+ c'4 \markup "dolce" d e f | g a b c
781
+ ```
782
+
783
+ ```lilylet
784
+ \time 4/4
785
+ c'4^\markup "espressivo" d e f | g_\markup "cantabile" a b c
786
+ ```
787
+
788
+ Markup is useful for expressive indications, technique instructions, or any text that doesn't fit standard dynamic or tempo markings.
789
+
790
+ ### Metadata headers
791
+
792
+ Put metadata at the top of a snippet. This works well in Markdown collections (handouts, chapters, indexes).
793
+
794
+ ```lilylet
795
+ [title "Minuet in G"]
796
+ [subtitle "BWV-114"]
797
+ [composer "J.S. Bach"]
798
+
799
+ \key g \major \time 3/4 \clef "treble" \stemDown d'4(\p \stemUp g,8[ a b c] | \stemDown d4) \stemUp g, g
800
+ ```
801
+
802
+ ---
803
+
804
+ ## Complete Examples
805
+
806
+ ### Example 1: Simple Melody
807
+
808
+ ```lilylet
809
+ [title "Twinkle Twinkle"]
810
+
811
+ \time 4/4
812
+ c4 c g' g | a a g2 | f4 f e e | d d c2 | g'4 g f f | e e d2 | g4 g f f | e e d2 | c4 c g' g | a a g2 | f4 f e e | d d c2 \bar "|."
813
+ ```
814
+
815
+ ### Example 2: Piano Style with Chords
816
+
817
+ ```lilylet
818
+ [title "Simple Waltz"]
819
+
820
+ \key g \major
821
+ \time 3/4
822
+ \stemUp d'4 g b \\ \stemDown <g b>4 <g b> <g b> |
823
+ \stemUp d'4 a c' \\ \stemDown <fs a>4 <fs a> <fs a> |
824
+ \stemUp d'4 g b \\ \stemDown <g b>4 <g b> <g b> |
825
+ \stemUp d'2. \\ \stemDown <g b d'>2.
826
+ ```
827
+
828
+ ### Example 3: With Dynamics and Articulations
829
+
830
+ ```lilylet
831
+ [title "Expressive Melody"]
832
+
833
+ \time 4/4
834
+ c4\p( d e f) | g2\< a | b4\mf\> a g f | e2\p d | c4\pp( e g c) | c2.\fermata r4
835
+ ```
836
+
837
+ ### Example 4: Two-Staff Piano Score
838
+
839
+ Expressive etude in E Major with complex texture.
840
+
841
+ ```lilylet
842
+ [title "Etude in E Major (excerpt)"]
843
+ [subtitle "Tristesse"]
844
+ [composer "Chopin"]
845
+
846
+ \staff "1" \key e \major \time 2/4 \clef "treble" \stemUp b8\p \\
847
+ \staff "2" \clef "bass" g8\rest | %1
848
+
849
+ \staff "1" \clef "treble" \stemUp e8[ ds16 e] fs4~ \\
850
+ \staff "1" \clef "treble" s4 \stemDown ds~ \\
851
+ \staff "2" \stemUp \clef "bass" e,,4 b \\
852
+ \staff "2" \stemDown \clef "bass" e,,16[ b'8 b16] b,[ b'8 b16] \\
853
+ \staff "2" \stemUp \clef "bass" gs16[ b gs b] a[ b a b] | %2
854
+
855
+ \staff "1" \clef "treble" \stemUp fs16([ gs] gs[ fs)] gs4~ \\
856
+ \staff "1" \clef "treble" \stemDown ds8[ ds] e4 \\
857
+ \staff "2" \clef "bass" \stemUp b,,4 e \\
858
+ \staff "2" \clef "bass" \stemDown b,,16[ b'8 b16] e,[ b'8 b16] \\
859
+ \staff "2" \clef "bass" \stemUp a16[ b a b] gs[ b gs b] | %3
860
+
861
+ \staff "1" \clef "treble" \stemUp gs'16([ a] a[ gs)] cs8.([ b16] \\
862
+ \staff "1" \clef "treble" \stemDown gs16[ e' b e] ds[ a' b, ds] \\
863
+ \staff "2" \clef "bass" \stemDown e,,16[ b'8 b16] b,[ b'8 b16] \\
864
+ \staff "2" \clef "bass" \stemUp e,,4 b | %4
865
+
866
+ \staff "1" \clef "treble" \stemUp a'16[ gs ds e)] fs4~ \\
867
+ \staff "1" \clef "treble" \stemDown b16[ e gs, b] \stemUp <a cs>[ <b ds> <a cs> <b ds>] \\
868
+ \staff "2" \clef "bass" \stemDown e,,16[ b'8 b16] b,[ b'8 b16] \\
869
+ \staff "2" \clef "bass" \stemUp e,,4 b | %5
870
+
871
+ \staff "1" \clef "treble" \stemUp fs16([ gs] gs[ fs)] e4 \\
872
+ \staff "2" \clef "bass" \stemUp b,,4 e \\
873
+ \staff "2" \clef "bass" \stemDown b,,16[ b'8 b16] e,[ b'8 b16] \\
874
+ \staff "2" \clef "bass" \stemUp <a cs>16[ <b ds>] <a cs>[ <b ds>] gs[ b gs b] | %6
875
+
876
+ \staff "1" \clef "treble" \stemUp gs'16([ a fs gs] a[ b gs a)] \\
877
+ \staff "1" \stemDown \clef "treble" d16[ e d e] cs[ e cs e] \\
878
+ \staff "2" \clef "bass" \stemDown e,,16[ e'8 e16] a,[ e'8 e16] \\
879
+ \staff "2" \clef "bass" \stemUp e,,4 a | %7
880
+
881
+ \staff "1" \clef "treble" \stemUp cs'8 fs,4 \stemUp \grace as8( \stemUp gs16)([ fs)]~ \\
882
+ \staff "1" \clef "treble" \stemDown cs16[ e cs e] b[ e b e] \\
883
+ \staff "2" \clef "bass" \stemDown a,16[ fs'8 fs16] b,[ fs'8 fs16] \\
884
+ \staff "2" \clef "bass" \stemUp a,4 b | %8
885
+ ```
886
+
887
+ ### Example 5: Baroque Style
888
+
889
+ Complex contrapuntal writing with three independent voices.
890
+
891
+ ```lilylet
892
+ [title "Sinfonia No.1 C Major (excerpt)"]
893
+ [arranger "BWV787"]
894
+
895
+ \staff "1" \key c \major \time 4/4 \clef "treble" g'16\rest \stemUp g([ a b] \stemDown c[ d e f] g[ f g a] f[ a g f] \\
896
+ \staff "2" \clef "bass" \stemUp c,4 d8 \stemDown c'( b[ g] a[ b] | %1
897
+
898
+ \staff "1" \stemUp \clef "treble" e'2)~ e4 fs( \\
899
+ \staff "1" \clef "treble" g'16 \stemUp c,[ d e] f[ \stemDown g a b] c[ b c d] c[ e d c] \\
900
+ \staff "2" \clef "bass" \stemDown c4)( c8\rest b a[ g] a)[ d,(] | %2
901
+
902
+ \staff "1" \clef "treble" \stemUp g''8[ f] e4 d8[ e16 f] d4~ \\
903
+ \staff "1" \clef "treble" \stemDown b'8([ d]~ d[ c]~ c4 b~ \\
904
+ \staff "2" \clef "bass" \stemDown g,16)[ g'( a b] \clef "treble" \stemUp c[ d e f] g[ f g a] f[ a g f] | %3
905
+
906
+ \staff "1" \clef "treble" \stemUp d'8\f[ g16 f] e4)~ e8[ e] d4~ \\
907
+ \staff "1" \clef "treble" \stemDown b'4) g16 d'([ c b] a4.) a8( \\
908
+ \staff "2" \clef "treble" \stemUp e16)[ f( e d] \clef "bass" \stemDown c[ b a g] f[ g f e] f[ d e f] | %4
909
+ ```
910
+
911
+ ### Example 6: Modern Rhythms
912
+
913
+ ```lilylet
914
+ [title "Syncopated"]
915
+
916
+ \time 4/4
917
+ c4. d8~ d4 e | f8 g4 a8~ a4 b | c8\< d4 e8 f4 g | a\ff\> g8 f~ f4\p r
918
+ ```
919
+
920
+ ---
921
+
922
+ ## Practical Writing Tips
923
+
924
+ 1. **Put setup first**: start each snippet/section with `\time`, `\key`, `\clef` so the fragment is portable in Markdown.
925
+ 2. **Write in short lines**: one bar/phrase per line works well with Lilylet's newline pitch reset and reduces "octave drift".
926
+ 3. **Use duration persistence**: set the rhythmic unit once (e.g., `c4`) and omit repeated numbers to keep lines readable.
927
+ 4. **Add octave markers only when needed**: let relative pitch handle defaults; use `'`/`,` for intentional wide leaps.
928
+ 5. **Align voices with `s`**: in multi-voice examples, place invisible rests to lock rhythm before adding details.
929
+
930
+ ---
931
+
932
+ *This tutorial covers Lilylet's core notation features. For rarer engraving cases and deeper notation concepts, the corresponding sections of the [LilyPond documentation](https://lilypond.org/doc/) are often helpful, since Lilylet follows similar command conventions.*