Music Text Language
From your first notes to a finished song. MTL is a Python program that reads a text song file and renders stereo WAV audio. Enter a few notes and let it build a band, or specify each instrument, pattern, section and effect yourself.
01Run it in the browser
The runner loads the real mtl package from GitHub and executes it with Pyodide — CPython compiled to WebAssembly — together with NumPy and SciPy, the two libraries MTL uses for audio calculation.
- Open Try it and wait for the status to read Ready.
- Type a song in the editor, or pick one of the repository's examples.
- Press ▶ Render WAV (or
⌘/Ctrl + Enter) to hear it, and Download .wav to keep it.
mtl song.mtl song.wav, Check runs mtl song.mtl --check. Everything prints to the terminal panel exactly as it would on your computer.02Your first song
A song is a plain UTF-8 text file — avoid word processors that add formatting. Put this single line in it:
c d e g
Render it and you'll hear a piano with a basic drummer, a short intro, four bars of repeated melody and an ending. Rendering creates a file; it doesn't play it automatically (the online runner plays it for you).
03Writing notes
Write spaces between notes. Each entered note lasts one beat.
| You write | Meaning |
|---|---|
c | C4 — middle C. A note without an octave defaults to octave 4. |
c3 | One octave lower than middle C. Add any octave number to move up or down. |
f#4 | F sharp in octave 4. |
bb3 | B flat in octave 3. |
do re mi fa sol | Solfège names also work in compact songs. |
04Bars & tempo
A bar is a group of beats; the default is four beats per bar. At the default 120 BPM each beat lasts half a second, so the six bars of the first song (intro, four bars of melody, ending) last twelve seconds.
05Checking a song
Before rendering, inspect the program's choices:
$ mtl first_song.mtl --check
It prints tempo, length, parts and inferred defaults, and checks the song for musical problems — without producing audio.
06Install locally
Prefer your own terminal? Install Python 3.11 or newer, clone the repository and open a terminal in its folder.
# create a private environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# install MTL (downloads NumPy and SciPy)
python -m pip install -e '.[test]'
mtl --version
# render
mtl first_song.mtl first_song.wav
No account, audio device or external audio service is needed. If your terminal can't find mtl, try python -m mtl after activating the environment.
07Go further
The repository includes the full language reference, all 128 default instrument names, a progressive learning manual covering notes, patterns, presets, sound design, timelines and the guided composer, and audio you can listen to and edit.