# Music format

The music parser understand a language, similar to the language used by GNU Lilypond. An example will tell more than I can explain:

    \staff{
      c, g cisis' < e' g' cis'' > cis''
    }

Small music example.

Apostroph (') and comma (,) is used to tell what octave the note is in. Notenames are: `c d e f g a b`, with endings like this to get accidentals: `ceses ces cis cisis eses es eis eisis`. Rests are entered with an `r`. Notes to be stacked as a chord is inside 'less than' and 'greater than' chars: `<c e g>`

## `\relative`

The very useful `\relative` mode, like what you find in Lilypond, saves you from typing lots of commas and apostrophes. The parser will look at what octave the previous tone is, and place the note in the octave that make the interval smallest possible. See the next two examples:

    \staff\relative c'{
    \key d \time 3/4
    d a a | a2 fis8 a | d4 b b | b2
    }

Image of written using relative mode.

    \staff\relative c'{
    c e g c e g c e g
    }

Image of written using relative mode.

## Tuplets

Tuplets should work exactly like GNU Lilypond.

    \times fraction musicexpression

for example

    c4 \times 2/3 { d8 d d } e4

Tuple.

Use the `\tupletUp` and `\tupletDown` commands to force the tuplets to be placed above or below the staff. `\tupletBoth` let Solfege decide where to place the tuplets. (Unfortunately, the tuplet code is not finished yet, so for now, `\tupletBoth` give the same result as `\tupletUp`.)

## Clefs

You can set the clef with the `\clef clefname` command. The default clef is `violin` clef. The following clefs are supported:

- `violin` (also called `treble`)

- `bass`

- `subbass`

- `baritone`

- `varbaritone`

- `tenor`

- `alto`

- `mezzosoprano`

- `soprano`

- `french`

A simple example:

    \staff{
    \clef bass
    c e g <c e g c'>
    }

Clef example.

## Key signature

You use the `\key` command to set the key signature:

    \key c \major
    \key e \minor

(fes is the key with the most flats, and eis is the key with the most sharps that are allowed)

## Time signature

You use the `\time` command to set the time signature:

    \staff{
     \time 7/8 [c8 c c] d4 e
    }

## `\addvoice`

Use `\addvoice` to enter polyphonic music:

    \staff\relative c'{
    \stemup c d e f | g2 g
    }
    \addvoice\relative c'{
    \stemdown c4  b c2 e2 e
    }

addvoice example

## Ties

Tie notes together using the tilde (`~`) character. An example:

    \staff\relative c''{
    g ~ [g8 e] f4~ <g f c> ~ <g e c>
    }

Tie example.

## Skips

If you use the notename `s`, a gap will be left for the skipped time without any notes printed. An example

    \staff\relative c'{ c d e f g }
    \addvoice\relative c'{
     \stemDown
     s2 c4 s e4
    }

Tuple.

## Internal commands

The `\transpose` command is used by the program to transpose questions. Even though the program does not show any error messages if the command is used in lesson files, you should not use it. It will make random transposition stop working.