Lily# Learn — twelve short lessons, in the editor

Lesson 4 of 12

Keys and accidentals

In VS Code, in an empty .lys file: type lesson, press Ctrl+Space and pick lesson-04-keys.

Sharp = is, flat = es: fis = F#, bes = Bb. Write what sounds: in G major, F# is still fis. The key only prints it. transpose prints the same music in another key — pick low at the top of the preview.

Keys and accidentals — engraved

The lesson as it opens: the red rings mark where a step happens.

Keys and accidentals — engraved

The score low.

Try

Do what the red circle says · change the key to g mixolydian: the sharps move into the music · change bes, to a,.

The whole lesson

// Lesson 4 of 12 — Keys and accidentals
// Preview: Ctrl+K V
//
// Sharp = `is`, flat = `es`: fis = F#, bes = Bb.
// Write what sounds: in G major, F# is still `fis`. The key only prints it.
// `transpose` prints the same music in another key — pick `low` at the top of the preview.

title "Minuet in G"
composer "Christian Petzold"

time 3/4
key g major

part melody {
  clef treble
  section A {
    d'4 g,8 a b c | d4 g, g | e'4 c8 d e fis | g4 g, g |
    c4 d8 c b a | b4 c8 b a g | f4@todo("make it fis") g8 a b g | a2. |
    d4 g,8 a b c | d4 g, g | e'4 c8 d e fis | g4 g, g |
    c4 d8 c b a | b4 c8 b a g | a4 b8 a g fis | g2. |.
  }
}

form { ~A }

score { staff melody }

score low transpose bes, { staff melody }   // one step down: F major

// TRY: do what the red circle says · change the key to `g mixolydian`:
// the sharps move into the music · change `bes,` to `a,`.
//
// NEXT — type `lesson` on a new line and pick `lesson-05-expression`.

In the manual