> ## Documentation Index
> Fetch the complete documentation index at: https://pkhambat.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Notes

> The notes type: what an instrument plays, one note at a time, by name or by degree of the key.

An [instrument](https://pkhambat.mintlify.site/pitched/instruments.md)'s line holds a `notes` value when the word `notes` comes first: `bass: notes i---v---`. It is drawn on steps, and a step is a sixteenth note, so a bar of `4 over 4` is 16 steps.

```composer-nb theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/composer-nb.json"]}}
play piano: notes E4---E4---F4---G4--- | G4---F4---E4---D4---
```

## Writing notes

A note is a capital `A` to `G`, then an optional `#` or `b`, then an optional octave from 0 to 8. A note without a number is in the current [`octave`](https://pkhambat.mintlify.site/pitched/instruments#octave). Pitches are as they sound, so a guitar's low E is `E2`.

| Step | Plays |
| - | - |
| A note, a [degree](#degrees) or a [degree of a note](#counting-from-a-note) | Starts the note. It sounds until the next note or `_`. |
| `^` or `~` before a note | The note accented, or soft. |
| `-` | Nothing new. A sounding note carries on. |
| `_` | Stops the note: one step of silence. |
| `\|` | Optional bar line, checked against the `time`. |

A note is one step however many characters it has, so `F---` and `F#---` are both quarter notes. Two notes never touch: a `-`, `_`, space or `|` goes between them. A space takes no step, so `E---F# E-E--` is ten steps.

In a pattern, the last note rings over the repeat until the first note or `_`. A value written as the same figure more than once is an error, because the pattern repeats it: `C2-C2-` is `C2-`.

## Degrees

A degree is a Roman numeral from `i` to `vii` where a note goes, written as a chord's is, counted on the scale of the [`key`](https://pkhambat.mintlify.site/pitched/key) and its mode: in C major `iii` is E, and in C minor it's Eb. A `b` or `#` in front moves it a semitone off the scale. Degree `i` is the root in the current `octave`; `'` after the numeral is an octave up for each mark, and `'` before it an octave down. A numeral is as long as it reads, so `iii` is one note, and two numerals in a row take a space: `i i`.

```composer-nb theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/composer-nb.json"]}}
set octave 4

notes scale = i---ii---iii---iv---|v---vi---vii---i'---

play piano: notes scale
with mode minor { play piano: notes scale }

set key F#
play piano: notes scale
```

A name holds degrees, not pitches, so it is read under whichever key and mode play it: the second play is C minor, and the last F# major. Letters and degrees can share a line, as a chart holds `I vi|F G`. On a kit piece's line a number is a [beat](https://pkhambat.mintlify.site/drums/steps.md#beats), so `kick: 1 3` hits beats 1 and 3 and `bass: notes i iii` plays two degrees: the line's name says which.

## Counting from a note

`of` counts a degree from another note instead of from the key: `v of C3` is the 5th of C3, which is `G3`. The degree counts on the major scale of that note, in any key or mode, so `biii of C3` is `Eb3`. On the left of `of` goes a degree, with `'` marks for octaves as usual: `v' of C3` is `G4`. On the right goes a note, or a degree of the key: under `set key D`, `v of ii` is the 5th of E, the key's 2nd. Counting from the key's own `i` is the identity, so `v of i` is just `v`. `^` or `~` goes in front of the whole note: `^v of C3`.

To count from a note that is itself counted with `of`, put that note in brackets. Here is the circle of fifths, counted up from C3:

```composer-nb theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/composer-nb.json"]}}
play piano: notes C3--- v of C3--- v of (v of C3)--- v of (v of (v of C3))---
```

This plays C3, G3, D4 and A4. Without the brackets, `v of v of C3` is an error. A note counted with `of` is still one note, so `-`, `_` and lengths work on it the same way.

## Lengths

Commas split a line into parts. A [length](https://pkhambat.mintlify.site/language/overview.md#lengths) in front of one note holds it for that long, and in front of `rest` is silence. The length `...` is what is left of the block: `...G1` holds G1 to the end, and `...rest` is silence to the end. A line ended in `...` has no length of its own, so the other lines decide how long the block is.

```composer-nb theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/composer-nb.json"]}}
set time 3 over 4

pattern waltz = {
  bass: notes 3 beats C2, 3 beats G1
  piano: chords _ C C|_ G G
}

play waltz for 2 bars
play piano: notes 2 beats rest, E4---F4---, 1 bars G4
```

A length holds one note: `3 beats C2-E2-` is an error, since a figure is drawn on the steps. A long line continues on the next line when that line starts with `|`, and a length can follow the `|` as it follows a comma.

```composer-nb theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/composer-nb.json"]}}
notes flats = A3-Ab3-G3-Gb3-F3-E3-Eb3-D3-
  |Db3-C3-B2-Bb2-A2---, 1 beats rest

play piano: notes flats
```

## Layers

A line plays one note at a time. For notes that sound together, give the instrument a block of layers, one per line. Each layer is its own voice and repeats until they all end together. A layer can be a chart with `chords` in front, to put chords under a tune.

```composer-nb theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/composer-nb.json"]}}
set octave 4

play piano: {
  chords vi iv|i v
  notes vi-------iv-------|vi---v---iv---iii---
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.