# ode

> ode is a language for writing a song as text. What it looks like, why a song is better as ode, and where to go to write your own.

ode is the language a Songcode track is written in. The current version is ode 0.3.0. A song in ode is a short text file: a plan at the top, a stem for each instrument, an arrange table that says where each stem plays, and a mix table that says how loud it is. People and programs who write ode are odists.

The [Songcode Audio Engine](https://docs.songco.de/audio-engine/) reads that text and plays it. Songcode writes ode from a prompt, and you can [write it by hand](https://docs.songco.de/ode/write-by-hand/).

## A whole song

This loop plays as it is. Paste it into the code view of the [Songcode Studio](https://docs.songco.de/app/) and press play.

```ode
ode
title "untitled"
tempo 120
key c minor
form loop 4
chords [Cm7 | Abmaj7 | Fm7 | G7]

stem drums: club {
  kick  [x... x... x... x...]
  snare [.... x... .... x...]
  hat   [..x. ..x. ..x. ..x.]
}

stem bass: fmbass {
  rhythm [x..x ..x. x... x.x.]
  tones  [root]
  octave 2
}

stem keys: epiano {
  rhythm [x... .... x... ....]
  tones  [all]
}

mix {
  drums 0db
  bass  -4db
  keys  -8db
}
```

Each line is one fact. `tempo 120` is the speed. `chords` is the progression, a bar each. A `stem` names a part and the sound that plays it. Inside a stem, a row in square brackets is music: `x` is a hit and `.` is a rest, sixteen steps to a bar. `tones [root]` plays each chord's lowest note, so the bass follows the chords without a note being written out.

## Why a song is better as ode

- **It reads like a score.** The tempo, the key, the chords and the form are on the first lines. Every part is a named stem. Anyone can see what plays, where, and how loud.
- **Every fact is written once.** What a stem plays, where it plays and how loud it is live in three places that never repeat each other, so a change is one edit.
- **It is checked.** An unknown word, a sound that does not exist or a bar that does not add up is an error with its line number. Nothing is skipped in silence, so a song that reads is a song that plays.
- **It is exact.** The same text makes the same sound every time. Chance follows a seed written in the song.
- **It runs nothing.** ode declares music. There are no loops, no conditions and no functions of your own, so opening someone's song is always safe.
- **It goes both ways.** Edit the text and the stems view follows. Move a fader, draw a note or mute a stem and the text changes. The code and the session are the same song.
- **It is small and plain.** A full song is a few kilobytes of text. It diffs, copies, versions and pastes like any other text file.
- **It is versioned.** The first line says `ode`, and can name a version, as in `ode 0.3.0`. See [versions](https://docs.songco.de/ode/versions/).

## Learn it

| page | what it covers |
|---|---|
| [Write it by hand](https://docs.songco.de/ode/write-by-hand/) | A first loop, one line at a time. Free on every account, with no key and no plan. |
| [The language](https://docs.songco.de/ode/language/) | The whole track: the first line, the plan, stems, the arrange table, blocks, the mix table, lyrics and score blocks. |
| [Rows and settings](https://docs.songco.de/ode/rows-and-settings/) | What goes inside a stem: step grids, pitch rows, lines of notes, settings, values that move, swing and feel. |
| [Sounds](https://docs.songco.de/audio-engine/sounds/) | Every sound a stem can name. |
| [Versions](https://docs.songco.de/ode/versions/) | The version of ode, the version of the Songcode Audio Engine, and which engine reads which ode. |

## Files

A song's code is saved as `.ode`. A `.songcode` file is the project: the code with everything the Studio needs to open it again. Audio and MIDI are what you [export](https://docs.songco.de/app/export/) from it.

---

This page on the web: https://docs.songco.de/ode/
Every page of the Songcode docs, for agents: https://docs.songco.de/llms.txt (index) and https://docs.songco.de/llms-full.txt (all of it in one file).
