Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

claudius

claudius makes music the way a producer does in a DAW. It picks sounds, writes drum patterns, bass lines, chords and melodies with music theory, arranges them into a song with an intro, builds and drops, mixes and masters it, listens to the result, and changes what it does not like.

Every sound is real audio. There is no neural audio generation and no General MIDI: drums and synths are synthesized in code, and the rest comes from recordings (a grand piano, a Rhodes, string sections, real TR-808 and TR-909 drum machines, Apple Loops if you have GarageBand, or your own files). Notes exist only as the score that plays those sounds, like a piano roll.

After every change claudius judges the song: is it loud enough and clean at the top, does the drop hit harder than the breakdown, are the bass notes on the chords, does it sound like the genre it claims to be? Each problem comes with what to change.

Four ways to use it

  • The studio. An app with an arrangement view, step sequencer, mixer, harmony editor and script editor. It runs as a native window and in the browser. See the studio.
  • Scripts. A small language in which a song is a few lines of code: track("drums", s("bd*4, [~ cp]*2")). Any song claudius makes can be printed as a script. See the language reference.
  • An assistant. Connect Claude, ChatGPT or Cursor and ask for a song; it composes, listens, and revises while you hear every change in the studio. See working with an assistant.
  • The command line. claudius make --genre lofi writes a finished song to a folder. See command line.

Where to start

Install

The Mac app

Download Claudius for your Mac from the website, or the disk image from the latest release: claudius-<version>-aarch64-apple-darwin.dmg for Apple silicon, claudius-<version>-x86_64-apple-darwin.dmg for Intel (the Apple menu, About This Mac, says which you have). Open it, and drag Claudius onto Applications, as the window shows. It runs on macOS 11 or later, and opening it opens the studio.

The app is signed with claudius’ Developer ID and notarized by Apple (every release since 0.8.0), so macOS opens it as it opens any app. In Terminal, curl -fsSL https://github.com/devlato/claudius/releases/latest/download/install.sh | sh installs the same app (the command line).

The first time the studio starts, it downloads its listening models by itself and offers to download the sample packs (below). To connect Claude, Cursor or Codex, use ?, Connect an assistant in the studio. Move the app into Applications first: an app opened from its disk image, or from Downloads, runs from a copy macOS takes away again, and claudius will not connect an assistant to it. The app holds the command-line programs too. To use them in a terminal, link them into ~/.local/bin (the Terminal command does this for you):

mkdir -p ~/.local/bin
ln -s /Applications/Claudius.app/Contents/MacOS/Claudius ~/.local/bin/claudius
ln -s /Applications/Claudius.app/Contents/MacOS/claudius-packs ~/.local/bin/claudius-packs

Linux packages

Every release has packages for x86_64 and ARM64 Linux with glibc 2.38 or newer (Ubuntu 24.04, Debian 13, Fedora 39 and later). Each puts the programs in /usr/bin, the web studio in /usr/share/claudius/web, and Claudius in your desktop’s app menu, which opens the studio. Your file manager then opens a .claudius project with Claudius, and shows one that carries a cover by its cover (claudius thumbnail). Download the one for your system from the latest release:

sudo apt install ./claudius-<version>-x86_64-unknown-linux-gnu.deb    # Debian, Ubuntu
sudo dnf install ./claudius-<version>-x86_64-unknown-linux-gnu.rpm    # Fedora and its relatives

or the AppImage, which needs no installing: make it executable (chmod +x claudius-*.AppImage), then open it to start the studio, or run it with a command, ./claudius-<version>-x86_64-unknown-linux-gnu.AppImage make --genre lofi. It needs FUSE to run, as every AppImage does, and ALSA for the studio’s sound.

The command line: macOS and Linux

curl -fsSL https://github.com/devlato/claudius/releases/latest/download/install.sh | sh

The script comes with every release, next to the archives, and is in the release’s checksums. It downloads the latest release for your computer from GitHub, checks it against the published SHA-256 sums, and installs it. On Linux that is under ~/.local: the programs claudius and claudius-packs in ~/.local/bin, and the web studio in ~/.local/share/claudius/web. On a Mac it is the app, in /Applications (or ~/Applications when you cannot write to /Applications), with ~/.local/bin/claudius and claudius-packs as links into it; --no-app installs the programs and the web studio under ~/.local instead, as on Linux. It tells you if ~/.local/bin is not on your PATH yet.

When you run it in a terminal, it offers to download the sounds and the ears straight away (below). To do that without being asked, pass --yes:

curl -fsSL https://github.com/devlato/claudius/releases/latest/download/install.sh | sh -s -- --yes

Run as root, it installs the programs and leaves the downloads for later: the packs are archives from other sites, so run claudius setup as the user who makes the music.

CLAUDIUS_INSTALL_DIR puts the programs in another folder (the web studio goes next to it, in ../share/claudius/web), CLAUDIUS_APP_DIR puts the Mac app in another folder, and CLAUDIUS_VERSION=0.1.0 installs a specific release.

Windows

Windows is a preview: its build has no ears yet, so verdicts use meters and music theory.

Download claudius-<version>-x86_64-pc-windows-msvc.msi from the latest release and run it. It needs no administrator: it installs claudius for you in %LOCALAPPDATA%\Programs\claudius, adds its programs to your PATH, and puts Claudius in the Start menu, which opens the studio. The installer is not signed yet, so SmartScreen may say Windows protected your PC: click More info, then Run anyway. Settings, Apps, removes it again.

Or install the programs only, in PowerShell:

irm https://github.com/devlato/claudius/releases/latest/download/install.ps1 | iex

The sounds and the ears

The programs are small. The sounds and the listening models are downloaded once, when you agree to it:

claudius setup
whatsizewhere
22 sample packs: pianos, electric pianos, strings, brass, woodwinds, mallets, basses, guitars, voice, real drum machines, electronic one-shots, effects3.2 GB to download, 1.6 GB on disk~/Library/Application Support/claudius/packs on macOS, ~/.local/share/claudius/packs on Linux
earshot’s listening models (CLAP)about 0.8 GB~/.cache/earshot-rs
Spleeter’s nets, which separate a recording’s vocals, drums, bass and the rest for a remakeabout 160 MB~/.cache/earshot-rs

The studio offers the same download of the packs when they are missing, and downloads the models by itself the first time it starts. Each model file is checked against a pinned SHA-256 hash. Without the packs, claudius synthesizes every sound; without the models, the verdict uses meters and music theory only. claudius setup --help lists the options, and claudius-packs list shows every pack with its licence.

claudius uses Apple Loops automatically when GarageBand or Logic content is installed. ffmpeg is optional: it reads the few audio formats claudius cannot read itself, and on Windows and Linux it writes AAC and Apple Lossless when you export them.

Check the installation

claudius doctor
claudius 0.1.0 (macos aarch64)
  ok  web studio      ~/.local/share/claudius/web
  ok  sample packs    22 default packs (1.6 GB) in ~/Library/Application Support/claudius/packs
  ok  ears            models in ~/.cache/earshot-rs
  ok  Apple Loops     14096 loops and samples
  ok  ffmpeg          9.0.2 (reads the formats claudius cannot)
  ok  port 7878       free
  ..  Claude Desktop  not connected: `claudius connect claude-desktop`
  ..  statistics      off (`claudius telemetry` explains them)

Everything claudius needs is here.

From source

You need Rust (the version in rust-toolchain.toml; rustup picks it up) and, for the web studio, trunk.

git clone https://github.com/devlato/claudius
cd claudius
cargo install --locked --path crates/claudius-cli
cargo install --locked --path crates/claudius-packs
cargo xtask web          # builds the web studio into crates/claudius-ui/dist
claudius setup

A claudius built from a checkout finds the web studio in that checkout. The development setup covers everything else.

Uninstall

The Mac app: drag Claudius from Applications to the Bin, and delete the links in ~/.local/bin (rm ~/.local/bin/claudius ~/.local/bin/claudius-packs). The command-line install:

rm ~/.local/bin/claudius ~/.local/bin/claudius-packs
rm -r ~/.local/share/claudius/web

The sample packs, the models and the caches are kept, so that reinstalling does not download them again. To remove them too, delete the packs folder claudius doctor shows (~/Library/Application Support/claudius/packs on macOS, ~/.local/share/claudius/packs on Linux), ~/.cache/earshot-rs, and ~/Library/Caches/claudius (~/.cache/claudius on Linux). Songs you saved stay in ~/Music/claudius.

Your first song

This page takes you from a fresh install to a song you made and changed yourself, in about ten minutes. It assumes you have followed Install and have the claudius command.

Check the installation

claudius doctor
claudius 0.1.0 (macos aarch64)
  ok  web studio      ~/.local/share/claudius/web
  ok  sample packs    22 default packs (1.6 GB) in ~/Library/Application Support/claudius/packs
  ok  ears            models in ~/.cache/earshot-rs
  ok  Apple Loops     14096 loops and samples
  ok  ffmpeg          9.0.2 (reads the formats claudius cannot)
  ok  port 7878       free
  ..  Claude Desktop  not connected: `claudius connect claude-desktop`
  ..  Cursor          not connected: `claudius connect cursor`
  ..  statistics      off (`claudius telemetry` explains them)

Everything claudius needs is here.

Two things matter for this page: the sample packs (recorded instruments and drum machines) and the ears (the listening models the critic uses). If either is missing, claudius setup downloads them: about 3.2 GB of packs (1.6 GB once unpacked) and 1.1 GB of models, once. Apple Loops are optional (claudius uses them when GarageBand or Logic content is installed), and so is ffmpeg, which reads the few audio formats claudius cannot read itself.

Make a song

claudius make --genre house --seed 9

claudius composes a song in the style, arranges it, renders it with real sounds, mixes and masters it, and judges the result. On this machine it printed:

ears loaded in 3.5 s
Crimson Tide — house at 124 BPM in G dorian, 72 bars (2:19)
  progression A: i7 IV9 i7 VIImaj7 i7 IV9 i7 V7
  progression B: i7 ii7 i7 VIImaj7
  form: intro 8 | groove 32 | break 8 | drop 16 | outro 8
  tracks: kick (sampled bd (tr909:bd)), clap (sampled cp (tr909:cp)), hat (sampled hh (tr707:hh)), ohat (sampled oh (tr909:oh)), shaker (shaker cut from 'Cosmic Harmony Shaker' (Apple Loops)), perc (sampled rim (tr909:rim)), bass (synth patch 'saw_bass'), chords (sampled fm_piano (freepats:fm_piano)), pad (sampled strings (vsco2:strings)), lead (synth patch 'brass_lead'), arp (synth patch 'bell'), crash (synth crash), riser (synth riser), impact (synth impact), downlifter (synth downlifter), reverse_crash (synth reverse_crash)
  master: -10.0 LUFS, true peak -1.0 dBTP (pre-master -9.4 LUFS); done in 7.9 s
  ears: 'house music' z +3.4 (closest confusion 'techno music' +3.7); production z +2.0 vs 'a distorted clipped recording' +2.1; p_real 0.66
        sounds like: techno music, house music, tech house music, drum and bass music
  verdict: 82/100 (arc 0.88, genre 0.67, mix 0.92, production 0.47, theory 1.00). Fix first: nearly mono (correlation 0.96): widen pads, chords and effects; sounds about as much like a clipped recording as a professional mix: less drive and saturation, or a quieter master; sounds more like 'techno music' than 'house music'
  wrote out/house-crimson-tide-9/song.mp3

The same genre and seed give the same song on any machine. What is installed changes only which recordings play: without Apple Loops, the shaker cut from them is synthesized; without the sample packs, synthesized drums and one-shots cut from Apple Loops stand in for the drum machines, and the chords and pad play synths instead of the FM piano and the strings. The notes and drum patterns stay the same. Leave out --seed and you get a new song each time.

Open out/house-crimson-tide-9/song.mp3 and listen. Reading the summary while it plays:

  • Crimson Tide: the title the generator chose, the style, tempo, key and length.
  • progression: the chord sequences, as Roman numerals (what those are).
  • form: the sections and their lengths in bars. The drop is the loud part after the break. Every song of a genre plays its own form: another seed may start without an intro, add a bridge or play its last drop twice.
  • tracks: every part and the sound playing it: a real Roland TR-909 for most of the drums and a TR-707 for the hats, a sampled FM piano for the chords and a string section for the pad, synthesizers for bass, lead and arpeggio, and the transition effects at the end.
  • master: how loud the finished song is, in LUFS (the loudness measure streaming services use), and its highest peak. claudius masters a song to the loudness its style usually has.
  • ears and sounds like: what the listening models hear. The first reading is how clearly the song sounds like house next to the style it is most often taken for, here techno (2.5 is a plausible reading, 3 a strong one); the second compares “professionally mixed” with the closest of six typical flaws. p_real is the models’ guess that this is a real recording, reported and not scored. These are a machine’s impressions: hints, not rules.
  • verdict: the critic’s score out of 100, and the issues that cost the most, each with where it usually comes from. This song is nearly mono, sounds about as much like a clipped recording as a professional mix, and a little more like techno than house. Listening, judging, finishing explains every part of it.

The folder holds the song (song.mp3, and song.wav in 24-bit), the song’s full description (blueprint.json) and the same song as a script (song.rhai), the arranged timeline (project.json), the critic’s report (verdict.json), a summary of the render with every track’s loudness (report.json) and credits for the recorded instruments whose licences ask for them (credits.txt).

Change it

A script can edit a saved song. Make a file called edit.rhai:

tempo(122);
part("chords", #{ preset: "piano" });
mix("lead", #{ level: -2, reverb: 0.35 });
section("drop", #{ bars: 32 });

It slows the song down a little, plays the chords on a sampled grand piano instead of the FM piano, pulls the lead back and into more reverb, and makes the drop 32 bars long. Run it on the song:

claudius script edit.rhai --on out/house-crimson-tide-9
ears loaded in 3.4 s
Crimson Tide — house at 122 BPM in G dorian, 88 bars (2:53)
  progression A: i7 IV9 i7 VIImaj7 i7 IV9 i7 V7
  progression B: i7 ii7 i7 VIImaj7
  form: intro 8 | groove 32 | break 8 | drop 32 | outro 8
  tracks: kick (sampled bd (tr909:bd)), clap (sampled cp (tr909:cp)), hat (sampled hh (tr707:hh)), ohat (sampled oh (tr909:oh)), shaker (shaker cut from 'Cosmic Harmony Shaker' (Apple Loops)), perc (sampled rim (tr909:rim)), bass (synth patch 'saw_bass'), chords (sampled piano (salamander:piano)), pad (sampled strings (vsco2:strings)), lead (synth patch 'brass_lead'), arp (synth patch 'bell'), crash (synth crash), riser (synth riser), impact (synth impact), downlifter (synth downlifter), reverse_crash (synth reverse_crash)
  master: -10.0 LUFS, true peak -1.0 dBTP (pre-master -9.3 LUFS); done in 8.1 s
  ears: 'house music' z +3.0 (closest confusion 'techno music' +3.4); production z +1.9 vs 'a distorted clipped recording' +2.1; p_real 0.73
        sounds like: techno music, house music, tech house music, drum and bass music
  verdict: 83/100 (arc 0.88, genre 0.56, mix 1.00, production 0.46, theory 1.00). Fix first: sounds about as much like a clipped recording as a professional mix: less drive and saturation, or a quieter master; sounds more like 'techno music' than 'house music'
  wrote out/house-crimson-tide-9/song.mp3

Everything you did not name stayed as it was. The chords are now sampled piano, the song is 88 bars, and the score moved a point: the grand piano is recorded in stereo, so the mix is no longer nearly mono. The critic is a guide, and your ears decide whether the piano is better.

The edited song is written back into the same folder, because its genre, title and seed are the same, so the original files are replaced. To keep both, add title("Crimson Tide (piano)") to the script, or pass --out another-folder.

Read the song as a script

Every song can be written as a script that describes it completely enough to edit, and the folder already has one: song.rhai. An empty script changes nothing, so this prints the same script for any song:

echo "" | claudius script - --on out/house-crimson-tide-9 --print

out/house-crimson-tide-9/song.rhai starts like this:

// Crimson Tide — house (seed 9)
// song("house", 9);   // uncomment to start over from the generator
title("Crimson Tide"); tempo(122); key("G dorian"); swing(0.5257842);
humanize(0.25);
prog("A", "i7 IV9 i7 VIImaj7 i7 IV9 i7 V7");
prog("B", "i7 ii7 i7 VIImaj7");
bars_per_chord(1);
master(#{ lufs: -10, ceiling: -1 });

// drums: X accent, x hit, o ghost, . rest, | bar line; 16 steps per bar unless a number follows
drum("kick", "main", "X...X...X...X...");
drum("kick", "sparse", "X...X...X...X...");
drum_sound("kick", "tr909:bd");

and goes on with every drum lane and the sound it plays, every part, the form and the mix. Copy any line into your edit.rhai, change it, and run the script again. Songs as scripts explains the format.

Make a beat from nothing

blank() starts an empty song instead of a generated one. Save this as beat.rhai:

blank("house");
tempo(124); key("A minor");
prog("A", "Am7 Fmaj7 Dm7 Em7"); bars_per_chord(1);
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4"));
track("bass",  chord("prog").root().struct("~ x ~ x ~ x ~ [x x]").s("organ_bass").legato(0.7));
track("keys",  chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").room(0.25));
form([sec("intro", 8, "drums keys").filter_in(), sec("drop", 16, "*").impact()]);

and render it with claudius script beat.rhai. You hear eight bars of drums with electric piano chords coming into focus as a filter opens on them, then a crash and sixteen bars with an organ bass bouncing between the kicks on the root of each chord. Each line is one idea: the style, the tempo and key, the chords, three tracks, and two sections.

Where to go from here

  • Never made music before? How a track is built starts a short course that ends with a song you understand, line by line.
  • Already make music? claudius for DAW users maps what you know onto claudius.
  • The studio is the same engine in a window: an arrangement view, a step sequencer, a mixer and the verdict updating as you edit.
  • Working with an assistant: claudius connect claude-desktop (or claude-code, cursor) lets an assistant make and edit songs while you listen.
  • The cookbook has complete songs in eight styles.

The studio

claudius studio

opens the studio in its own window. claudius serve runs the same studio in your browser at http://127.0.0.1:7878. Both are views of one session: you can have the window, a browser tab and an assistant working on the same song at once, and each sees the others’ changes as they happen.

Every change is rendered and judged in the background. The right end of the toolbar says what claudius is doing (Rendering, with how far it has got, and Cancel for a job that can stop), or whether what plays is the song as it is now: Up to date, or Changes not rendered yet with a Render button. The score badge updates when the new verdict arrives, a few seconds later.

The first time

The first time it opens, a short tour points at the parts of the studio in five cards: making a song, listening, the verdict, the editors, and connecting an assistant, with the Connect buttons right in the last card. The app then asks once whether to send anonymous usage statistics, which stay off unless you say yes (what they are). The tour never blocks the studio. Skip the tour or Esc ends it for good, and ? in the bottom right corner, Take the tour, starts it again.

The first time it starts, claudius downloads its listening models (about 0.9 GB) in the background; the verdict judges with meters and music theory until they are ready, and the log says when they are. The first time it remakes or samples a recording, it downloads the nets that separate a recording’s vocals, drums and bass (about 160 MB). If the default sample packs are not installed, the studio says so and offers Download the packs (a 3.2 GB download): until then, the sampled instruments are synthesized. Packs installed before claudius gained instruments in them (a later claudius adds some) lack those instruments, and the studio offers Download the instruments, which fetches only them. The Sounds tab lists every pack, with a button for each one that is not installed, or lacks instruments.

Starting a song

New song starts a song From a genre, From a recording, From the microphone or From an example: one of the example songs, each in the style of a decade’s hits or a classic remade, whose script says how its style is made (hover a card for its notes, then Open it). From a genre, it asks for the genre, from cards you can search (“rap”, “90s”, “west coast”), and in your own words too (“something to study to”, “jamaican vibes”): past what the words find, the genres near what they mean come under near what you mean, once the small model that reads meaning is on your computer, as for the command palette. Under More options, which says what of it is set, it asks for a seed, tempo and key and the rest below. The same genre and seed always give the same song, so a seed is a way to come back to one you liked. Fused with fuses other genres into it, as many as you like (a click on one takes it out): the first leads the song, the last fused plays the drums (Drums from chooses which, once there are two), and each lends its sounds (Fusions). Samples, auto-sample from free libraries, builds the song on recordings from free libraries, as records built on samples are: a phrase it takes its key, tempo and chords from, a drum break, a texture. It starts ticked for the genres built on samples (trip-hop, boom bap, lo-fi, jungle, big beat, filter house), and for any other genre you tick it. Its field takes the kind of record to search the phrase for (“70s soul”, “bossa nova guitar”); empty, it shows the records the genre’s producers dig for, and the song picks among them, and the dice puts one of them in the field (Songs built on samples). Layers says how layered the song is, from the genre’s core to its harmony and lead doubled on second instruments, a counter-melody, a pad and more percussion; ticked, it is as the genre writes it (How layered a song is). From the microphone records up to a minute of what you sing, hum, play or beatbox: Record, then Stop, and it goes on as a recording chosen does, with the same choices below (in a browser, allow the page to use the microphone when it asks). From a recording: Choose a file, then what to do with it, and the button under the choices does it. Remake it as the genre (chosen beside it, with any fused with it under Fused with) reworks it so that it stays the song it is: all of it plays through, its voice and its chords as they are without its drums and its bass, in its own sections and on its chords, with the genre’s drums and bass under it. Flip it into a song of the genre makes a new one on its sound instead: its hook and passage after passage of it, each section on as many of its bars on end as it has, its voice in them, its drums and a flip cut from all over it, at a tempo the genre plays. Rebuild it on the genre’s sounds makes the song itself again with every note yours to change: its drums, its bass and the rest as the hits and notes it plays, in its own sections, its voice kept on a track of its own (Rebuild it). Sample its vocals into the song puts its best sung phrases into the song that is open (Sampling a song’s vocals), Put the song’s drums in its groove puts the open song’s drum lanes in the feel of the recording’s drums (Grooves), and See what is in it, as it plays opens a window of what claudius hears in it and changes nothing. A choice that needs an open song, or one with drums, says so. While claudius works on the file, the dialog says what it is doing (taking it apart into its voice, drums, bass and the rest, listening to it, sampling its voice, remaking it), with how far it has got when it knows, and so does the line at the top right. What changed the song closes the dialog when it is done: the song shows with its new tracks (vox1, vox2 … for sampled phrases), the toast says what came of it in a line (“sampled 2 phrases of song.mp3 into the song: vox1, vox2”), the render it starts is on the line at the top, and the dialog keeps the whole answer for when you open it again, as the Log tab does. A file claudius could not use leaves the dialog open with the answer in it. Cancel, or closing the dialog, while it remakes, flips or rebuilds a recording stops it after the step under way, and the song stays as it was.

What claudius hears in a recording, the window See what is in it opens, shows its tempo (and whether it keeps one, or moves with the band), its key and how sure claudius is of it, its feel (straight or swung), its length and its loudness. Under them is its form: each section a block as long as it plays, in its kind’s colour, brighter the more energy it has, with the chord of each bar under it as long as the chord lasts. Play plays the recording, and the playhead goes through the form, the section and the chord playing are written large above it, and the chord after it beside them; a press or a drag on the form plays from there. With the ears, Voice, Drums, Bass and The rest play the parts claudius took it apart into alone, so that you hear what it heard in each, and All of it plays it whole again; the song pauses while the recording plays. Its beat is how often its kick, snare and hats strike each sixteenth of a bar, Its bass how its bass plays, and Its chords its progressions in its key. Make a song like it makes a new song in the genre beside it on its tempo, key, chords, form and swing, and none of its sound; Its tempo gives the open song its tempo, and Its key and chords its key and progressions; Copy it as text copies what claudius heard in words, for a note or an assistant. claudius keeps the recording, and its parts, to play until it listens to another. The demo plays the file you chose, as it is, without its parts. Open opens a song you saved: choose the blueprint.json in its folder, or a .rhai script. The studio reads the file on its own computer, in a browser too, and nothing of it is kept but the song it opens. It also opens a project the demo saved, a .claudius file (or the .zip an earlier demo saved): claudius unpacks it into a song folder of its own (Carrying on in claudius).

The panels

A song has three views, three ways of seeing and changing the same song: Arrangement, Signal flow and Script. The switcher over it shows one at a time (7 and 8 open the script and the signal flow, G the signal flow too; the same key again, or Escape, comes back to the arrangement).

  • Arrangement. The sections of the song from left to right (intro, build, drop and so on), each with its length and a meter of how intense it is, and below them one row per track, with an icon for what it is (drums, keys, a bass, a pad, a line, a voice, a sample, an effect) or that it is muted or soloed. A dot at the end of a track’s name says the critic has something to say of it (its level, its part or its sound), in the colour of the worst of it: hover the name to read it, as the Verdict panel words it, with the fix. A track plays where it has a clip, one for each run of sections it plays in, shaded by how intense each is; a drum lane’s shows how busy each bar is. Click a cell to select it, its track and its section: the right panel shows the section and, under it, the track (its sound and another, whether it plays in the section, mute, solo, level, pan, and where it is edited). Double-click a cell, or press Enter, to switch the track on or off there; Delete switches it off. With the Paint tool (beside Select, over the arrangement, or B), a click switches a cell and dragging along a row paints the rest the same. Drag a section to move it; right-click it to duplicate it, split it at the bar you clicked, insert one after it or remove it (the inspector’s Split halves the section you have selected). A split section plays on as it played: the second part takes each recording from where the section had reached it, and keeps the build-up. + Add a track, under the tracks (or Add a track… in the command palette), opens Add a track, a card for each kind of track: one written the way a genre plays it (In a style), a part (A part: a bass, chords, a pad, keys, a lead or an arpeggio the theory engine writes over the song’s chords, written the way the genre writes that role) or a drum lane to fill in under Drums (A drum lane), its name, and its sound, from the synths made for the role, the installed instruments, or the drum voices and kits (searched by name and by what you mean: “warm and round” finds sounds no word of which says so, under near what you mean, as the styles and the script’s sounds do too); a new track plays in the sections with energy 0.6 or more, ready for you to move. Its A recording card adds a song or a sound instead: Choose a file on this computer…, a search of the free libraries to hear and choose from, or Record one…, each in the window it goes in by (Add a recording, or Record), to add it whole as a take or sample its vocals. Its Sampled card finds one for you: choose A break, A phrase, A texture, A voice or A stab, and Find one searches the free libraries with the words the song’s genre’s producers dig with for that part (or yours, typed), and opens Add a recording on the first recording found, the way to sample it chosen (a break among its pieces, a phrase played through as a passage, a texture whole, a voice through the song, or its phrases in a browser, a stab struck as a drum), to hear before its button puts it in. Right-click a row to mute or solo it, swap its sound, switch it on or off everywhere, or remove it (Undo brings it back). A part’s row also offers Add chords under it: chords that fit its melody and the song’s chords, a chord on each of its notes, a pad under it, stabs or offbeats, as a new part that follows the melody as it changes. Right-click a take’s row to hear how it is sung (How is it sung?), to tune it (Tune it: naturally, tightly, hard, or not at all), to turn a beat you played or beatboxed into the song’s drum lanes (Turn it into drums), or to turn the melody you sang into notes an instrument plays, as you sang it or as harmony, octaves, chords, a bass line, an arpeggio or a pad. The waveform of the latest render is underneath; click it to jump.
  • Section. The selected section’s length, its intensity (how full and loud it plays), which chord progression it plays, its drum pattern, its transitions (a filter sweep, a build-up, a pause at the end, an impact, drum fills), and a switch for each track playing in it. A build-up has a row of its own: how it builds (everything, a drum roll, a filter sweep, a riser, or the drums dropping out) and how hard, from gentle to hard (what each plays).
  • Verdict. The score and its parts (Mix, Shape, Harmony, and with the ears Genre, Production and Records), the things to fix, each with how much it costs and where to fix it, and, folded under What it measured, what earshot hears and the meters. A thing one change fixes has a Quick fix button (below).

Under the arrangement, the tabs hold the editors: Drums, Instruments, Notes, Chords, Mixer and Sounds, and at the right end Log.

  • Drums. A step sequencer for every drum track. Click a step to toggle it, drag to paint, shift-drag to set how hard a hit is. Right-click a step and open Trig to set the chance it plays, when it plays (1:2, last …), a ratchet of strokes inside it and how they swell or fade, a flam, a nudge off the grid, and its pitch, decay, tone and pan for that stroke (The drum machine). A step with a trig shows it: its chance as a number, its condition, a ratchet’s strokes, a dot for a flam, a diamond for the sound it changes, and a nudged step sits off the grid. Right-click a lane for its own time and feel: a length of its own (steps past it are faint, showing the steps that come round again there), its speed, a swing of its own or the song’s, and a groove and how much of it. The lane’s name shows what it has.
  • Instruments. The bass, chords, pad, lead and arpeggio parts: their writing style, their sound (a synth or a sampled instrument, with the swap button beside it), their range and how busy they are. Reseed rewrites a part.
  • Notes. A part’s notes over one of its progressions, as a piano roll: a grid of beats and pitches. The part, the progression and the grid are chosen at the top. Click an empty place to add a note, drag a note to move it, drag its right edge to make it longer or shorter, right-click it to take it out; the grid (1/16 to 1/2) is what notes snap to. The notes the theory engine writes are shown faint, and the first change writes them out for you to edit; Back to the theory engine lets it write them again. The notes come round every time the part plays that progression.
  • Chords. The chord progressions, as chords in the song’s key and as numerals, and which sections play which.
  • Mixer. Level, pan, reverb, delay, how much each track ducks under the kick, and its drive, which overloads it (rougher at the same loudness); mute and solo; meters from the last render; the master’s loudness and true peak.
  • Sounds. The sample packs, with a button for each one that is not installed, and every sound a part or a script can play: the sampled instruments by pack, the synths and the drum voices. Click an instrument or a synth to put it on one of the song’s parts.
  • Log. What happened, and the song’s history.

The switcher over the arrangement opens the song’s other two views in its place:

  • Signal flow (8 or G). The song as its sound flows, drawn as its lanes, the way a mixer’s channel strips and device chains are. Each track is a lane, in the arrangement’s order and colours, read left to right: its source (the instrument, kit or recording it plays), each of its effects as a block that shows what it does (an equalizer’s or a filter’s curve, a compressor’s or a limiter’s curve with its threshold, saturation’s shape, a delay’s repeats, a reverb’s tail), its level and pan to drag with its meter, its sends into the reverb and delay returns, and the bus its sound goes into. The buses, the returns and the master are lanes of the same kind under the tracks, the master’s with its loudness and ceiling to drag, ending in the finished song. Pinch, or scroll with Ctrl or Cmd held, to zoom around the pointer; scroll or drag the background to move about; Fit shows all of it. Click a block to change its settings in the inspector beside the lanes (numbers to drag, switches, modes, and everything else as the JSON the song keeps it as), drag it along its chain or into another lane’s, switch it off and on again with its power button (it keeps its settings, so you can hear the track with and without it), take it out with ×, or add one with the + between two blocks. Click a lane’s name to change everything about it in the inspector beside the lanes (duck, drive, bus, the sections it plays in, its sound), and right-click anything for what can be done to it. With the lanes focused, the arrows choose a block and open it in the inspector, Delete takes it out, B switches it off or on, F fits and + and − zoom. Every change undoes. The arranger’s own filter moves, width and saturation are added at render and are not in the lanes.
  • Script (7). The whole song as a script, beside the inspector and the verdict. Edit it and press Cmd+Enter (Ctrl+Enter on Windows and Linux) to run it. The sound browser lists every drum, synth and instrument name. At the end of each line, faint words say what its numbers set (“118 BPM · swing 56%”, “16 bars”, “-4 dB”, “4.5 kHz”), and pointing at a number says it too (Hints hides them). With the cursor on a number, Alt+↑ and Alt+↓ change it by its last digit (1 for 118, 0.01 for 0.56; with Shift, ten times as much), and the script runs by itself a moment after the keys rest, so that you hear the change as you would turning a knob.

Variations tries a few versions of the song, with a change or two each, and keeps the best one if it beats the current song (how many is in its menu); Improve runs rounds of that, each from the best version so far. Both run in the background and can be stopped, and in the demo too, where its engine judges the variations one after another without the ears, so they take a while longer.

Changing the genre

The genre under the song’s title, or Change the genre… at the foot of Variations, opens Change the genre: choose a genre, and under Fused with any others to fuse with it (a fused song opens with its own), and Play it as … plays the same song in it. The song stays: its form (each section’s name, length, intensity and transitions), its chords and key, its lead’s melody note for note, the recordings it plays (takes, sampled phrases, loops), the notes written on its parts, and the tracks a script wrote. The genre plays it: its drums, bass, chords, pads and the rest, their sounds, its swing and its mix, each section by the genre’s tracks of the kinds that played there (a kick where a kick played, whatever its lane was called, and the bass where the bass did), and the genre’s own kinds the song had none of where a section is intense enough for them. The tempo stays when recordings play in the song, since they keep time with it; otherwise it moves to the nearest of the song’s, its half and its double that the genre plays (118 BPM house as lofi is 70). At half its tempo or less, two of its bars become one, each chord and each of its melody’s notes as long as they were, so the song keeps its length and its pace (where a chord holds a bar, each section plays its chords half as many times); at twice its tempo or more, each bar becomes two. It is one change: Undo brings the song back in its genre, and another seed is another take of it. Assistants do the same with change_genre, and the command line with claudius change-genre.

Save, after Open, hands you the song. In a browser it downloads it: the demo (where it is Download) as a FLAC file, lossless at about half a WAV’s size, and a claudius as an MP3, which also saves the song’s folder on the computer claudius runs on. In the app it saves the folder, under ~/Music/claudius, and shows it. When the song changed since its last render, the download waits for the new render. The Export menu downloads the song as WAV, AIFF, FLAC, Apple Lossless, MP3, AAC, Opus or Ogg Vorbis (Exporting), and renders each track on its own as a WAV (stems): the app asks where to save the file, and a browser downloads it. In the demo it offers WAV, AIFF, FLAC, MP3 and Opus, which the demo’s engine writes in the page; AAC and Apple Lossless need the system’s encoder, and Ogg Vorbis a library the demo leaves out. Project file (.claudius) is the song itself, one file to carry on with in claudius anywhere or to send to someone (Carrying on in claudius): the app asks where to save it, and a browser downloads it. Publish…, at its foot, checks the song as stores do and writes what a distributor takes (Publishing).

Record, the red button after the loop button, records a take from a microphone or an audio interface, in the studio app, in the browser studio that claudius serve serves and in the demo, which keeps it in the page with the song (and in the project it saves). The + after it opens Add a recording: a song or a sound of your own, chosen or dropped anywhere on the studio. claudius listens to it first and shows its tempo, key, sections and the phrases its voice sings; then it goes in whole as a track that you trim and put effects on, or as its sung phrases (heard and picked first), a passage, chops or a stab, in the sections you choose (Takes, What the window hears first).

The phone button after it opens Play from a phone: a QR code for a phone on the same Wi-Fi, which opens drum pads, keys and a turntable with the song’s sounds there, and sends the takes played on them into the song (Playing from a phone).

  • Setting it up. Choose the input and its channel, the section the take starts with, a bar or two of count-in, and what it is (a vocal, a guitar playing chords …). A MIDI keyboard’s take is a part of the sound you choose, and a MIDI drum pad’s, chosen as drums, plays the song’s drum lanes (Drums played on pads).
  • Recording. The song plays from the count-in, and the take records from the section’s first downbeat until you press Stop or the song ends. Then the take waits: Play it back plays it in the song, from a bar before it, Record again records it over, and Keep it sends it to claudius, which plays it once from that section, mixed like any other track.
  • For an assistant. When an assistant asks you for a take, the Record window opens set up for it, with a line saying what to record. Send it sends the take to claudius and to the assistant, and Not now tells the assistant you will not record it (A take an assistant asks for).
  • Checking your pitch. Check my pitch plays six short phrases for you to sing back, one at a time. claudius learns from it how you sing, shows your voice under the button, and tunes your takes so (Checking your pitch). An assistant can ask for one too, and the window opens for it.
  • Monitoring. Wear headphones, or the microphone records the song too. The studio does not play the input back, so to hear yourself without delay, use your interface’s direct monitoring.
  • Timing. Press Measure next to Latency once for each setup: claudius plays eight clicks, listens for them and sets the latency from how late they come back, so that takes land in time. Turn the speakers up a little, or hold the headphones to the microphone, while it listens. A laptop’s own speakers and microphone, for one, are late by more than they report: on a MacBook Pro, 45 ms. A MIDI keyboard has a Latency of its own, set by hand.
  • In a browser. The browser asks whether the page may use the microphone the first time the Record window opens. It records on localhost or over https only, and reports less of its latency than the app does: measure there too. A MIDI keyboard records in Chrome, Edge and Firefox (Safari has no Web MIDI): choose MIDI keyboards: let the page use them in the input list once, and the browser asks.
  • A MIDI keyboard. Choose it as the input, then what plays your notes (an instrument or a synth), the part they make (keys, a lead, chords, a pad, an arp or a bass), the grid they go to (or “as played”) and a style, as for a take’s melody. While you record, a soft guide tone plays what you play, for a keyboard with no sound of its own. When you stop, the notes become a new part (Notes played on a keyboard).

Quick fixes

Some of what the critic hears needs one change, not a search for it, and the verdict offers that change as a Quick fix beside it, and first in the Improve menu:

  • A recording off the song’s time. “‘sample’ keeps a tempo of its own, about 140 BPM, against the song’s 145”: claudius stretches a loop from the tempo it was said to keep to the song’s, and this one keeps another. The fix says it keeps that one (here 140), so that it is stretched from there to 145, and keeps its length in bars.
  • A track mixed far from its level. “pad is 4.0 dB quieter than the pad level: the rest covers it”: the fix moves it to where its genre mixes it, 6 dB at most at once.
  • A band of the master out of its range. “dull 4-8 kHz: hats, claps and snare lack bite”: the fix moves the band into its range with an equalizer at the end of the master’s chain, a bell in the middle of the spectrum and a shelf for the sub and the air, the same equalizer each time.

Fix all (in the Improve menu, Fix them all) makes every quick fix as one change. Every fix undoes, and none is offered while the verdict is of the song before its latest change: it renders again by itself, and the fixes come with its new verdict. An assistant has them as quick_fix.

Writing a track in a style

+ Add a track, then In a style, writes a track the way a genre plays it, into the song as it is: its key, its chords and its form. Choose what (drums, percussion, bass, chords, keys, pad, strings, lead or arp) and the genre, the song’s own or any other, and press Generate. A part is written as that genre’s own part of the role is: in its idiom (reggae’s one drop, funk’s slap, the dembow, a jazz walk, a trap 808 …), on a sound from its palette, in its register and with its mix; strings play the genre’s strings, or a pad on strings. It goes in as a new track, <genre>_<what>, where the song plays its part of that role, or with in place of ticked, it writes the song’s part again, keeping its name, mix and sections. Drums write the genre’s lanes from its templates and kits in place of the song’s lanes of their names and add the others beside them; percussion adds the genre’s shakers, rims and percussion beside the song’s drums. Each press is another take.

Right-click a part’s or a drum lane’s row for Another take, written again (a part with a new seed, a lane from the template of the genre it was written as: the song’s, or the one its drums were generated from), or Vary it: the same take with other details. A part keeps its rhythm, the cells of its idiom, and draws its dead notes, octaves, approaches and pushes again; a lane is varied a step or two, its hits on the strong beats kept. The Instruments tab has Vary beside Reseed. Every one is an edit that undoes.

Swapping a sound

A sound you do not like is a click from another. Hover a part’s or a drum lane’s name in the arrangement, or a lane’s under Drums, and click the swap button where its kind or its length is written: the track plays the next sound that fits it. A part goes through its genre’s own sounds first, then what the genre draws for its role (synths, and the installed instruments that can play its range), then sounds further afield; a drum lane goes through the installed kits, the genre’s first, then its synthesized voice in four tunings. It never takes a sound another part plays, and block chords under a part change with it. A part played by a rack, as the bass of a bass-heavy genre is, swaps the sound it is heard by and keeps the rest: the sub under it and the grit over it stay. Click again for the next, and Undo to swap back. Right-click the row for Another sound, and Swap the sound to: every sound it could play, by how near its genre each is, with the one it plays ticked. The Instruments tab has the same button beside each part’s sound.

Sounds, after Improve, swaps the whole song’s. Swap every sound puts each part on its next sound and the drums on the next kit, and Swap the parts’ sounds leaves the drums as they are. Another drum kit and Put the drums on move every drum lane onto a kit, or back to the synthesized voices, and leave the parts. Every note, pattern and mix setting stays. A swap is an edit like any other: the song’s script says it as part("bass", #{ preset: "moog_bass" }) and drum_sound("kick", "tr808:bd") (a rack’s as its rack() with the new sound in it), and an assistant swaps a sound with swap_sound.

Carrying on in claudius

A song begun in the demo goes on in claudius. The demo’s Export menu downloads it as a Project file (.claudius), named after the song: a zip of its blueprint.json and song.rhai, and under samples/ every sample it plays, cut from the free libraries’ recordings, with the recording it came from beside each (its page, who made it and its licence) in a .json, and their credits in credits.txt. A sample is kept as 24-bit FLAC, and a drum hit as the 32-bit WAV the demo cut it as, so nothing of them is lost. What you gave in Publish… goes with it too, once you have given anything: the details in release.json and the cover beside it, as artwork.jpg or artwork.png.

Install claudius, then double-click the file, Open it in the studio, or have an assistant open it: the installed app is the one to open a .claudius file, in the Finder, in Explorer, and on a Linux desktop the .deb or the .rpm installed it on, whose file manager shows a project that carries a cover by its cover. claudius unpacks it into a song folder of its own under ~/Music/claudius, named after the file, and opens the song there, playing the samples the file brought, and with the release it carries in Publish. From then on it is a song like any other: it saves into that folder, and credits the recordings it plays in the folder’s credits.txt (Where they go, and credits). A zip with a file that would land outside its folder is not opened, nor one that would unpack to more than 2 GB or 10,000 files.

The app saves a song the same way: Export, then Project file (.claudius), and choose where. The file holds the song, every recording it plays (its takes, the recordings it sampled with their credits, your own samples) and what you gave in Publish, so it opens the same on another computer. On a Mac the Finder shows a project the app saved by the cover you gave in Publish, as its icon, and by its name without .claudius. Two kinds of sound stay out of it, as their licences ask: Apple loops, which Apple lets songs use but not hand on as files, and the sounds of claudius’s packs, which claudius finds in the packs installed where it is opened. claudius says when a song plays any, since a computer without them plays the song without those sounds. The file holds the recordings themselves, so share it as you would share them. claudius export SONG -f project writes one from a song folder, and an assistant asks export for project.

The file is a zip by a name of its own so that a browser keeps it whole: Safari unpacks a .zip it downloads into a folder. claudius opens the .zip projects earlier demos saved all the same, and a project’s folder zipped again, as Finder or Explorer zips one. A folder Safari unpacked opens too: choose the blueprint.json in it, and the studio app brings the samples beside it along, as the file would have.

The demo opens its projects too: Open, then Choose a file… and the .claudius file, and the song is open in the page again with the samples and takes it plays, each crediting the recording it came from, so that you can carry on where you left off without installing anything. The page keeps nothing once it is closed, so download the project again when you have changed the song. A project that holds no blueprint.json, or plays a file it does not hold, is not opened.

The demo opens on the song its address names, which its engine writes again from the same genre and seed: Infinite Radio’s Open in the studio links a song it plays that way (/studio/?mock&genre=deep_house&seed=812&bpm=121.5&key=F+minor&sampled=0, each as new_song takes it). Without a genre it opens its own first song.

Help and assistants

A small (?) beside a setting whose name is not plain (Intensity, Transitions, Swing, Register, a bus, the master’s loudness) says in plain words what it does when you point at it, and opens the page of these docs that says more when you click it. Buttons and menu items say what they do when you point at them too.

? in the bottom right corner opens the help menu: Take the tour, Connect an assistant, Send feedback…, Look, Check for updates and Update automatically and the switch for anonymous usage statistics (in the app), the documentation, and a form to report a problem.

Send feedback… (or “feedback” in the command palette) opens a window to tell the people who make claudius what works, what doesn’t and what you wish it did, in your words, with your email if you’d like an answer. claudius’ version, your system and the song’s genre go with it unless you untick them, and nothing else (what is kept). An assistant can pass something on for you too, once you say yes.

Look picks how the studio looks: Dark, the studio’s own, Light, or As the system is, which follows your computer’s appearance (in a browser, the browser’s) and changes with it, at night for one. The look’s name at the right end of the transport bar, beside the score, picks it too, and the command palette has all three (“light mode”, “dark theme”). The studio wears the dark look until you pick another, and keeps the one you pick. The light look draws the music on white, with grey panels around it, and its LCD is a pale display with dark figures. Both looks keep text readable on every panel, at least 4.5:1, and every track and section keeps its colour in both. Add a theme… wears a look of your own or one someone shared, and Copy this look as a theme writes out the look you wear to make one from (Themes). When a new release has been downloaded, a bar under the toolbar offers Restart to update (Updates). Connect an assistant lists Claude Desktop, Claude Code, Cursor and Codex, says which are connected, and connects one with a click, the way claudius connect does (Working with an assistant). The assistant then makes and edits the song open here, and you hear every change.

Talking to your assistant from the studio

An assistant connected to claudius can listen for what you write in the studio: ask it to (“wait for my messages in the claudius chat”). While it listens, the status bar says so (“● Claude Code is listening”), and a click there opens the Chat window: write, Enter sends (Shift+Enter starts a new line), and its answers come in below, each saying which of your messages it answers. The window opens by itself when the assistant writes, and the app notifies you when its window is not in front. With no assistant listening, the field says how to have one listen. The chat is kept between runs in claudius’s settings folder (chat.jsonl, beside your voice) until Clear the chat clears it.

The assistant listens with the wait_for_message tool, which waits until you write (or a minute passes, when it calls it again), and answers with send_message; each message has a higher id than the one before, a cleared chat’s too, so neither of you misses one or reads them out of order (the MCP tools).

Or have claudius start one: chat in the status bar, or Chat with an assistant in the command palette, opens the window, which offers Claude Code, Gemini CLI and Codex while no assistant listens. claudius runs the one you pick on this computer and talks to it over the Agent Client Protocol. It comes through npx, which needs Node.js, and has to be signed in, as it is once you have used it on its own. What you write is its prompt, and its answer comes in as it writes it, with a line for each tool it uses. It works in your songs folder with claudius’s tools and may use nothing else: a permission it asks for anything else is refused, and the chat says so. Stop at the top of the window stops it. A claudius others reach, with --public or a token, starts none (security).

Finding an action

Cmd+K (Ctrl+K on Windows and Linux), or Cmd+K all actions in the bottom right corner, opens the command palette: every action of the studio, each with where it lives (the transport, the toolbar, a tab, the status bar) and the key that does it too. Type a few letters of its name, or say what you want in your own words: “volume” finds the Mixer, “whiteboard” the Signal flow, “make it sound better” Improve the song, “sing over it” Record a take, “go back” Undo. Pick one with the arrows and press Enter, or click it. Escape closes the palette. A word typed with a slip (“genrate”, “revreb”, “the whistel”) is read as the word meant, one the studio’s actions, the requests it reads or your song’s tracks have, and the palette says so under the field: Read as “generate”. An English word is never taken for a slip: “centre the hats” stays as you typed it.

The palette also finds what you did to the song. “Go back to before we added the whistles” offers Go back to before the change that added them, under the actions, with what that change did. Picking it takes the song back to how it was before it, which undoes it and everything since. Redo brings them back one at a time. It finds the changes Undo can still take back, by what they changed: tracks added or taken out and what they play, a tempo made faster, a track made louder, a key change, a section added.

Asking in your own words

The palette also does what you ask of the song, in plain words: “more reverb on the snare”, “lets increase overload for guitar track to 95%”, “swap all toms for snares”, “cut the guitar from 1:02”, “undo the last 5 changes”, “mute everything except the vocals”, “make it 128”, “put it in D minor”. What claudius read your words to ask comes first, under What your words ask, as a button that says what it changes from what to what: “Increase guitar’s drive from 20% to 95%”. Nothing changes until you pick one. When your words could mean more than one thing (two toms for “the tom”), each reading is a button of its own. Pick one with the arrows and Enter, or click it, and undo takes it back in one step, however many tracks it changed. Words that ask nothing claudius can do, or name nothing in the song, find actions as before.

It reads requests to change a track’s volume, drive, reverb, delay or pan, by an amount (“by 3 dB”), to a value (“to -6 dB”, “to 60%”), or by your feel (“the bass is a bit loud”, “the vocals sound too dry”). It changes the tempo or the key, swaps a track’s sound (“make the bass a reese”), cuts tracks from a time to the end, mutes, unmutes, solos or removes them, and undoes, redoes or goes back to before a change (“go back to before we added the whistles”). A request that asks two things at once (“louder, with more reverb”) is read as one of them. Ask for the other next.

Ask it about the song, too, and it answers from the song as it is, under The song now: “what’s the bass volume” (Bass is at -3 dB, and how loud it played in the last render), “how much reverb is on the snare”, “where is the hat panned”, “what sound is the lead”, “is the organ muted”, “where does the bass play”, “what plays in the drop”, “what key is it in”, “what tempo is it at”, “how long is the song”, “how many tracks are there”, “which track is the loudest”. An answer changes nothing: Enter on it closes the palette. A question that says something is too much or too little (“is the bass too loud?”) comes with the change it asks for, as a button under it.

Words claudius cannot make out (“bring the choir in again”) go to a second small model on your computer, Cactus’s Needle 3, which claudius has taught to read requests. While it reads, about half a second, the palette says Reading your words…. What it reads is a button like any other, which says it was the small model’s reading when you point at it, and nothing changes until you pick it. When it cannot tell what you ask, it offers nothing. It is 35 MB, which claudius downloads from Hugging Face the first time it is needed. It reads in the app, and not yet in the demo in the browser.

Saying it

Click the microphone at the end of the palette’s field and say what you want: “mute the drums”, “undo the last two changes”, “turn the bass down by three decibels”. The palette listens until you pause, then puts your words in the field, read as if you had typed them, with the buttons they find. Nothing changes until you pick one. Click the microphone again to stop it sooner, and if it heard you wrong, type over what it heard.

claudius hears English, on your computer, with Cactus’s Whistle, 17 MB, which it downloads from Hugging Face the first time you speak. What you say is heard there and kept nowhere. A word it hears near one claudius knows is taken as that one: “undu” as undo, “the base” as the bass when the song has one. The first time, the system asks whether claudius may use the microphone, and if the palette hears nothing at all, allow it in the system’s privacy settings. The microphone is there in the app and in the web studio a claudius serves, not in the demo on the website.

Names are found at once. What your words mean is found by a small model that runs on your computer, on any processor and without a graphics card, in a fraction of a millisecond: Model2Vec’s potion-base-8M, 8 MB as claudius keeps it, which claudius downloads from Hugging Face the first time you type in the palette (the demo fetches it from the site). Until it is there, and without a network, the palette finds actions by name and reads requests by their words, and says so in its last line. An action found by what your words mean, rather than by its name, says so when you point at it. What you type in the palette stays on your computer.

A track’s menu and a section’s menu (right-click either in the arrangement) start with what they act on and group their items under small headers: a track’s under Hear, Sound, Write (Recording, for a take) and Sections, a section’s under Hear and Arrange, with the item that removes it in red at the end.

Keys

The studio can be worked from the keyboard alone. ? opens the list of every key (also ? > Keyboard shortcuts), and every action is in the command palette, with its key. Cmd is Ctrl on Windows and Linux.

key
Cmd+K, Cmd+Pthe command palette: every action, by its name or in your own words, what you ask of the song, and the answers to questions about it
?the keys, in a window
Spaceplay or pause
Homeback to the start
Lloop the song or the selected section
Na new song
Cmd+O, Cmd+Sopen a song; save it (download it in the demo)
Rrecord a take
Iadd a recording, or sample one
Tadd a track
Shift+RInfinite Radio
Pplay from a phone
Cthe chat with an assistant
Shift+Nopen an example song
Shift+Spacestop
Cmd+Enterrender the song (in the script editor: run the script)
Shift+V, Shift+Etry variations; improve the song (both start a job, which Shift keeps from a stray key)
Shift+Ffix what the critic found
Shift+Cmd+Erelease the song
1 to 6, 9the tabs: Drums, Instruments, Notes, Chords, Mixer, Sounds; Log
7, 8the Script view, the Signal flow view; the same key again, back to the arrangement
Gthe Signal flow view, and back to the arrangement
Bthe arrangement’s paint tool: a click switches a cell, dragging along a row paints the rest
Cmd+Z, Shift+Cmd+Zundo, redo
Tab, Shift+Tabthe next control, or the one before
Space, Enterpress the control that has the keyboard
arrowsa knob or a fader that has the keyboard up or down (Shift: finer)
← →select the previous or next section
↑ ↓select the track above or below: with the section, a cell of the arrangement
Enter, Deleteswitch the selected cell’s track on or off in its section; off
Escapelet go of the control that has the keyboard; then close the window on top; then back to the arrangement from another view; then let go of the selected track
Alt+↑ Alt+↓in the script editor: the number at the cursor up or down by its last digit (Shift: ten times as much), and the script runs

A control that has the keyboard has an orange ring, and keeps Space, Enter and the arrows for itself: the keys of the studio’s actions work again once Escape lets go of it. The keys work while no field is being typed in.

The app’s window speaks to your system’s screen reader (VoiceOver, Narrator, Orca): each control says what it is, what it is called and its state, a knob or a fader its value. In a browser, ? > Speak what has the keyboard has the page say aloud the control Tab moves to, and is kept for the next time.

The app on your computer

The app’s window is there as your other apps are. Its title is the song’s. On a Mac, the studio’s top bar is the window’s title bar, with the window’s buttons at its left: drag the bar by any empty part of it to move the window, and double-click it to zoom the window (or to minimize it, if that is what your Mac does with a title bar). The keyboard’s media keys, and the system’s Now Playing (Control Center on a Mac, the media overlay on Windows, a Linux desktop’s media controls), play and pause the song, Stop takes it back to the start, Next and Previous go to the section after or the start of this one (or the one before, in its first two seconds), and they show its title, genre and length, and where it is as it plays and as you seek. When something takes the studio a while (Improve, a remake, listening to a recording) and it is done after another window came in front of it, a notification says so, with what the log said of it, and the Dock or the taskbar asks for your attention; so does an assistant that asks for a take. A render after an edit, a few seconds, says nothing, and a job that follows another (the render after Improve) is one of its own.

When something does not work

claudius doctor checks the installation. If the studio window opens but stays empty, the engine may not have started: claudius serve prints why. Troubleshooting has more.

Infinite Radio

Infinite Radio is a station of songs claudius writes as it plays them, one genre after another, each mixed into the next as a DJ mixes records. Nothing on it is prerecorded: the engine of the studio demo writes and renders every song in the page, while the one before it plays, and the page plays them on two decks of its own (Web Audio). A song of a genre built on samples plays recordings from free libraries, as the genre’s producers dig for records (below).

What it plays

The station plays every genre but the few with no beat to mix on or too harsh for a radio (ambient, IDM, breakcore, gabber, hardstyle, hard techno). Its first song is one of a handful that start a set well (house, deep house, nu disco, hip hop, lo-fi, afrobeats, drum and bass, synthwave, trap, funk), at the middle of its genre’s tempo range; it plays its first bars while the rest renders, about half a minute in. A song is never one of the last four genres it played.

The first song draws on the 99 instruments the studio demo starts with. Once it has rendered, the engine fetches the rest of those packs’ instruments, the ones the site may pass on, so the songs after it draw on 163. The genres’ row says how many the station has.

How it mixes

The next song is written as soon as one goes on air, and three times in four it is one that mixes into it beat for beat: a genre whose tempo range takes the playing song’s tempo, or twice or half of it, written at exactly that tempo and in a key with the same notes as the playing one’s (in the mode its genre family is usually in: hip hop, drum and bass, techno and house in minor, pop, Latin and soul in major), or now and then a fifth up or down, a step round the circle of fifths. Since every song is written at the tempo it will be mixed at, nothing is sped up or slowed down, and no song is heard out of its key.

  • A blend, as a DJ mixes on a three-band mixer. The next song starts on a bar line of the outgoing one’s outro (its last 16 bars, when it has no outro of 8 bars or more), on its own first downbeat. Its fader comes up over the first quarter of the mix with its bass and its mids held back, so that its highs come in first; halfway, on the phrase, the basses swap, its mids come in round the swap and the outgoing song’s leave just after, and the outgoing song is thinned out by a rising high-pass and faded out over the second half. Between two songs of the genres DJs blend over long intros and outros of beats alone (house, techno and trance, drum and bass, EDM, bass music, hard dance), the mix runs as long as the next song’s intro, up to 32 bars; between songs that sing from their first bars, over a phrase of 8. When the outgoing song’s beat stops before its end (an outro without drums) or the next one’s starts after a quiet intro, laying the one over the other would leave the music without a beat for as long as the mix lasts, so the beat is handed over instead: the next song’s intro runs under the outgoing one’s last bars with a beat (up to 8 of them, its start left out to fit; at least 2, its bass held back), and its beat comes in on the downbeat where the other’s ended, the outgoing song faded over its last beat and its quiet outro left out.
  • An echo out. A song in another tempo: the outgoing song’s last beat goes into a feedback echo on a dotted eighth, the song is cut on the bar, and the next one comes in on its own downbeat a bar later while the echoes die away, its bass held back for two bars.
  • A record stop. After a hip hop or R&B song, where DJs do it, about one time in three a song in another tempo comes in instead after the outgoing one slows to a stop like a record whose turntable is switched off.

Each change is scheduled on the audio clock as soon as the next song arrives, so it lands on the beat even in a tab no one is looking at. A song that arrives too late to blend on the outro comes in on the outgoing one’s next bar line.

The genres

Genres, under the controls, keeps the station to the genres chosen: one, and every song is of it, at other tempos and in other keys within its range; or a few, each song mixed into the next as before (fewer than five come round again sooner than every fifth song). A choice holds from the next song the station writes, and the first song is one of them. Now and then, about one song in six, a station kept to two genres or more fuses two of them into one song (house + techno, as fusions are written in the studio), at the first one’s tempo and in its key. The address keeps the choice (/radio/?genres=house,deep_house), so a station of your own can be shared and starts on its genres. Opening the list before tuning in starts the engine, which says what it plays.

Skip, keep, open

  • Skip brings the next song in from the playing one’s next beat, as a DJ cuts a record short. A song that was to blend in (at the playing one’s tempo, in a key of its notes) is mixed in over two bars: its bass held back until the second bar, where the basses swap, and the playing song thinned and faded out under it. When its intro has no drums, its last two bars play under the mix, so that the skip lands on its beat rather than in the quiet. Another goes in after the playing song’s last beat goes into the echo and it is cut, as an echo out ends a song. While the next song is still being written, it comes in as soon as it is.
  • Download makes an MP3 of the song on air, as it plays, in the engine’s worker (as the studio demo exports), and saves it.
  • Open in the studio opens the studio demo on the same song, which its engine writes again from what the station asked for: its genre, seed, tempo and key, and the recordings it sampled, which the studio fetches and cuts again before it writes the song. There every part of it can be changed, sampled, exported or carried on in claudius.

Samples

The station samples as each genre does, but not every song: about two songs in three of a genre built on samples (trip hop, boom bap, lo-fi, phonk and the others whose producers dig for records) are built on samples, and the rest on the genre’s own sounds alone. Before the engine writes a song built on samples, the page looks for a few recordings through the site’s search of Freesound, Jamendo and Wikimedia Commons (under CC0 or CC BY, as the studio demo does): two of each of the genre’s searches for each part it samples, in an order of the song’s own. The engine chooses which of each search’s finds are worth fetching (of a length the part takes, and none whose own words say it was cut from someone’s record), and cuts them; the song is written on those it cut, for up to 45 seconds while the song before plays (20 for the first, which you wait for). A part nothing is found for goes without, and with no search at all the song plays what stands in for samples in its genre.

What a song samples is listed under it while it is on air, under Samples in this song: each recording’s title, linked to its page in the library, who made it, its licence, linked to the licence’s terms, and what the song plays of it (a break, a phrase, a texture, a vocal or a bass). The button beside each plays the original recording, and stops it when pressed again. While an original plays, the station plays quieter under it, and comes back up when the original ends or is stopped; the next song on air stops it too.

In the app

The studio app has Infinite Radio too: the radio button on the top bar, beside the phone’s (a dot sending waves both ways), Listen to Infinite Radio before a song is open, Infinite Radio… in the ? menu, or Cmd+K. It plays the same way, with an engine of its own writing the station’s songs while your song stays as it is, and the same controls: Tune in, Skip, the genres to keep to, Save this song (an MP3 in ~/Music/claudius/radio), and Open in the studio, which makes the song on air the studio’s, the very song you heard (undo brings back the song you had). Your song and the radio take turns: playing one pauses the other. It plays on while its window is closed (design 0024).

In the app the station samples as the studio’s songs do: on the recordings gathered on this computer, and a few more the radio finds in the free libraries before it writes the song, for up to a minute while the song before plays (20 seconds for the first song, which you wait for). With no internet it plays what it has gathered, or what stands in for samples in its genre. What a song samples is listed under it while it is on air, as on the site, and its button plays the original as the library gave it, from this computer (a recording that is no longer there cannot be played). Save this song writes the credits beside the MP3 (<title>.credits.txt), as the licences of the recordings ask.

The page is site/radio/index.html and site/assets/radio.js; it drives the engine as the studio demo does (the new_song command, the renders it sends back), and site/tests/radio.spec.mjs checks it goes on air and mixes a song into the next (?soon starts the first song 20 seconds before it gives way), that a station kept to two genres plays only them, hands its song over as an MP3, links it to the studio and skips to the next, and that a trip hop song finds its recordings through the search (a stand-in answers it), lists them on air with their credits and links, plays an original from its row and hands them to the studio.

Working with an assistant

claudius speaks MCP, the protocol assistants use for tools. Once it is connected, you can ask Claude, ChatGPT or Cursor for a song in plain words. The assistant writes a script or starts from a genre, listens through claudius’ critic, reads the issues, and revises, while you listen in the studio and steer.

From the studio

The studio connects them with a click: ? in the bottom right corner, then Connect an assistant (it is also under New song while no song is open). It lists Claude Desktop, Claude Code, Cursor and Codex, says which are connected, and Connect does what claudius connect below does, skills included. An assistant set up for another claudius (an older install, say) offers Use this app. Then restart the assistant, as it says. This is the way for the Mac app, the Windows installer and the Linux packages, whose claudius may not be on your PATH.

The web studio, a page in a browser, cannot change the settings of the apps on a computer, so it lists the commands to run instead.

The Claude Code plugin and the Claude Desktop extension

Claude Code installs claudius’ MCP server and its skills in one go, as a plugin from this repository:

claude plugin marketplace add devlato/claudius
claude plugin install claudius@claudius

In a session, /plugin marketplace add devlato/claudius and then /plugin install claudius@claudius do the same. The plugin starts the claudius on your PATH. For the Mac app dragged from its disk image, set its Claudius program to /Applications/Claudius.app/Contents/MacOS/Claudius (/plugin configure claudius@claudius). Claude Code offers the plugin’s new version after each release.

On a Mac, Claude Desktop installs claudius as an extension: download claudius-<version>.mcpb from the latest release, open it, and click Install. It starts the Claudius app, so install the app first; its Claudius program setting says where the app is, Applications unless you change it. An extension carries no skills: upload the zips that Connect an assistant in the studio writes (or claudius skills --out <folder>) in Claude’s settings, under Capabilities.

Claude Desktop

claudius connect claude-desktop

Quit and reopen Claude Desktop. claudius now appears in the tools menu of a new chat. The command adds one entry to Claude’s configuration file and keeps a backup of the old one next to it; --remove takes it out again.

It also writes claudius’ skills as zips into ~/Music/claudius/skills/. Upload them in Claude’s settings, under Capabilities, and Claude uses them in Claude Desktop and on claude.ai.

Claude Code, Cursor and Codex

claudius connect claude-code
claudius connect cursor
claudius connect codex

Each adds the MCP server and installs the skills where that assistant reads them (~/.claude/skills/, ~/.cursor/skills/, ~/.codex/skills/). --no-skills leaves the skills out, and --remove takes both out again.

For any other client, claudius connect print shows the configuration to paste. Clients that can reach a URL can also connect over HTTP to a running studio: http://127.0.0.1:7878/mcp.

With the assistant’s own command

claudius is an ordinary MCP server: the assistant starts claudius mcp. So each assistant’s own way of adding a server works as well:

claude mcp add --scope user claudius -- claudius mcp    # Claude Code, in every project
codex mcp add claudius -- claudius mcp                  # Codex

Cursor adds it from a link: Add claudius to Cursor opens Cursor, which asks before it adds the server. Or put it in ~/.cursor/mcp.json yourself:

{ "mcpServers": { "claudius": { "command": "claudius", "args": ["mcp"] } } }

Claude Desktop has no command for it: in its Settings, choose Developer, then Edit Config, and add the same entry with the full path of claudius (which claudius prints it), since Claude Desktop does not see your shell’s PATH.

These find claudius on your PATH, where the installers put it. The Mac app dragged from its disk image leaves none there: use /Applications/Claudius.app/Contents/MacOS/Claudius in its place. claudius connect print prints every one of these with the full path of the claudius you run it with.

They add the MCP server only. The skills come with claudius connect; claudius skills --out <folder> writes them anywhere else, a folder each, to copy into ~/.claude/skills, ~/.codex/skills or ~/.cursor/skills.

Skills

The MCP tools give an assistant the controls; claudius’ skills give it the craft. They are short guides, in the Agent Skills format, that an assistant reads when the conversation turns to music:

  • claudius-songs: how to make and edit a song: listen, read the verdict, change one thing, and say what changed in musical terms; the script language with recipes; a starting point for each genre.
  • claudius-remix: analysing a recording, remixing it in another genre (or remaking its skeleton), chopping and flipping it.
  • claudius-setup: installing claudius, connecting assistants, and fixing what goes wrong.

claudius connect installs them for Claude Code, Cursor and Codex, and writes zips for the Claude apps. claudius skills --out <folder> writes them anywhere else, for a project’s own .claude/skills/ folder, say. They are built into claudius, so they always match the version you have. An assistant without them, such as Claude Desktop before you upload the zips or a ChatGPT project, reads them through the MCP tool guide, which claudius’ instructions point it to: guide with topic songs is claudius-songs/SKILL.md, and script, verdict, genres and tools are its references.

You and the assistant on the same song

Open the studio first (claudius studio). When the assistant starts claudius, it finds the studio already running and works on the song you have open, so every change it makes shows up in front of you, and you can change things yourself in between. Without a studio running, it starts a session of its own; open http://127.0.0.1:7878 to follow it.

What to ask

Be specific about what you want to hear, the way you would brief a producer:

  • “Make a deep house track at 122 BPM in F minor. Keep the intro sparse and make the drop hit hard.”
  • “The lead is too busy. Simplify it, and put a Rhodes on the chords instead of the synth.”
  • “Listen to it and fix the critic’s two most serious issues. Tell me what you changed.”
  • “Try five variations of the drums and keep the best one.”
  • “Remake ~/Music/reference.mp3 as lofi.”

The assistant can undo anything it does, and so can you (Cmd+Z in the studio).

ChatGPT and other assistants in the cloud

These run on someone else’s computer, so they need a public address. Run claudius with a token behind a tunnel:

TOKEN=$(openssl rand -hex 16); echo "$TOKEN"
claudius serve --public --token "$TOKEN"
cloudflared tunnel --url http://127.0.0.1:7878

Then add a custom connector (in ChatGPT’s developer mode) with the URL https://<your tunnel>/mcp?token=<token>. A shared claudius only reads and writes files in ~/Music/claudius, its caches and the sound libraries; see the security model.

What the assistant can do

The MCP tools page lists every tool. In short: start, open and save songs; read the song and its script; run scripts; render and judge; mutate and evolve; analyze and remake audio files; undo and redo.

How a track is built

This course takes you from no music knowledge to a finished song you understand, one page at a time. Each page adds one layer to the same song, explains the musical idea behind it in plain words, and gives you something to listen to. You need claudius installed (see Install) and a text editor.

Listen first

Before writing anything, listen to a track claudius makes on its own:

claudius make --genre house --seed 9

It takes under a minute. When it finishes, it prints where it wrote the song; open the song.mp3 in that folder and listen with headphones if you have them. Then listen again and try to follow one sound at a time:

  • the kick, the deep thump that comes four times in every count of four;
  • the clap answering it on every second thump;
  • the hi-hats, the short ticking sounds between the thumps;
  • the bass, the low, round notes that move underneath;
  • the chords, several notes played together, which give the music its mood;
  • the melody, a single line of notes on top that you could hum;
  • the pad, a soft, long sound that fills the background in the quieter parts.

Notice also that the song changes over time. It starts thin, fills up, drops to almost nothing in the middle, builds up with a rising sound, and comes back full. Those changes are sections.

Layers and sections

Almost every track in electronic music, and most pop, is built this way:

layerits jobin this course
drumsthe beat you move toBeats
bassweight, and the ground the chords stand onBass lines
chordsharmony: the mood, happy or sad, calm or tenseChords
melodythe part you rememberMelody
structurewhen each layer playsSong structure
mixhow loud each layer is, and where it sitsMixing

Notes and keys (Notes, scales and keys) come between drums and bass, because bass, chords and melody all need them. The last page, Listening, judging, finishing, is about hearing what is wrong and fixing it.

In claudius, a song is a set of tracks (one per layer, or more) and a list of sections, each saying which tracks play in it. You describe both in a script, a short text file, and claudius turns it into audio.

Your first script

Make a file called song.rhai with these two lines:

blank("house");
track("kick", s("bd*4"));

blank("house") starts an empty song. “House” is the style; it decides things you will meet later, like how the finished song is mixed. track("kick", s("bd*4")) adds a track called kick that plays the sound bd (bass drum) four times in every bar. You will learn what a bar is on the next page.

Render it:

claudius script song.rhai

claudius prints a summary and writes the song into a folder such as out/house-untitled-1/. Open song.mp3 there: eight bars of a steady kick drum, about fifteen seconds. That is the start of the song you will build. The studio does the same with no files at all: paste the script into its script tab (see The studio).

On every page, the code is the whole song so far, or a part of it you can add to your file. When a page shows something to try, change one thing, render, and listen to what changed.

Beats: tempo, bars and steps

Play the kick from the last page and tap along with it. Each tap is a beat: the steady pulse you would nod your head to. Everything in this page is about where sounds fall in relation to that pulse.

Tempo

How fast the beats come is the tempo, counted in beats per minute (BPM). Set it at the top of the script:

blank("house");
tempo(120);
track("kick", s("bd*4"));

At 120 BPM there are two beats every second. House music lives around 120 to 126 BPM, hip-hop around 85 to 95, drum and bass around 174. Try tempo(90) and tempo(160) and hear how much the same kick changes character.

Bars

Now count along with the kick: one, two, three, four, one, two, three, four. Each group of four beats is a bar. Musicians count in bars because almost everything in a song repeats in groups of four beats, and bigger ideas come in groups of 4, 8 or 16 bars.

In claudius, one pattern string is one bar. s("bd*4") means “fit four kicks into the bar”, one on each beat. s("bd bd bd bd") is the same thing written out: the words share the bar equally. A kick on every beat is called four on the floor, and it is the heartbeat of house and techno.

The backbeat

Add a clap. Listen for where it lands before reading the explanation:

blank("house");
tempo(120);
track("kick", s("bd*4"));
track("clap", s("~ cp ~ cp"));

The clap falls on beats two and four. ~ is a rest, a beat of silence, so "~ cp ~ cp" reads as rest, clap, rest, clap. Hits on two and four are called the backbeat, and you have heard it in nearly every pop, rock and dance song.

Between the beats

Each beat can be divided into smaller steps. Square brackets squeeze several sounds into one step:

blank("house");
tempo(120);
track("kick", s("bd*4"));
track("clap", s("~ cp ~ cp"));
track("hats", s("[~ hh]*4"));

[~ hh] is a rest and a hi-hat sharing one beat, so the hat lands exactly halfway between two kicks; *4 repeats that in all four beats. Count one AND two AND three AND four AND: the hats are on every AND, the offbeats. This “tss” between the thumps is what makes house sound like house.

The usual ways of dividing a beat:

writtenper barsounds like
bd*44one per beat
hh*88two per beat: one and two and
hh*1616four per beat: one e and a two e and a
[~ hh]*44, between the beatsthe offbeats

Sixteen steps per bar are a common grid. Producers call each one a step, and talk about “a hit on step 5” (the second beat) or “a ghost note on step 8”.

A fuller groove

Add a shaker playing sixteen soft steps, so you can hear the grid filled in:

blank("house");
tempo(120);
track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));

.gain(0.4) plays the shaker softly: gain is how hard each sound is hit, from 0 to 1. Soft, busy parts like this make a groove feel alive without getting in the way.

Swing

Straight sixteenth steps sound mechanical. Swing delays every second sixteenth a little, so the steps go long-short, long-short, the way a drummer’s hands do:

blank("house");
tempo(120);
swing(0.58);
track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));

0.5 is straight; 0.66 is a full triplet swing. Listen to the shaker: at 0.58 it bounces. House usually swings a little (0.52 to 0.56), lofi hip-hop a lot (0.58 to 0.62).

Try this

  • Make the kick play only on beats one and three: s("bd ~ bd ~"). The groove relaxes into half the energy.
  • Add a kick on the very last sixteenth of the bar, a little push into the next bar: s("bd bd bd [bd ~ ~ bd]"). The last beat is split into four sixteenths, and the extra kick sits on the fourth.
  • Replace the hats with eight-per-bar hats, s("hh*8"), and hear how the feel gets busier.
  • Play the drums on a real drum machine, the Roland TR-909 used on countless house records (this needs the sample packs, which claudius setup installs):
blank("house");
tempo(120);
track("kick", s("bd*4").bank("tr909"));
track("clap", s("~ cp ~ cp").bank("tr909"));
track("hats", s("[~ hh]*4").bank("tr909"));

The song so far

Keep this in your song.rhai; the next pages add to it.

blank("house");
title("First Light");
tempo(120);
track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));

Mini-notation has every symbol you can use in a pattern string.

Notes, scales and keys

Drums mostly don’t have a pitch: a kick is a thump, not a note. Bass, chords and melody do. Before writing them, you need three ideas: notes, scales and keys.

Notes

Play this and listen to the sound climbing:

blank("house");
tempo(120);
track("up", note("c4 d4 e4 f4 g4 a4 b4 c5").s("epiano"));

Each sound is a note, and how high or low it sounds is its pitch. Notes are named with the letters a to g. After g the names start again at a, and the number says which round you are in, the octave: c4 to c5 is one octave up. Listen to the first and last note: they sound like the same note, one higher. That sameness is why they share a name.

c4 is middle C, the C in the middle of a piano. Low notes for bass sit around octave 1 and 2 (a1, e2), chords around 3 and 4, melodies around 4 and 5.

Semitones, sharps and flats

The eight notes above are the white keys of a piano. Between most of them there is a black key, a note halfway between. The smallest step between two neighbouring notes, white or black, is a semitone. The in-between notes are written with # (sharp, a semitone up) or b (flat, a semitone down): c#4 is the black key directly above c4, and it is the same note as db4. There are twelve semitones in an octave.

blank("house");
tempo(120);
track("all twelve", note("c4 c#4 d4 d#4 e4 f4 f#4 g4 g#4 a4 a#4 b4").s("epiano"));

Every note in that bar is a semitone higher than the one before. It sounds like stepping up a staircase, with no sense of where it is going. Music usually picks fewer notes than that.

Scales

A scale is a selection of seven (sometimes five) of the twelve notes that sound good together. Listen to two:

blank("house");
tempo(120);
track("major", n("0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 ~").scale("C:major").octave(4).s("epiano"));
blank("house");
tempo(120);
track("minor", n("0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 ~").scale("A:minor").octave(3).s("epiano"));

The first is C major: bright, settled, the “do re mi” you know. The second is A minor: darker, a little sad. They use exactly the same seven notes, the white keys, but A minor starts and ends on A. The note a scale is built on and comes home to is its tonic, and it changes the whole mood.

n() plays a scale by numbers instead of note names: 0 is the tonic, 1 the next note of the scale, and so on; 7 is the tonic an octave up. That is why the same numbers gave two different tunes: they were counted in two scales.

Keys

A song’s key is the scale it uses: “A minor” means the A minor scale, with A as home. Set it for the whole song:

blank("house");
tempo(120);
key("A minor");
track("tune", n("0 2 4 2 0 ~ ~ ~").octave(4).s("epiano"));

n() without .scale() uses the song’s key. The numbers 0, 2 and 4 skip every other note of the scale (A, C, E), which is a pattern you will meet again on the chords page.

Writing notes as numbers in the key has two advantages. Every number is in the scale, so nothing sounds wrong by accident. And if you change the key, everything written this way moves with it: change key("A minor") to key("D minor") and render again. The tune is the same, only lower.

Try this

  • Play the five-note pentatonic scale, which sounds good in almost any order: n("0 1 2 3 4 3 2 1").scale("A:minor:pentatonic").octave(4). Shuffle the numbers; it still works.
  • Try key("A major") with the tune above and hear the same numbers turn bright.
  • Write a short tune of your own with numbers from 0 to 7 and ~ for rests. Start and end on 0 and it will sound finished.

The song so far

The drums from the last page, now in A minor. You won’t hear a difference yet: the key matters from the next page on.

blank("house");
title("First Light");
tempo(120);
key("A minor");
track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));

Pitch has every scale name and the exact rules for notes.

Bass lines

The bass is the lowest part of a song. It does two jobs at once: it gives the beat weight (you feel it as much as hear it), and it tells your ear which chord the music is on, by playing that chord’s lowest note. A good bass line locks to the kick drum and moves with the chords.

Low notes

Bass notes live in octaves 1 and 2. Compare:

blank("house");
tempo(120);
track("high", note("a3 ~ ~ ~").s("sub_bass"));
blank("house");
tempo(120);
track("low", note("a1 ~ ~ ~").s("sub_bass"));

Both are the note A. The second is two octaves lower, and on good headphones or speakers you feel it more than you hear it. sub_bass is a pure, round synthesizer bass, which is why it nearly disappears on laptop speakers.

One note per bar

Our song will move through four chords, one per bar: A minor, F, C and G. You will build those chords on the next page. The bass plays the note each chord is named after, its root: A, F, C, G.

blank("house");
tempo(120);
key("A minor");
track("kick", s("bd*4"));
track("bass", note("<a1 f1 c2 g1>").s("sub_bass"));

The angle brackets < > mean “one per bar, in turn”: A in bar 1, F in bar 2, C in bar 3, G in bar 4, then A again. Each note lasts its whole bar. Listen to how the music seems to change mood every bar, even without chords: that is the bass doing its second job.

c2 is higher than a1 and g1, so the line moves down, up, down without big jumps: A, then F a little below it, C above, G below again. Keeping a bass line in a small range makes it smooth.

Rhythm

A bass that holds one note per bar is a drone. Give it a rhythm with .struct(), which takes the notes from one pattern and the timing from another:

blank("house");
tempo(120);
key("A minor");
track("kick", s("bd*4"));
track("bass", note("<a1 f1 c2 g1>").struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));

"x ~ ~ x ~ x ~ ~" divides the bar into eight steps, two per beat, and plays on three of them. Count one and two and three and four and: the notes fall on one, on the and after two, and on the and after three. Each x plays whatever note the bar has. The first note lands with the kick on beat one, so you hear the chord change exactly when the bar starts; the other two fall between kicks, which is what makes the line groove.

Note length

Each note lasts until the next step unless you shorten it. .legato(0.5) makes every note half as long, so the bass bounces instead of sliding from note to note:

blank("house");
tempo(120);
key("A minor");
track("kick", s("bd*4"));
track("bass", note("<a1 f1 c2 g1>").struct("x ~ ~ x ~ x ~ ~").s("sub_bass").legato(0.5));

Bass sounds

soundcharacter
sub_basspure and deep, almost felt rather than heard
organ_bassround with some body; the classic house bass
saw_bassbuzzy and present, cuts through on small speakers
808a deep boom that drops in pitch: hip-hop and trap
reesetwo detuned saws, moving and dark: drum and bass

Swap sub_bass for each and listen. On laptop speakers, organ_bass and saw_bass come through much more clearly, because they have higher overtones on top of the low note.

Try this

  • The house offbeat bass: .struct("~ x ~ x ~ x ~ x"). The bass plays on every and, between the kicks, and the kick and bass take turns.
  • Octave jumps: note("<[a1 a2]*4 [f1 f2]*4 [c2 c3]*4 [g1 g2]*4>").s("saw_bass").legato(0.5) jumps between the root and the same note an octave up, four times a bar: an eighties sound.
  • Start the bass a sixteenth late with .late(0.0625) and hear the groove lean back.

The song so far

blank("house");
title("First Light");
tempo(120);
key("A minor");
track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));
track("bass",   note("<a1 f1 c2 g1>").struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));

Chords and progressions

A chord is several notes played at the same time. Chords carry the mood of a song more than anything else: the same beat sounds hopeful over one chord sequence and sad over another.

Three notes at once

On the last page, n("0 2 4") played A, C and E one after another. Play them together and you have a chord:

blank("house");
tempo(120);
key("A minor");
track("arpeggio", n("0 2 4 ~").octave(3).s("epiano"));
track("chord",    n("[0, 2, 4] ~ ~ ~").octave(3).s("epiano"));

The comma inside the brackets stacks the notes instead of playing them in turn. A chord built from every other note of the scale (1st, 3rd and 5th) is a triad, the basic chord of almost all Western music.

Major and minor

Triads come in two main colours. Listen to these two chords, one bar each:

blank("house");
tempo(120);
track("chords", chord("<C Cm>").s("epiano"));

C is C major: bright and stable. Cm is C minor: darker. The only difference is the middle note, one semitone lower in the minor chord. In chord names, a capital letter alone is major (F, G), and m after the letter means minor (Am, Dm).

A progression

A sequence of chords that repeats is a progression. The bass from the last page already played the roots of ours: A, F, C, G. Here are the chords themselves:

blank("house");
tempo(120);
key("A minor");
track("chords", chord("<Am F C G>").s("epiano"));
track("bass",   note("<a1 f1 c2 g1>").struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));

A minor, F major, C major, G major, one bar each. This is one of the most used progressions in pop and dance music: it starts sad, lifts, and the G at the end pulls back to the beginning. The bass plays each chord’s root at the start of its bar, so the two agree.

Telling the song its chords

Writing the chords inside a pattern works, but claudius can do more when the song itself knows its progression. Set it once with prog(), and play it with chord("prog"):

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("chords", chord("prog").s("epiano"));

prog("A", ...) names the song’s main progression A. bars_per_chord(1) makes each chord last one bar (a blank song starts that way; a 2 would hold each chord for two bars). chord("prog") plays whatever chord the progression has at each moment. Now the song’s harmony is in one place: other parts can follow it, claudius checks your melody against it, and a second progression for another section is one more line.

A bass that follows

The bass can follow the progression too. .root() makes a chord pattern play only each chord’s root, the note the chord is named after (A for A minor), down in the bass register:

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("chords", chord("prog").s("epiano"));
track("bass",   chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));

The bass plays A, F, C and G, the same rhythm as before, now taken from the progression. Change the chords in prog() and the bass changes with them.

Rhythm for chords

A held chord is calm. Chords played in a rhythm, called stabs, drive the groove:

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("kick",   s("bd*4"));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").legato(0.5));

The rhythm x ~ ~ x ~ ~ x ~ puts three chords in each bar, unevenly spaced (3 + 3 + 2 eighth notes). It is one of the oldest rhythms in dance music, and it rubs nicely against the steady kick.

You did not choose which A, C and E to play, or in which order. claudius picks the notes of each chord so they move as little as possible from the chord before. Musicians call that voice leading, and it is why the chords sound connected rather than jumping around.

A pad underneath

A pad is a soft, long sound holding the chords in the background. It fills the space and makes quiet sections feel full:

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("pad", chord("prog").s("pad").role("pad"));

.role("pad") tells the mixer what this track is, so it sits quietly behind everything else. You will see roles again on the mixing page.

The numbers in the progression

If you print your song as a script (you will on the last page), the progression shows up as prog("A", "i VI III VII"). These are Roman numerals: they name each chord by its place in the key. i is the chord on the first note of the scale (A in A minor), VI the chord on the sixth (F), and so on; lower case means a minor chord, capitals a major one. Written this way, the progression works in any key: in D minor, i VI III VII is Dm, B♭, F, C.

Try this

  • Seventh chords add one more note on top and sound richer, jazzier: prog("A", "Am7 Fmaj7 Cmaj7 G7").
  • A brighter progression in the same key: prog("A", "F G Am Am").
  • Hold each chord for two bars with bars_per_chord(2). The chords, the pad and the bass all follow.
  • Arpeggiate the chords, playing their notes one after another: chord("prog").struct("x*4").arp("up").s("pluck").

The song so far

blank("house");
title("First Light");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);

track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));
track("bass",   chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").legato(0.5));
track("pad",    chord("prog").s("pad").role("pad"));

Pitch lists every chord name claudius understands.

Melody

The melody is the part of a song you could sing back: one note at a time, on top of everything else. In electronic music it is often called the lead, or the hook when it is the catchiest bit.

Notes from the key

Write melodies with n(): every number is a note of the key, so you cannot hit a wrong note. In A minor:

number01234567
noteABCDEFGA (higher)

A first idea, with eight steps in the bar:

blank("house");
tempo(120);
key("A minor");
track("melody", n("4 ~ 2 ~ 0 ~ 2 4").octave(4).s("pluck"));

E, C, A, C, E: it falls and climbs back. .octave(4) puts the melody above the chords; pluck is a short, bright synth sound that cuts through.

Fitting the chords

Play that same bar over all four chords and something sounds off, most of all over the G in bar 4. The reason: each chord is made of three notes, and a melody note that is part of the chord underneath sounds settled, while one that isn’t sounds tense. A little tension is good; too much on the strongest beats sounds like a mistake.

The strong beats are beat 1 and beat 3 of each bar, steps 1 and 5 when the bar has eight steps. Here are the chord notes of our progression as numbers:

chordnotesnumbers
AmA C E0 2 4
FF A C5 0 2 (or 7 9)
CC E G2 4 6
GG B D6 1 3 (or 8 10)

So write each bar for its chord, with a chord note on steps 1 and 5:

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("chords", chord("prog").s("epiano"));
track("melody", n("<[4 ~ 2 ~ 0 ~ 2 4] [5 ~ 4 ~ 2 ~ ~ ~] [4 ~ 2 ~ 4 ~ 6 4] [6 ~ 4 ~ 3 ~ ~ ~]>")
                  .octave(4).s("pluck"));

Each pair of square brackets is one bar, and the angle brackets play them in turn. Check bar 2 against the table: F on beat 1 (5) and C on beat 3 (2), both notes of the F chord. The notes in between (the 4 in bar 2 is E) pass through, which is what makes a line move.

Repetition

Listen to the four bars again: bars 1 and 3 start the same way (4, then 2), and bars 2 and 4 both end with a held note. Repeating a short idea, a motif, with small changes is how melodies become memorable. Four bars that are all different are hard to remember; four identical bars are boring. Aim between.

Rests matter as much as notes: the held note at the end of bars 2 and 4 is a breath, and it splits the four bars into a question and an answer.

Echo

A delay repeats a sound a moment later, quieter, like an echo in a canyon. It makes a short melody sound wider and fills the gaps:

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("melody", n("<[4 ~ 2 ~ 0 ~ 2 4] [5 ~ 4 ~ 2 ~ ~ ~] [4 ~ 2 ~ 4 ~ 6 4] [6 ~ 4 ~ 3 ~ ~ ~]>")
                  .octave(4).s("pluck").delay(0.2));

.delay(0.2) sends a fifth of the sound to the song’s echo. The echoes come in time with the beat.

Try this

  • Play the melody an octave higher every fourth bar: .every(4, |x| x.add(7)). Adding 7 moves every note up seven steps of the scale, which is one octave, so it still fits the chords.
  • Swap the sound: bell, square_lead, or with the sample packs installed piano, vibes, flute.
  • Add a quieter copy an eighth note behind, an octave up: .off(0.125, |x| x.add(7).gain(0.5)).
  • Write your own four bars using the table. Put chord notes on steps 1 and 5, and anything from the key in between.

The song so far

blank("house");
title("First Light");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);

track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));
track("bass",   chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").legato(0.5));
track("pad",    chord("prog").s("pad").role("pad"));
track("melody", n("<[4 ~ 2 ~ 0 ~ 2 4] [5 ~ 4 ~ 2 ~ ~ ~] [4 ~ 2 ~ 4 ~ 6 4] [6 ~ 4 ~ 3 ~ ~ ~]>")
                  .octave(4).s("pluck").delay(0.2));

Render it. Every layer plays all the time, for eight bars: it sounds like the loudest moment of a song, with nothing leading up to it. The next page fixes that.

Song structure

Your song so far plays every layer at once from the first bar to the last. Real songs change: they start small, build, release, breathe, and end. Each stretch of a song with its own set of layers is a section, and the plan of sections is the song’s structure (or form).

Sections in dance music

Listen to the song you made on the first page again (claudius make --genre house --seed 9) and follow its sections:

sectionwhat happenstypical layers
introthe song starts small, often only drumskick, hats
groovethe main beat with bass and chordsmost of the drums, bass, chords
break (breakdown)the drums stop; space and atmospherepad, chords, maybe the melody
buildtension rises towards the dropa snare roll, a rising noise, no kick
dropeverything comes back at onceeverything
outrothe song winds downkick, hats, bass

Sections are usually 4, 8 or 16 bars long. Ears expect change at those points: a section of 7 bars feels like someone tripped.

Writing the form

form() lists the sections in order. Each sec() gives the kind of section, its length in bars, and the tracks that play in it:

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("kick",   s("bd*4"));
track("hats",   s("[~ hh]*4"));
track("bass",   chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").legato(0.5));
track("pad",    chord("prog").s("pad").role("pad"));
form([
  sec("intro", 8, "kick hats"),
  sec("groove", 8, "kick hats bass chords"),
  sec("break", 8, "pad chords"),
  sec("drop", 8, "kick hats bass chords pad"),
]);

Thirty-two bars, about a minute. Listen to how much bigger the drop feels after the break, though it adds only the pad to the groove. Taking things away does as much as adding them.

Energy

Every section has an energy, from 0 (silent) to 1 (as intense as the song gets). claudius gives each kind a default (an intro 0.4, a break 0.35, a drop 0.95) and the critic checks that the song really gets louder where the energy rises. You can set it with .energy(0.3) when a section is quieter than its kind suggests.

Making the drop land

Four small touches turn a list of sections into a song that flows. Add them as methods on a section:

  • .filter_in() on the intro: the music starts muffled and opens up across the section, like walking into the room where the party is. (The drums stay clear.)
  • .build() on the section before the drop: a rising noise (a riser) and a sweep that thins out the low end, both growing until the drop.
  • .gap() on that same section: one beat of silence at its very end. The drop hits harder after a breath.
  • .impact() on the drop: a crash cymbal and a boom on its first beat.

A drummer would also play a snare roll into the drop: hits getting faster and louder. Make one as its own track, one bar of each speed, and play it only in the build:

blank("house");
tempo(120);
track("roll", s("<sd*2 sd*4 sd*8 sd*16>").gain("<0.5 0.65 0.8 1>"));
form([sec("build", 4, "roll").build()]);

Two hits in bar 1, four in bar 2, eight, then sixteen, getting louder each bar. Since the angle brackets start over in every section, the roll always begins with the build.

A second progression

The break is a good place for different chords. Sections play progression A unless they say otherwise, and breaks play progression B when the song has one (until now, yours did not, so the break played A). Give the song a B:

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
prog("B", "F G Am Am");
bars_per_chord(1);
track("pad", chord("prog").s("pad").role("pad"));
form([sec("groove", 8, "pad"), sec("break", 8, "pad")]);

The same pad track plays A in the groove and B in the break, because chord("prog") follows whatever progression the section plays, and so does a bass written with .root(). The melody, though, was written note by note for progression A, so keep it out of the break, or tell a section to play A with .prog("A").

The song so far

The whole song: 60 bars, two minutes at 120 BPM.

blank("house");
title("First Light");
tempo(120);
key("A minor");
prog("A", "Am F C G");
prog("B", "F G Am Am");
bars_per_chord(1);

track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));
track("roll",   s("<sd*2 sd*4 sd*8 sd*16>").gain("<0.5 0.65 0.8 1>"));
track("bass",   chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").legato(0.5));
track("pad",    chord("prog").s("pad").role("pad"));
track("melody", n("<[4 ~ 2 ~ 0 ~ 2 4] [5 ~ 4 ~ 2 ~ ~ ~] [4 ~ 2 ~ 4 ~ 6 4] [6 ~ 4 ~ 3 ~ ~ ~]>")
                  .octave(4).s("pluck").delay(0.2));

form([
  sec("intro", 8, "kick hats pad").filter_in(),
  sec("groove", 16, "kick clap hats shaker bass chords"),
  sec("break", 8, "pad chords"),
  sec("build", 4, "clap hats pad roll melody").gap(),
  sec("drop", 16, "kick clap hats shaker bass chords pad melody").impact(),
  sec("outro", 8, "kick hats bass"),
]);

The pad plays in the intro so the opening filter has something to open: the drums are never filtered. The build has no kick: taking the kick away for four bars makes its return in the drop the biggest moment of the song. A section of kind build gets the riser and the sweep without being asked; .gap() adds the breath.

Try this

  • Make the break longer (16 bars) and put the melody in it with .prog("A").
  • Add a short break and a second drop before the outro: sec("break", 4, "pad") and a copy of the drop line. A second section with the same name is renamed drop2 automatically. ("*" instead of a list means every track, which here would include the roll.)
  • Remove .gap() and listen to the drop again. Then put it back.

Form and sections explains every section setting exactly.

Mixing

Mixing is making every part of a song audible and placing it: how loud each track is, how far left or right, how close or far away. A good mix lets you follow any part you choose to listen to.

claudius does a first mix for you. This page shows what it does and how to adjust it.

Roles: the automatic balance

Every track has a role that says what it is: kick, snare, hat, bass, chords, pad, lead and so on. Each role has a loudness it is usually mixed at, and claudius brings every track to that loudness. Kick and bass are loud, hats and shakers quieter, pads quieter still, behind everything.

Most tracks get the right role on their own: a track playing bd is a kick, one playing sub_bass is a bass, a chord() pattern is chords. A melodic track with nothing else to go on is treated as the lead. That is why the pad had .role("pad") on the chords page: without it, the pad would be mixed as loud as a melody.

Level

To change how loud a track is, give it a level in decibels (dB), relative to where its role puts it:

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("kick", s("bd*4"));
track("pad",  chord("prog").s("pad").role("pad"));
mix("pad", #{ level: -3 });

level: -3 is three decibels quieter than usual for a pad. Decibels are how loudness is measured: 1 dB is about the smallest change you can notice, 3 dB is a clear step, and 10 dB sounds roughly half as loud. Use small numbers; anything beyond ±6 usually means the track has the wrong role or the wrong sound.

Left and right

Pan places a track between the left speaker (−1) and the right (1). Kick, bass, snare or clap and the lead stay in the middle; hats, percussion and other small parts spread out to the sides, which makes room in the centre:

blank("house");
tempo(120);
track("kick",   s("bd*4"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));
mix("hats",   #{ pan: 0.2 });
mix("shaker", #{ pan: -0.3 });

Listen on headphones: the hats tick slightly to the right, the shaker to the left.

Space: reverb and delay

Reverb is the sound of a room: the reflections that make a sound seem far away. Delay is a distinct echo. Each track sends some of itself to the song’s reverb and delay, from 0 (none) to 1 (a lot):

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").legato(0.5));
mix("chords", #{ reverb: 0.3 });

Short, plucky sounds (stabs, melodies) and pads like reverb; kick and bass sound best dry, close and solid. Too much reverb on everything makes a mix sound washed out and far away.

Ducking under the kick

In dance music, the bass and chords get quieter for a split second every time the kick hits, then swell back. This is called sidechain ducking, and it gives the kick room and the whole track a pumping, breathing feel. Each track has a duck amount from 0 (none) to 1 (the track nearly vanishes on every kick):

blank("house");
tempo(120);
key("A minor");
prog("A", "Am F C G");
bars_per_chord(1);
track("kick", s("bd*4"));
track("pad",  chord("prog").s("pad").role("pad"));
mix("pad", #{ duck: 0.7 });

Listen for the pad pulsing with the kick. Pattern tracks start at 0.3, which you hear as a gentle movement; 0.5 is clearly pumping, 0.8 is the exaggerated pump of future bass.

Listening to one thing

While mixing, it helps to hear one track alone. solo() plays only the soloed tracks, mute() silences one:

blank("house");
tempo(120);
key("A minor");
track("kick", s("bd*4"));
track("bass", note("<a1 f1 c2 g1>").struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));
solo("kick");
solo("bass");

This renders only the kick and the bass, so you can hear whether they fit together. Remove the solo() lines before your final render; the critic judges only what plays.

Try this

  • Turn the melody up 2 dB and down 2 dB, rendering each time. Which one lets you hear the chords?
  • Give the bass duck: 0 and then duck: 0.6, and listen to the low end with the kick.
  • Put a lot of reverb on the clap (reverb: 0.5) and hear it move back into a big room.

The song so far

The mix lines go at the end of the script, after form():

blank("house");
title("First Light");
tempo(120);
key("A minor");
prog("A", "Am F C G");
prog("B", "F G Am Am");
bars_per_chord(1);

track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));
track("roll",   s("<sd*2 sd*4 sd*8 sd*16>").gain("<0.5 0.65 0.8 1>"));
track("bass",   chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").legato(0.5));
track("pad",    chord("prog").s("pad").role("pad"));
track("melody", n("<[4 ~ 2 ~ 0 ~ 2 4] [5 ~ 4 ~ 2 ~ ~ ~] [4 ~ 2 ~ 4 ~ 6 4] [6 ~ 4 ~ 3 ~ ~ ~]>")
                  .octave(4).s("pluck").delay(0.2));

form([
  sec("intro", 8, "kick hats pad").filter_in(),
  sec("groove", 16, "kick clap hats shaker bass chords"),
  sec("break", 8, "pad chords"),
  sec("build", 4, "clap hats pad roll melody").gap(),
  sec("drop", 16, "kick clap hats shaker bass chords pad melody").impact(),
  sec("outro", 8, "kick hats bass"),
]);

mix("hats",   #{ pan: 0.2 });
mix("shaker", #{ pan: -0.3 });
mix("bass",   #{ duck: 0.5 });
mix("chords", #{ reverb: 0.25, duck: 0.4 });
mix("pad",    #{ level: -3, reverb: 0.4 });
mix("melody", #{ reverb: 0.3 });

Mixing functions has every setting and the loudness of every role.

Listening, judging, finishing

Your song has every layer, a structure and a mix. This page is about the part producers spend most of their time on: listening critically, finding what is wrong, and fixing it until the song is done.

Render the whole song

Save the song from the mixing page as song.rhai and render it:

claudius script song.rhai

This is what claudius printed for it:

track kick: bd
track clap: cp
track hats: hh
track shaker: sh
track roll: sd
track bass: sub_bass
track chords: epiano
track pad: pad
track melody: pluck
ears loaded in 3.6 s
First Light — house at 120 BPM in A minor, 60 bars (2:00)
  progression A: i VI III VII
  progression B: VI VII i i
  form: intro 8 | groove 16 | break 8 | build 4 | drop 16 | outro 8
  tracks: kick (synth kick), clap (synth clap), hats (synth closed_hat), shaker (synth shaker), roll (synth snare), bass (synth patch 'sub_bass'), chords (synth patch 'epiano'), pad (synth patch 'pad'), melody (synth patch 'pluck'), crash (synth crash), riser (synth riser), impact (synth impact), downlifter (synth downlifter), reverse_crash (synth reverse_crash)
  master: -10.0 LUFS, true peak -1.0 dBTP (pre-master -10.2 LUFS); done in 12.8 s
  ears: 'house music' z +3.4 (closest confusion 'techno music' +3.1); production z +1.2 vs 'a low quality recording with hiss' +0.7; p_real 0.47
        sounds like: house music, tech house music, techno music, drum and bass music
  verdict: 87/100 (arc 0.80, genre 0.80, mix 0.99, production 0.63, theory 1.00). Fix first: dull 4-8 kHz: hats, claps and snare lack bite (presence -26.4 dB, healthy from -26)
  wrote out/house-first-light-1/song.mp3

Line by line:

  • track …: each track and the sounds it found.
  • ears loaded: claudius loaded its listening models (the first run downloads them; later runs take a few seconds on an idle machine, longer on a busy one).
  • First Light: title, style, tempo, key, length.
  • progression: your chords, written as Roman numerals.
  • form: your sections and their lengths.
  • tracks: every track and what plays it. The last five are the transition sounds your section flags asked for: the riser in the build, a reversed cymbal swelling into the drop, and a crash, an impact and a falling “downlifter” on the drop’s first beat.
  • master: how loud the finished song is. claudius makes it as loud as songs in the style usually are.
  • ears and sounds like: what the listening model hears. More below.
  • verdict: the critic’s score, and what to fix first.

Listen before you read

The score is useful, but your ears come first. Listen to the whole song once without stopping, on the best speakers or headphones you have, then on something small (a phone or a laptop). Note anything that bothers you: a part you can’t hear, a part that is too loud, a moment that drags. Then read the verdict and see whether it agrees.

The verdict

The critic listens in three ways and gives each a score from 0 to 1:

  • mix: measurements of the finished audio. Is it as loud as it should be, without distortion? Is the sound balanced from deep bass to bright treble? Is it wide enough, and is the bass centred?
  • arc: does the song get louder where it should? It compares the loudness of each section with its energy, and checks that the drop is clearly louder than the break.
  • theory: the notes. Is the melody in the key? Are its strongest notes part of the chords? Does the bass play the chords’ roots when they change?

When the listening models are loaded (they are by default), two more:

  • genre: does it sound like the style you chose, more than the styles it is usually confused with?
  • production: does it sound like a professionally produced record, more than like a cheap or broken recording?

With --no-ears, or on a computer the listening models cannot run on (claudius then says earshot is unavailable), the critic judges with the first three only, and the score is out of those.

The total out of 100 combines them. The Fix first list names the problems that cost the most, with numbers and a hint. Ours has one:

  • dull 4-8 kHz: hats, claps and snare lack bite (presence -26.4 dB, healthy from -26). The bright, crisp range where hats and claps live is a little quiet compared with the rest. The fix is in the hint: turn the hats and clap up.

The ears line says the song reads as house (z +3.4) a little more than as its closest confusion, techno (z +3.1). The genre model’s readings are hints, not rules: two styles that share a tempo or a drum sound often sit close together for it.

Fix and render again

One change for the one problem: the hats and the clap 2 dB louder.

blank("house");
title("First Light");
tempo(120);
key("A minor");
prog("A", "Am F C G");
prog("B", "F G Am Am");
bars_per_chord(1);

track("kick",   s("bd*4"));
track("clap",   s("~ cp ~ cp"));
track("hats",   s("[~ hh]*4"));
track("shaker", s("sh*16").gain(0.4));
track("roll",   s("<sd*2 sd*4 sd*8 sd*16>").gain("<0.5 0.65 0.8 1>"));
track("bass",   chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").legato(0.5));
track("pad",    chord("prog").s("pad").role("pad"));
track("melody", n("<[4 ~ 2 ~ 0 ~ 2 4] [5 ~ 4 ~ 2 ~ ~ ~] [4 ~ 2 ~ 4 ~ 6 4] [6 ~ 4 ~ 3 ~ ~ ~]>")
                  .octave(4).s("pluck").delay(0.2));

form([
  sec("intro", 8, "kick hats pad").filter_in(),
  sec("groove", 16, "kick clap hats shaker bass chords"),
  sec("break", 8, "pad chords"),
  sec("build", 4, "clap hats pad roll melody").gap(),
  sec("drop", 16, "kick clap hats shaker bass chords pad melody").impact(),
  sec("outro", 8, "kick hats bass"),
]);

mix("hats",   #{ pan: 0.2, level: 2 });
mix("clap",   #{ level: 2 });
mix("shaker", #{ pan: -0.3 });
mix("bass",   #{ duck: 0.5 });
mix("chords", #{ reverb: 0.25, duck: 0.4 });
mix("pad",    #{ level: -3, reverb: 0.4 });
mix("melody", #{ reverb: 0.3 });

The new verdict:

  ears: 'house music' z +3.4 (closest confusion 'techno music' +3.1); production z +1.2 vs 'a low quality recording with hiss' +0.7; p_real 0.47
        sounds like: house music, tech house music, techno music, drum and bass music
  verdict: 87/100 (arc 0.80, genre 0.79, mix 1.00, production 0.64, theory 1.00)

The mix score went from 0.99 to 1.00, and the critic has nothing left to fix first. The total stays at 87: it weighs all five scores, and the mix is only one of them. That is a typical round: a small change, a point or less, and a problem gone.

Knowing when to stop

A score in the high 80s means the critic found no big measurable problem. It does not mean the song is good; it has no taste, only measurements. Some things it cannot tell you: whether the melody is catchy, whether the drop is exciting, whether the song is too long. So:

  • Fix what the critic finds when you can hear the problem too.
  • Ignore a suggestion that makes the song worse to your ears. The genre model, in particular, is a hint.
  • Stop when the song does what you wanted and nothing bothers you on three different speakers.

As an example of the critic’s limits: the same song played on a real 909 drum machine with a sampled piano and strings (.bank("tr909"), .s("piano"), .s("string_ensemble")) scores four points lower than the version with synthesizers, because the genre model hears it as closer to drum and bass. Whether it sounds better is your call.

Keep and share it

  • The audio: song.mp3 and song.wav in the song’s folder are the finished, mastered song.
  • The script: song.rhai in that folder is the song as claudius prints it, which you can read and edit. Your own song.rhai stays the clearest description of what you made.
  • The rest: blueprint.json is the song in full detail, verdict.json the critic’s whole report.

To see your song as claudius describes it, print it instead of rendering: claudius script song.rhai --print. You will find your progressions as Roman numerals and your tracks exactly as you wrote them.

Where to go next

  • The studio: the same song in a window, with a step sequencer, a mixer and the verdict updating as you edit.
  • Working with an assistant: ask Claude or another assistant to make and fix songs with you.
  • The cookbook: complete songs in eight styles, with every choice explained.
  • For producers: the same ideas in more depth, once you are comfortable with these.

claudius for DAW users

If you work in Ableton, Logic, FL Studio or Bitwig, most of claudius will be familiar: tracks, an arrangement in sections, a mixer with sends and a sidechain, a master chain with a limiter. What differs is how you edit them. There is no free timeline of clips: the arrangement is a grid of sections and tracks (the studio lets you drag sections and paint which tracks play in each), and the notes come from patterns and parts. You describe the song (in a script, in the studio’s panels, or through an assistant), claudius arranges, renders and judges it, and you listen and revise. A render of a three-minute song takes 10 to 40 seconds.

Where things are

in a DAWin claudius
projecta song: its blueprint (blueprint.json, the editable description) and the project it arranges into (project.json, notes and clips on a timeline)
arrangement viewthe form: sections in order, each listing the tracks that play in it
clip or regiona track in a section; it plays from the section’s first bar
MIDI clip and piano rolla pattern (note(), n(), chord()), or a part the theory engine writes
drum rack and step sequencera drum lane with step strings and named variants, or an s() pattern
instrumenta sound: a synth preset, a sampled instrument, a drum kit, an audio file
mixer channelmix(): level, pan, two sends, sidechain depth, mute, solo
channel insertsfilters, bitcrusher and saturation on pattern tracks; the genre’s chains elsewhere
groups and busesfour fixed buses: drums, bass, music, fx
return tracksone reverb and one delay return, set by the genre
sidechain compressorduck on each track, keyed from the kick
master chain and limiterthe genre’s master chain and a loudness stage aimed at a LUFS target (master())
automationsection flags: a lowpass opening in an intro, a highpass sweep in a build, a lowpass closing the outro
markerssection names
groove templatesswing() (sixteenth swing) and humanize()
exportsong.wav (24-bit, 48 kHz), song.mp3, and stems with --stems
undo historyundo and redo in the studio; every song also records its lineage of edits

There is one tempo, one key and one time signature (4/4) per song. There is no MIDI input, MIDI export or live recording.

The same groove, two ways

A house groove programmed in a step sequencer:

blank("house");
tempo(124);
drum("kick", "X...X...X...X...");
drum("clap", "....X.......X...");
drum("hat",  "..x...x...x...x.");
drum("hat", "sparse", "......x.......x.");

And in pattern form:

blank("house");
tempo(124);
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4"));

They sound alike but behave differently. Drum lanes are what the generator writes: they have named variants that sections switch between (main, sparse, alt), and the arranger rewrites them for builds (a snare roll, the kick dropping out) and phrase-end fills. Pattern tracks are never rewritten; they give you the whole pattern language (alternation, euclidean rhythms, randomness, sampled kits such as tr909:bd), and you write the variation yourself. To put a drum lane on a recorded kit, drum_sound("kick", "tr909:bd") swaps its sound and keeps its pattern. Most of the cookbook uses patterns.

Levels are relative

A DAW fader is an absolute gain. In claudius every track has a role (kick, bass, pad, lead …), every role has a target loudness, and each track is gained to its target while it plays. level is an offset from that target. A pad at level: -3 sits 3 dB below where a pad normally sits, whatever its patch or velocity, and adding a track does not change the balance of the others.

The consequence: gain staging is done for you, and the first mix decision is the role. A track’s role comes from its sound: drums and percussion find theirs, a bass preset or a low line is bass, a chord pattern is chords, and anything else melodic is treated as a lead. Set .role("pad") or .role("arp") on pattern tracks that are not leads.

Sections replace clips

A DAW lets every clip differ. In claudius a track plays the same material in every section it is in, starting from the section’s first bar: an alternation starts again from its first item, every(4, ...) counts from the section, the progression starts on its first chord. To vary a part in one section, make a second track and put it only there:

blank("house");
tempo(124); key("A minor"); prog("A", "Am7 Fmaj7 Dm7 Em7"); bars_per_chord(1);
track("drums",  s("bd*4, [~ cp]*2, [~ hh]*4"));
track("keys",   chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano"));
track("keys16", chord("prog").struct("x*16").legato(0.4).s("epiano"));   // the busy version, drop only
form([sec("groove", 16, "drums keys"), sec("drop", 16, "drums keys16")]);

Harmony is written once

A DAW has no idea what key you are in. claudius does: the song has a key and named progressions in Roman numerals (prog("A", "i7 VImaj7 iv7 v7")), sections choose a progression, and chord patterns, generated parts and the critic all read it. Write chord("prog") and the chords follow whatever progression the section plays; change the key and everything written in numerals or scale degrees moves with it. See Harmony.

The loop you work in

  1. Write or change the song: a script, an edit in the studio, or a request to an assistant.
  2. claudius arranges and renders it (10 to 40 seconds for a full song), then judges it.
  3. Listen. Read the verdict: scores for mix, energy arc, theory, genre and production, with each issue naming what to change.
  4. Revise, or let evolution try variations for you.

Every song prints as a script (Songs as scripts), so whatever produced it (the generator, the studio, an assistant), you can read it and edit it as text.

Harmony

claudius knows the song’s key and its chord progressions, and everything harmonic reads them: chord patterns, the parts the theory engine writes, arpeggios, the bass check of the critic. This page covers how to write harmony so that all of those agree, and exactly how claudius interprets it. The full rules for symbols and numerals are in Pitch.

Key and mode

A song has one key, in one of seven modes: major, minor (aeolian), dorian, phrygian, lydian, mixolydian, harmonic minor. Roman numerals are counted in the key’s own mode, so the same numeral changes quality with the mode:

numeralA minorA dorianA phrygianA harmonic minor
IIBBB♭B
IVDDDD
ivDmDmDmDm
VEEEE
VIFF♯FF
VIIGGGG♯

Upper and lower case only choose major or minor; they never move the root. IV in A minor is a D major chord (borrowed from dorian) on the fourth degree, iv the diatonic D minor. Accidentals move the root: bVII in C major is B♭, bVI is A♭.

Writing a progression

blank("deep_house");
key("F minor");
prog("A", "Fm9 Bbm9 Dbmaj7 Cm7");     // stored as i9 iv9 VImaj7 v7
prog("B", "Dbmaj7 Eb Fm9 Fm9");
bars_per_chord(1);
track("keys", chord("prog").struct("x ~ ~ x ~ ~ ~ ~").voicing(53, 72).s("epiano"));
form([sec("groove", 8, "keys"), sec("break", 8, "keys")]);

Chord names are converted to numerals in the key that is current when prog() runs, then stored as numerals. Set the key first; a later key() transposes the progression (and changes chord qualities if the mode changes, see below).

Progressions have names. Sections play A by default and breaks B (or A, when the song has no B); any other name works with sec(...).prog("verse"), and a section that asks for a progression the song does not have is an error. Every progression uses the same bars_per_chord(), the number of bars each chord lasts. A progression starts on its first chord at the start of every section and loops.

What numerals can express:

  • diatonic triads and sevenths by degree and case: i7 ii° III iv7 v7 VImaj7 VII;
  • extensions: 9, add9, 6, maj7, maj9, 11 (always minor 11), sus2, sus4;
  • borrowed chords with accidentals: bVI bVII in major, IV (dorian) or V7 (harmonic) in minor;
  • applied chords: V/V, V7/ii, viio7/V, read in the key of the target chord;
  • a bass note: I/E, VI/A, or as a name, F/A (stored as VI/A in A minor). .root(), the generated basslines and the critic use it, and key() moves it with the chord.

All of these work in pattern strings too: chord("<I V7/V V7 I>"), chord("<Am F/A C G>").

Chord patterns

chord("prog") plays the section’s progression; chord("prog:B") always plays B; chord("<Am7 Fmaj7>") plays the named chords regardless of the song’s progressions. Prefer prog: the arranger’s chord track, the generated parts and the critic all use the song’s progressions, so a pattern with its own chord names can disagree with all of them.

Every chord event is voiced with voice leading (see Voicing):

  • three voices for triads, four for sevenths and anything larger; the fifth goes first when there are too many notes, then the root;
  • close voicings (within about an octave and a half), placed in the range given by .voicing(lo, hi) (default 52..74, E3 to D5);
  • each chord chosen to move the voices as little as possible from the previous one, the first chord of a section near the middle of the range.

There is no drop-2 or spread voicing for patterns, and no control over inversions beyond the range. A narrow range forces inversions: .voicing(60, 72) keeps every chord inside one octave above middle C.

Rhythm comes from the events: .struct("x ~ ~ x ~ ~ x ~") for a tresillo stab, "x*16" with a short legato for a pumping sixteenth chord, .arp("updown") for an arpeggio. Layering two tracks on chord("prog") with different ranges and rhythms (a pad low and long, stabs higher and short) keeps them in the same harmony automatically.

Bass lines

Generated bass parts follow the progression and the kick (see the bass styles of part()). A pattern bass follows the progression with .root(), which plays each chord’s root (or its slash bass) in octave 2:

blank("techno");
key("F phrygian");
prog("A", "i i II i");
bars_per_chord(2);
track("bass", chord("prog").root().octave(1).struct("[~ x x x]*4").s("sub_bass").legato(0.6));

.octave(1) puts the roots an octave lower: F1 for four bars, G♭1 for two, F1 for two. Change the progression and the bass follows. When the line should move by step or leap to a different octave, write the notes out instead: note("<f1!4 gb1!2 f1!2>") plays the same roots, one per bar.

On a blank song, part() adds the genre’s bass part over your progression: part("bass", #{ style: "rolling" }).

The critic checks that the bass plays the chord’s root (or its slash bass) on at least 70 % of the chord changes it plays on; a bass that plays offbeats only is not checked.

Changing key

key() moves everything written relatively: numerals, n() degrees, generated parts. Note names in note() patterns are absolute and stay. When the mode changes, every diatonic chord keeps its degree and takes the new mode’s quality: Imaj7 vi7 ii7 V7 in E major becomes i7 VImaj7 iiø7 v7 in F minor. Borrowed (bVII) and applied (V/V) chords are kept as written.

The generator’s harmony

song(genre, seed) picks a harmonic style from the genre’s profile, or writes a progression with a functional-harmony Markov chain (tonic, subdominant and dominant degrees, no chord repeated twice in a row, ending on a chord that leads back to the start). The styles:

stylemodeexample progressions
minor_epicminori VI III VII, i VII VI V, i VI III VII i VI iv V
minor_darkminori i VI VII, i VI iv V, i VI bII V
minor_soulminori7 iv7 VII7 IIImaj7, iiø7 V7 i7 i7, i7 IV9 VImaj7 V7
dorian_vampdoriani7 IV7, i7 IV9 i7 VIImaj7, i7 ii7 i7 IV7
phrygianphrygiani II, i II i VII, i II III II
harmonicharmonic minori iv V i, i VI iv V, i VI ii° V
minimalminori, i i i VI, i i iv iv, i9 i9 i9 VII
major_popmajorI V vi IV, I iii IV iv, I V/vi vi IV, I bVI bVII I, I V vi iii IV I IV V
major7_jazzmajorImaj7 vi7 ii7 V7, Imaj7 VI7 ii7 V7, IVmaj7 iv7 iii7 VI7, ii9 bII7 Imaj9 Imaj9
minor_80sminori VI III VII, i VII VI VII, i VII VI iv
mixolydianmixolydianI VII IV I, I VII, I v IV I

Some bend the rules as songs do: a minor fourth borrowed into a major key (I iii IV iv), a secondary dominant (V/vi, VI7), the flat sixth and seventh into the tonic (I bVI bVII I), a tritone substitute (bII7), the Neapolitan (bII), a major dominant in a minor key (i VII VI V).

A generated song bends them a little more:

  • an answered loop: four times in ten a four-chord progression A (B a quarter of the time) plays the loop and then the loop again, ending the second time another way back to its first chord: its dominant, a chord borrowed from the parallel mode, the flat sixth and seventh, or a suspension, and half the time with one chord in between coloured (a seventh, a ninth or a suspension, all with the key’s own notes). i7 IV9 i7 VIImaj7 becomes i7 IV9 i7 VIImaj7 i7 IV9 i7 V7. A loop is answered only when its eight chords last 16 bars or less, so that a section hears all of them;
  • a chorus of its own: in a song with verses and hooks, about a third of the time the hooks play progression C, another progression of the style or a substitution of A, while the verses keep A.

Progression B is another progression of the same style or a substitution of A. Evolution changes harmony with these substitutions, each recorded in the song’s lineage: a chord a third away, an extended or plain version, a secondary dominant before a chord, a chord borrowed from the parallel mode, a suspension, two chords swapped, the progression rotated. An extended chord takes the key’s own seventh (a dominant seventh on the fifth, never a major seventh), and a suspension is made only when its notes are in the key.

What the critic checks

The theory score reads the arranged song, not the audio:

checkpasses when
melody in key95 % of the lead’s notes are in the key, or in the chord sounding with them (a borrowed chord’s third, an applied dominant’s leading note)
chord tones on strong beats60 % of the lead’s notes on beats 1 and 3 are tones of the chord sounding there
rangethe lead spans 19 semitones or less
leapsat most 20 % of the lead’s moves (between notes less than two beats apart) are larger than a fifth
bass on the roots70 % of the bass notes that start on a chord change are the chord’s root
voice leadingin chord, pad and keys tracks, voices move 4.5 semitones or less per change on average

“The lead” is the first track whose role is lead, and “the bass” the first whose role is bass; the chords are the song’s progressions, as the arranger lays them out. That is why chord("prog") and .role() matter: a melody checked against the wrong chords, or a pad checked as a melody, costs points for no musical reason.

Rhythm and groove

Rhythm in claudius has three layers: where notes sit (patterns and step strings), how hard they are played (velocity), and how the grid is bent when the song renders (swing and humanize). This page gives the exact behaviour of each and the idioms that come out of them.

The grid

Pattern time is continuous: a cycle is one bar, and mini-notation divides it however you like. Common subdivisions:

feelmini-notationstep string
quartersbd*4x...x...x...x...
eighthshh*8x.x.x.x.x.x.x.x.
sixteenthshh*16xxxxxxxxxxxxxxxx
offbeat eighths[~ hh]*4..x...x...x...x.
eighth tripletshh*1212 steps per bar: drum("hat", "main", "xxxxxxxxxxxx", 12)
sixteenth tripletshh*2448 steps per bar, every second step
thirty-secondshh*3232 steps per bar

Drum lanes (drum()) are a step grid with 16 steps per bar by default, or any resolution from 1 to 96. When a lane prints as a script, it uses 16 steps if every hit sits on a sixteenth, then 32, then 48.

Velocity

wherehow
step stringsX 1.0, x 0.8, o 0.45 (ghost), 1 to 9 for 0.1 to 0.9
patterns.gain() or .velocity(), per event: .gain("[0.5 0.3 0.9 0.3]*4")
defaults0.9 for sound patterns, 0.8 for pitched patterns

Velocity drives level and tone the way the instrument does. Synthesized drums and audio files scale level by velocity to the power 1.6 (0.5 is about 10 dB below 1.0); the sampled kits switch velocity layers (the 909 has eleven) as well; synth presets open their filters. The track as a whole is then levelled to its role’s target, so velocity shapes the groove, not the track’s loudness.

A sixteenth hat with accents on the off-beat eighths and soft ghosts between:

blank("house");
tempo(124);
track("hats", s("hh*16").bank("tr909").gain("[0.35 0.2 0.8 0.2]*4"));

Swing

swing(amount) is sixteenth-note swing for the whole song:

  • each off-beat sixteenth (the second of each pair inside an eighth note) moves to amount of the way through the eighth; 0.5 is straight, 0.66 is a triplet feel; the range is 0 to 0.8, and up to 0.501 is straight;
  • only notes within 0.01 beats of a sixteenth grid position move, so eighth notes, triplets and notes nudged with .late() are untouched;
  • it applies at render to every track: drum lanes, parts and pattern tracks alike.

The genres’ generated swing ranges are a good guide: house 0.50–0.56, deep house 0.53–0.58, lofi 0.56–0.63, trap 0.50–0.54, techno 0.50–0.52, drum and bass 0.50–0.51, future bass 0.50–0.53, synthwave straight.

Since swing is global, a part that should sit straight in a swung song has to avoid off-beat sixteenths (use eighths or triplets), and a part that should lag can use .late(0.01) to .late(0.03), which also takes it off the grid that swing moves.

Humanize

humanize(amount) adds random timing and velocity at render:

  • timing: a normal distribution with a standard deviation of 4 ms × amount on drum roles, 2.4 ms × amount on others (synth tracks: 3 ms and 1.8 ms);
  • velocity: ±5 % × amount (one standard deviation);
  • seeded by the song and the track name, so every render is the same.

Generated songs use 0.25 in house, 0.35 in deep house, 0.6 in lofi, 0.15 in trap and 0.1 elsewhere. blank() keeps the genre’s value.

Idioms

Ghost notes are low-velocity hits between the main ones. In a step string, o; in a pattern, a quiet layer in a stack(), since a gain pattern applies by time and would turn down the backbeat too:

blank("lofi");
tempo(86); swing(0.6);
track("snare", stack([s("~ sd ~ sd").gain(0.9), s("~ ~ ~ [~ sd] ~ ~ [~ sd] ~").gain(0.3)]).bank("acoustic"));

Rolls are fast repeats inside one beat. Write the bar beat by beat, with the roll in the beat that has it:

blank("trap");
tempo(140);
track("hats", s("<[hh*2 hh*2 hh*2 hh*2] [hh*2 hh*2 hh*2 hh*6] [hh*2 hh*2 hh*2 hh*2] [hh*2 hh*4 hh*2 hh*8]>")
                .bank("tr808").gain("[0.9 0.6]*4"));

Bar 2 ends with a sixteenth-triplet roll (six in a beat), bar 4 with thirty-seconds. Generated trap hats get rolls from the drum grammar instead: random beats replaced by bursts of thirty-seconds or triplets with a rising or falling velocity ramp, most often on the last beat of a bar and rarely on the first.

Euclidean rhythms spread k hits over n steps as evenly as possible, which gives most of the world’s clave-like patterns: (3,8) is the tresillo (x..x..x.), (5,8) the cinquillo (x.xx.xx.), (5,16) and (7,16) are good percussion lines over a four-on-the-floor kick. A third number rotates the rhythm left by that many steps (see Euclidean rhythms).

blank("techno");
tempo(130);
track("kick", s("bd*4").bank("tr909"));
track("rim",  s("rim(5,16,2)").bank("tr909").gain(0.6).pan(0.3));
track("perc", s("cb(3,8,1)").gain(0.4).pan(-0.3));

Polymeter. There is no { } polymeter, but a fractional fast() runs a short figure across bar lines. A three-step figure on a sixteenth grid is three sixteenths long, so it repeats 16/3 times per bar:

blank("techno");
track("perc", s("rim ~ ~").fast(16.0 / 3.0).gain(0.5));   // lands one sixteenth earlier each bar

It restarts with every section, like every pattern.

Kick and bass together. A bass that plays exactly with the kick uses the kick’s rhythm as its structure. Keep the rhythm in a variable so the two cannot drift apart:

blank("trap");
tempo(140); key("C minor");
let kick = "x ~ ~ ~ ~ ~ ~ x ~ ~ x ~ ~ ~ ~ ~";
track("kick", s("bd").struct(kick).bank("tr808"));
track("808",  note("<c2!2 ab1!2 f1!2 g1!2>").struct(kick).s("808").legato(1.0));

Generated parts do the same with the kick_follow bass style, which plays on every kick of the main kick pattern.

Drum lanes in the arrangement

Drum lanes change with the sections they play in:

  • each section plays the lane’s variant it asks for (main, sparse, alt, half …), or main when the lane does not have it; intros and outros ask for sparse;
  • fills() replaces the last one or two beats of every 8-bar phrase on the snare (or clap) lane with a fill, and sometimes drops the kick for the last half beat;
  • build() turns the snare (or clap) lane into a snare roll for the second half of the build and drops the kick for its last bar.

Form and sections has the exact rules. Pattern tracks are never rewritten; make fills with lastOf() and builds with a track that only plays in the build:

blank("house");
tempo(124);
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4").bank("tr909").lastOf(8, |x| x.ply(2)));
track("roll",  s("<sd*2 sd*2 sd*4 sd*4 sd*8 sd*8 sd*16 sd*16>").bank("tr909")
                 .gain("<0.4 0.45 0.5 0.55 0.65 0.75 0.85 1>"));
form([sec("groove", 16, "drums"), sec("build", 8, "roll").gap(), sec("drop", 16, "drums").impact()]);

The generator’s grooves

Generated drum lanes come from each genre’s drum grammar: for every lane, a probability of a hit on each sixteenth step (1.0 always hits), a velocity range scaled by the metrical weight of the step, a chance of ghost notes, a chance of rolls, and a chance that the last bar of the 4-bar pattern varies. Some lanes use a euclidean rhythm instead (house percussion is a rotated (5,16)). The same seed gives the same grooves; mutation edits single hits, nudges them by a sixteenth, re-accents them or regenerates a lane.

Sounds, samples and sound design

claudius plays two kinds of audio: sounds synthesized in code and sounds that were recorded. There is no General MIDI and no neural audio generation; a note is only ever the score that plays one of these sounds. This page covers where each comes from, how genres choose them, and how much of them you can shape. The names you can use are in the Sounds reference.

Synthesized

Drum voices. Thirteen drum circuits rendered in code: kick, snare, clap, closed and open hats, ride, crash, tom, rim, shaker, cowbell, snap and a tuned percussion voice. Each has nine parameters: tune, decay, tone, punch, snap, drive, pitch-envelope depth and time, and room. The generator draws them from the genre’s ranges (a house kick decays in 0.32–0.55 s with 3–8 dB of drive) and, in genres that ask for it, tunes the kick’s fundamental to the tonic or fifth of the key. A variation (bd:3) moves the voice a few steps through its parameters.

The synth engine. Oscillators with polyBLEP anti-aliasing (saw, square, pulse, triangle, sine), unison with per-voice analog drift, a sub oscillator and noise, FM with a tine component for electric pianos, state-variable and ladder filters with an envelope, key tracking and velocity, an LFO for vibrato, filter and amplitude (free or tempo-synced), glide, mono and legato modes, and drive. Twenty factory presets cover basses (sub_bass, 808, reese, acid, wobble …), keys (epiano, keys, organ), pads, plucks, leads and bells. A generated part takes a copy of a preset with its cutoff and detune varied a little; evolution tweaks cutoff, resonance, release, drive and detune further.

Transitions. Risers, downlifters, impacts, reverse crashes and filter sweeps are rendered at the length the arrangement asks for, with the riser pitched to the key. The crash is a drum voice or a recorded one-shot.

claudius sounds renders every drum voice, preset and transition into out/sounds/ for auditioning.

Recorded

Sample packs. Multi-sampled instruments and drum machines under licences that allow making and publishing music with them. claudius-packs install --defaults installs 22 packs (a 3.2 GB download, 1.6 GB on disk):

packwhatlicence
salamanderYamaha C5 grand pianoCC BY 3.0
epianosWurlitzer, CP80, PianetCC BY 3.0
jrhodesRhodes Mark Ifree for music
vsco2chamber orchestra: strings, brass, woodwinds, harp, timpaniCC0
vcslmallets, bowed vibraphone, wine glasses, pipe organ, sax, harmonica, a TX81Z FM synth, zithers, world percussion, effectsCC0
tr808, tr909, tr707Roland drum machinesCC0; free use; public domain
uzu, synthdrumselectronic drum kitsUnlicense; CC0
muldjordan acoustic drum kitCC BY 4.0
freepatsupright piano, organ, guitars, basses, synth pads and leads, glasses of water, a hangCC0
doublebass, growlybassupright and electric bassCC0
voicea sung vowel and a choirCC0
solocello, erhu, steelpana solo cello, an erhu, a steel panCC0; Unlicense
sonicpiSonic Pi’s one-shots, drones, vinyl, tabla and loopsCC0
body, zamenhofbody percussion; electronic glitch kitsCC0
miscellaniasound effects: sci-fi, metal, glass, chains, bells, glissandiCC0

The instruments have velocity layers and round robins (the Salamander piano has five layers; the 909 kick eleven layers and 126 variations). A song that plays a pack whose licence asks for attribution gets a credits.txt in its folder. claudius-packs list shows what is installed, claudius-packs audition renders every instrument, and claudius-packs add-map github:user/repo adds any Strudel sample map, recording its licence (or warning when it has none).

Apple Loops. When GarageBand or Logic content is installed, claudius finds it where Apple put it and uses it three ways: as one-shots cut from drum loops for the drum lanes of generated songs (each lane uses a recorded hit with a 75 % chance in claudius make), as texture loops (house’s top percussion loop), and, with --loops or song(genre, #{ loops: true }), as the backbone of a song built around one loop family: its chords, bass and beat, warped to the tempo and transposed to the key. Apple licenses the loops for use in your own music; claudius reads them in place and only caches the one-shots it cuts (in ~/Library/Caches/claudius). In patterns, s("bd sd").bank("apple") plays one-shots cut from them.

Your recordings. .s("/path/file.wav") plays a file as a sampler (pitch by playback speed, c4 as recorded). claudius chop song.mp3 cuts bar loops and drum one-shots from any recording into your library, and --find "a vocal chop" uses the ears to pull out moments that match a description. claudius make --sample file flips a recording into a new song: warped to the tempo, transposed to the key, re-sliced in half-beat pieces (or played straight) and placed in the high-energy sections. See Remaking a song from audio.

How genres choose sounds

Every genre profile lists, per part, the presets and instruments it may use, most preferred first where it matters: "rhodes|epiano" plays the sampled Rhodes when its pack is installed and the FM electric piano when not. Lofi reaches for Rhodes, upright bass, vibes and kalimba; house for 909s, organ basses, stabs and piano; trap for an 808, bells and pizzicato. Drum lanes are played on a recorded machine with a genre-specific chance (909 in 45 % of house songs and 50 % of techno songs, 808 in 60 % of trap songs, the acoustic kit in 30 % of lofi and drum and bass songs) and stay synthesized otherwise. With the packs or Apple Loops missing, those sounds fall back to synthesis and the rest of the song is unchanged: the same seed writes the same notes and drum patterns either way.

Shaping a sound

From a script you choose sounds; you do not edit them. What you can do:

  • pick a preset, an instrument, a kit or a file, per track;
  • play it differently: velocity, note length, register, glide (overlapping notes on mono presets);
  • process a pattern track with .hpf(), .lpf(), .crush() and .distort() (see Inserts), and place it with level, pan and the two sends;
  • swap a generated part’s preset with part("chords", #{ preset: "piano" }), which keeps its notes, and a drum lane’s sound with drum_sound("kick", "tr909:bd"), which keeps its pattern.

Synth patch parameters, drum voice parameters, bus chains and the master chain are set by the generator and the genre, and changed by mutation (patch tweaks, drum voice edits, moving a song’s drums to another kit). A filtered, crushed piano:

blank("lofi");
key("D minor"); prog("A", "Dm9 Gm9 Bbmaj7 A7"); bars_per_chord(1);
track("keys", chord("prog").voicing(50, 72).s("piano").lpf(2500).crush(10).room(0.3));

Sounds and the critic

The ears hear recordings and synthesis differently. Songs built only from synthesis read as less “professionally mixed” to earshot than songs with sampled instruments, and as more “computer-generated”. When the production score is low, swapping a synth part for a recorded instrument (piano, Rhodes, strings, a real drum machine) is usually the most effective change. The genre score responds to the genre’s signature sounds: a 909 for house and techno, an 808 for trap, a dusty kit and a Rhodes for lofi.

Arrangement and energy

The arrangement is the form: a list of sections, each with a kind, a length, an energy and the tracks that play in it. In the studio it is the grid of tracks against sections; in a script it is form(). The arranger then does what a producer does by hand: tiles the parts across their sections, switches drum variants, adds fills at phrase ends, rolls and risers into drops, crashes on downbeats, filter sweeps in intros and outros.

Forms by genre

The generator picks one of the genre’s forms and makes it the song’s own: sections a little longer or shorter, and sometimes a bridge, a third verse and chorus, a last chorus played twice, a lift into the first chorus, a cold start or a cold ending, a thinner first verse (A form and a mix of its own lists every change). The forms as the genres write them are a useful starting point for your own:

genreform (bars)
houseintro 16, groove 16, break 16, build 8, drop 32, break 8, drop 16, outro 16 (or a 64-bar form)
deep houseintro 16, groove 16, break 16, build 8, drop 32, outro 16
technointro 32, groove 32, break 16, build 8, peak 32, outro 16
trapintro 8, hook 16, verse 16, hook 16, verse 8, hook 16, outro 8
lofiintro 4, A 16, B 16, A 16, outro 8
drum and bassintro 16, build 16, drop 32, break 16, drop 32, outro 16
future bassintro 8, verse 16, build 8, drop 16, break 8, build 8, drop 16, outro 8
synthwaveintro 8, verse 16, chorus 16, verse 16, chorus 16, bridge 8, chorus 16, outro 8

song(genre, #{ short: true }) halves every section (to at least 4 bars), which is handy for sketching.

The tools for energy

Energy in a track comes from what plays, how dense it is, and the transitions between sections. claudius gives you:

  • layers: which tracks play in each section, the strongest tool;
  • drum variants: a lane’s sparse, main, alt or half pattern per section;
  • progressions: a break on progression B changes colour without changing key (a song without a B plays A there);
  • flags: filter_in (a lowpass opening across the section), build (riser, highpass sweep, snare roll, kick out for the last bar), gap (a beat of silence), impact (crash, impact, downlifter on the downbeat), fills (drum fills every 8 bars);
  • automatic touches: a crash every 8 bars in drops and hooks, and a lowpass closing over a final outro.

The exact rules (how long the roll is, which tracks a gap silences, where fills fall) are in What the flags do.

Energy values and the critic

Each section’s energy (0 to 1) is a statement of intent, and the critic holds you to it. It measures the master’s short-term loudness (3-second windows, every half second), takes the median of each section (skipping its first 1.5 seconds and last second), and checks:

  • that loudness rises and falls with energy: the correlation between the two across sections, which sets most of the arc score;
  • that the loudest drop or hook is at least 3 LU louder than the quietest break (aim for 3 to 7).

A low arc score means the energies and the layers disagree. The usual causes:

  • an intro with the full kick: drums are never filtered by filter_in, so an intro at energy 0.4 can be as loud as a groove at 0.65; give the intro fewer drum layers or a higher energy;
  • a build without a kick that is quieter than the break before it: either keep the kick until the build’s last bar (drum lanes do that by themselves), or give the build a lower energy;
  • a break that keeps the bass or the drums: the drop cannot be 3 LU louder than a break that is almost as full.

Building an arrangement

On a generated song, form() rewrites the arrangement with the song’s own tracks:

form([
  sec("intro", 16, "kick hat perc pad").filter_in(),
  sec("groove", 16, "kick clap hat ohat perc bass chords"),
  sec("break", 16, "pad chords lead").energy(0.3),
  sec("build", 8, "clap hat pad lead chords").gap(),
  sec("drop", 32, "*").impact(),
  sec("break", 8, "pad arp").build(),
  sec("drop", 16, "*").energy(1.0).impact(),
  sec("outro", 16, "kick hat perc bass"),
]);

The second break plays progression B (breaks do by default) and builds back into drop2 with a riser, a highpass sweep and a roll on the clap lane (this song has no snare lane). The two drops are named drop and drop2.

Smaller edits leave the rest alone:

section("drop", #{ bars: 32 });                  // a longer drop
section("break", #{ layers: "pad lead" });        // a sparser break
layer("groove", "shaker", true);                  // the shaker in the groove too
section("intro", #{ variant: "main" });           // the full drum patterns in the intro

Patterns in the arrangement

A pattern track plays its pattern from the first bar of each section it is in. It is not rewritten by builds or fills, so a song made of patterns arranges its own builds:

blank("house");
tempo(124); key("A minor"); prog("A", "Am7 Fmaj7 Dm7 Em7"); bars_per_chord(1);
track("kick",  s("bd*4").bank("tr909"));
track("hats",  s("[~ hh]*4").bank("tr909"));
track("clap",  s("~ cp ~ cp").bank("tr909"));
track("roll",  s("<sd*2 sd*2 sd*4 sd*4 sd*8 sd*8 sd*16 sd*16>").bank("tr909")
                 .gain("<0.4 0.45 0.5 0.55 0.65 0.75 0.85 1>"));
track("keys",  chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano"));
track("pad",   chord("prog").s("pad").role("pad"));
form([
  sec("intro", 8, "kick hats keys").filter_in(),
  sec("groove", 16, "kick hats clap keys"),
  sec("break", 8, "pad keys").energy(0.3),
  sec("build", 8, "hats clap roll pad").gap(),
  sec("drop", 16, "kick hats clap keys pad").impact(),
]);

The roll track only plays in the build, rising from half notes to sixteenths over its eight bars, and the build flag adds the riser and the highpass sweep. The break plays progression A, since this song has no B. Because the roll’s alternation starts from its first item in every section, it lines up with the build however long the sections before it are.

Length and phrasing

The critic expects a song of 90 to 330 seconds, and every section a whole number of 4-bar phrases; anything else costs form points. Fills fall every 8 bars from the start of a section, and drops and hooks crash every 8 bars, so sections of 8, 16 or 32 bars keep phrases, fills and crashes aligned.

Mixing and mastering

A claudius mix starts where an engineer’s first pass ends: every track at a sensible level for what it is, the kick ducking what should breathe, everything on a bus with glue, and a master landing on a loudness target under a true-peak ceiling. Your work is the second pass. This page explains the signal flow, the genre chains, and how to act on the critic’s mix report. The functions are in Mixing functions.

Signal flow

For every track, in this order:

  1. the sound plays its notes, with swing and humanize;
  2. its inserts run: the genre’s (a chorus on some pads, tape on lofi keys) or the pattern’s (.hpf() .lpf() .crush() .distort());
  3. it is measured while it plays and gained to role target + genre offset + level (limited to −40..+30 dB);
  4. it is ducked by the kick by duck;
  5. it is panned;
  6. it feeds its bus, and the reverb and delay returns by its sends.

Then each bus runs its chain, the buses and the returns (ducked 30 % by the kick) are summed, the master chain runs, and the loudness stage brings the result to the target.

Starting values

Roles first: a track’s role sets its level, and the critic’s theory checks read roles too (see Roles). Then these are reasonable starting points; the genre profiles use similar values for generated parts:

tracklevelducksends
bass00.45–0.65 (house, techno), 0 (trap 808 with its own kick pattern)none
chords, stabs0 to −20.35–0.45; 0.85 for a future-bass pumpreverb 0.2–0.35, delay 0.05–0.3
pad−2 to −40.4–0.5reverb 0.35–0.45
lead00.15–0.3reverb 0.25–0.35, delay 0.2–0.25
arp−20.3–0.4delay 0.25–0.3, pan ±0.15–0.2
hats, percussion00pan ±0.1–0.35, a little delay on percussion
clap, snare00reverb 0.15–0.3

Bus chains by genre

Besides what every song gets (a tanh saturator on the drums bus unless the genre already saturates there, the bass bus mono below 140 Hz, the music bus at width 1.25 and mono below 160 Hz), each genre has its own chains:

genredrumsbassmusic
housecompressor −12 dB, 2:1, 12/120 mshighpass 110 Hz
deep housecompressor −14 dB, 1.8:1highpass 100 Hz, high shelf −1.5 dB at 9 kHz
technocompressor −12 dB, 2.5:1, 10/100 ms; tanh saturationhighpass 130 Hz
trapcompressor −10 dB, 2:1, 8/90 mstanh saturation 3 dBhighpass 140 Hz
lofibitcrusher (11 bits, half rate, 35 %), lowpass 8.5 kHz, compressor −14 dB, 2.5:1highpass 90 Hz
drum and basscompressor −11 dB, 2.5:1, 8/90 mstube saturation 4 dBhighpass 140 Hz
future basscompressor −11 dB, 2.2:1highpass 130 Hz
synthwavecompressor −12 dB, 2:1highpass 110 Hz

The music bus highpass is why pads and chords never fight the bass: anything on the music bus below 90–140 Hz is gone. Give a part the bass role (and so the bass bus) only if it is the bass.

The master

genremaster chaintarget
househighpass 25 Hz, high shelf +1 dB at 10 kHz; compressor −10 dB, 1.6:1; tape saturation−10 LUFS
deep househighpass 25 Hz; compressor −11 dB, 1.5:1; tape saturation−11
technohighpass 28 Hz; compressor −10 dB, 2:1; tanh saturation 3 dB−9
traphighpass 24 Hz; compressor −9 dB, 1.8:1; tanh saturation−9
lofihighpass 30 Hz, high shelf −2.5 dB at 8 kHz; tape (wow, flutter, lowpass 11 kHz); vinyl crackle and hiss; compressor −14 dB−12.5
drum and basshighpass 26 Hz; compressor −9 dB, 2:1; tanh saturation−8.5
future basshighpass 26 Hz, high shelf +1.5 dB at 10 kHz; compressor −9 dB, 1.8:1; tanh saturation−9
synthwavehighpass 25 Hz; compressor −11 dB, 1.6:1; tape saturation−10.5

After the chain, the loudness stage searches for the input gain that lands the song on the target (within 0.15 LU), through a soft clipper 0.1 dB under the ceiling and a limiter 0.5 dB under it, then trims if the true peak is still over. master() changes the target (−24 to −5 LUFS) and the ceiling (−3 to −0.1 dBTP, default −1).

Reading the mix report

The critic measures the master and reports each problem as an issue with its numbers. The mix score starts at 1 and loses a little for each:

checkhealthyissue text begins
loudnesswithin 1 LU of the targetloudness -11.6 LUFS, target -10.0
true peakat most 0.1 dB over the ceilingtrue peak -0.6 dBTP over the -1.0 ceiling
sub, 20–60 Hz−14 to −4 dB of the totaltoo much sub (boomy) / not enough sub
low, 60–250 Hz−7 to −1 dBthe low end is too heavy / a thin low end
low mids, 250 Hz–1 kHz−12 to −4 dBmuddy 250 Hz-1 kHz / hollow low mids
mids, 1–4 kHz−18 to −8 dBboxy or harsh mids / recessed mids
presence, 4–8 kHz−26 to −15 dBharsh 4-8 kHz / dull 4-8 kHz
air, 8–16 kHz−30 to −17 dBfizzy top end / no air above 8 kHz
stereocorrelation 0.15 to 0.96nearly mono / too wide / phasey
low endcorrelation at least 0.9 below 150 Hzlow end not mono

The band values are each band’s share of the master’s total energy, in dB, so they move together: cutting the sub raises everything else’s share. What usually fixes each:

  • too much sub, thin low end: the bass sits too low or is too pure. Lower its level, move it up an octave, or use a bass with harmonics (saw_bass, organ_bass, reese instead of sub_bass); a long 808 kick adds sub too.
  • muddy low mids: pads and chords voiced low. Raise their .voicing() range or lower their level.
  • recessed mids: the lead and chords are buried; raise them, or choose brighter sounds (piano over a warm pad).
  • dull presence, no air: hats, claps, shakers and rides too quiet or too dark. Raise their levels, add an open hat or a ride. Lofi’s master darkens the top end on purpose, so it needs louder hats than other genres.
  • fizzy top end: hats and bright synths (supersaws) too loud; lower the hats or .lpf() the synth.
  • nearly mono: everything important sits in the middle. Pan the hats and percussion, raise the reverb and delay sends of chords and pads (the returns are wide), prefer sampled stereo instruments for pads.
  • low end not mono: a stereo recording below 150 Hz on the drums bus, usually the acoustic kit’s kick (the drums bus is not made mono). Use a 909 or 808 kick.

The ears add a production score: how strongly the master reads as “a professionally mixed and mastered music track” against six named flaws (a cheap synthesized beep, a low quality recording with hiss, a distorted clipped recording, a computer-generated electronic tone, a low bitrate mp3 with artifacts, a recording made on a phone). It moves with sound choice more than with mix settings: sampled instruments and real drum machines help most, and heavy distortion or a buzzy synth lead pull it towards the flaws.

Stems

claudius make --stems and claudius render blueprint.json --stems write every track as its own WAV into stems/, after its level, sidechain and pan and before the buses, so the stems sum to the mix without the bus chains, the returns and the master.

Coming from Strudel or TidalCycles

claudius borrows Strudel’s mini-notation and many of its pattern methods, so most of your patterns carry over. The model around them is different: a Strudel program is a live loop, and a claudius script describes a song (sections, an arrangement, a mix) that is rendered and judged. This page lists every difference that changes what you write.

The same groove in both

Strudel:

setcpm(124/4)
stack(
  s("bd*4, [~ cp]*2, [~ hh]*4").bank("RolandTR909"),
  note("<a1 f1 d2 e2>").struct("~ x ~ x ~ x ~ [x x]").s("sawtooth").lpf(800),
  n("<0 2 4 6>").scale("A:minor").s("piano").room(0.5)
)

claudius:

blank("house");
tempo(124); key("A minor");
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4").bank("RolandTR909"));
track("bass",  note("<a1 f1 d2 e2>").struct("~ x ~ x ~ x ~ [x x]").s("saw_bass").lpf(800));
track("keys",  n("<0 2 4 6>").scale("A:minor").octave(4).s("piano").room(0.5));

Each pattern becomes a named track, the tempo is in BPM, and the sounds are claudius’s: saw_bass is a synth preset, piano a sampled grand, and the Strudel bank name RolandTR909 is an alias of the tr909 pack.

Time

  • One cycle is one bar, always. There is no setcps or setcpm; tempo(bpm) sets the song’s tempo, and a cycle lasts four beats of it.
  • Patterns play inside sections. A track plays in the sections that list it, and every section starts the pattern from cycle 0: alternations, every() and random choices start over. There is no global clock running through the song.
  • Queries return whole events whose onset falls in the span, never fragments. An event longer than a bar exists only in the bar where it starts, though it still sounds for its full length, and .struct(), .mask() and the controls still find it in the bars after (see Patterns and time).

Syntax

Strudel (JavaScript)claudius (Rhai)
x => x.fast(2)|x| x.fast(2)
stack(a, b, c)stack([a, b, c])
cat(a, b)cat([a, b])
silencesilence()
$: s("bd*4")track("kick", s("bd*4"))
'single quotes'"double quotes"
samples('github:user/repo')claudius-packs add-map github:user/repo on the command line

Mini-notation

Most of it is identical. The differences (full list):

  • { } is a plain group: no polymeter, no %. A fractional .fast() runs a figure across bar lines instead (see Polymeter).
  • . is not a separator; it is an error.
  • Weights inside < > are ignored: write <a!3 b> to hold a for three cycles.
  • * and / take numbers, not patterns, above 0 and up to 256 (so do fast(), slow() and ply()).
  • a ! 3 is three as.
  • | and , at the same level group differently; bracket the choice: [a | b], c.

Euclidean rhythms are Strudel’s: bd(3,8), bd(5,8,2) and .euclid(7, 16) give the same steps in both. So do slash chords and applied chords, which stay one word: chord("<Am F/A C G>"), chord("<I V7/V>").

Values and controls

  • n() is always scale degrees. In Strudel, n() without .scale() is a sample index (or a note number). In claudius, n("0 2 4") without a scale uses the song’s key, and the sample index is bd:3 or the method .n("0 3") on an s() pattern.
  • .transpose() is always semitones; .add() adds to the value. On note() both move semitones; on n(), .add(2) moves two scale degrees and .transpose(12) moves an octave. On chord(), .add() moves the voicing range and .transpose() the voiced notes (see add() and transpose()).
  • .gain() is velocity. It is how hard a note is played (0 to 1), not an amplitude multiplier: claudius levels every track to its mixing role, so the track’s loudness is set with .level(dB) or mix(). .velocity() is the same control and wins when both are set.
  • Note names default to octave 3, as in Strudel: note("c") is C3, MIDI 48.

Effects are per track

Strudel effects are controls on each event; claudius effects belong to the track:

Strudelclaudius
.room(0.5), .size(0.8).room(0.5) is a send to the song’s reverb, whose size the genre sets
.delay(0.5), .delaytime(), .delayfeedback().delay(0.5) is a send to a tempo-synced delay set by the genre
.pan(0.7), 0 to 1.pan(0.4), −1 to 1 with 0 in the centre
.lpf("<400 2000>").lpf(800), one number per track
.crush(4), .distort(0.5).crush(bits), .distort(dB)
.orbit(), .duckorbit().duck(depth): sidechain from the kick

A patterned effect argument is an error: .lpf("<400 2000>") raises lpf needs a number. Filter movement comes from the arrangement instead (an intro’s filter_in, a build’s highpass sweep).

Sounds

  • .s() on a note pattern sets the track’s instrument; it takes one name, not a pattern, so a note pattern cannot switch instruments from event to event. Use two tracks.
  • sawtooth, square, triangle and sine are not sounds; use a synth preset (saw_bass, pluck, square_lead, sub_bass …).
  • Drum names are the usual bd sd cp hh oh rd cr lt mt ht rim cb sh. Without .bank() they play claudius’s synthesized drum voices; with .bank("tr909") (or RolandTR909, 808, acoustic …) the recorded machines. A bank can also go in the word, s("tr909:bd*4, tr808:cp*2"), to mix machines in one pattern; a number after the last colon is the sample index (tr808:sd:3).
  • A sound pattern with several names is split into one track per name when arranged (drums.bd, drums.hh), so each is mixed by its own role.

Methods

Available, with the same meaning: fast slow late early rev ply every lastOf sometimes often rarely almostNever almostAlways sometimesBy off superimpose degrade degradeBy struct mask euclid euclidRot gain velocity legato add transpose n s sound bank scale voicing arp. Differences in detail:

  • ply() and every() take integers; .every(4, f) is the first bar of every four, like Strudel’s firstOf.
  • .arp() takes a mode ("up", "down", "updown"), not an index pattern.
  • .voicing() takes a MIDI range; voice leading is always on.
  • Randomness is seeded by the code, not by the cycle alone: two tracks with the same pattern make the same choices.

Not available: continuous signals (sine, saw, rand, perlin, range, segment), jux, sample slicing (chop, striate, slice, splice, begin, end, speed, loopAt, fit), chunk, iter, palindrome, echo/stut, when, ADSR and filter-envelope controls, vowel, and the live-coding commands (hush, setcps).

What claudius adds

  • A song: sections with energies, builds, gaps, impacts and fills.
  • Harmony the song knows about: prog(), Roman numerals, chord("prog"), and chord("prog").root() for a bass line that follows it.
  • Parts written by music theory, drum grammars and genre profiles (song()).
  • A mix: roles, target levels, sidechain, buses, a mastered result at a LUFS target.
  • A critic that tells you what to fix, and evolution that tries fixes for you.

Genres, mutation and evolution

A genre in claudius is a data file: the production knowledge of a style written down as tempo ranges, harmonic styles, forms, drum grammars, part writers, sounds, transitions and mix targets. The generator composes from it, the critic judges against it, and evolution mutates songs within it. This page covers all three.

The genres

claudius genres lists them:

genreBPMswingmodesmasterkits usedears listen for (and against)
house120–1260.50–0.56minor, dorian, major−10 LUFS909 (45 %), 707 (10 %)house music (techno, minimal, corporate pop, drum and bass)
deep_house118–1240.53–0.58minor, dorian, major−11909 (30 %), 808 (20 %)house music (techno, minimal, lo-fi hip hop, jazz)
techno126–1340.50–0.52minor, phrygian, dorian−9909 (50 %), 808 (15 %)techno music (house, minimal, drum and bass, dubstep)
trap130–1500.50–0.54minor, harmonic minor, phrygian−9808 (60 %)trap beat (heavy-bass hip hop, lo-fi hip hop, dubstep, house)
lofi70–900.56–0.63major, minor, dorian−12.5808 (30 %), acoustic (30 %)lo-fi hip hop beat (jazz, heavy-bass hip hop, solo piano, trap)
dnb170–1760.50–0.51minor, dorian, phrygian−8.5acoustic (30 %)drum and bass music (dubstep, techno, house, trap)
future_bass140–1600.50–0.53major, minor−9808 (30 %)future bass music (dubstep, corporate pop, trap, house)
synthwave85–118straightminor, dorian−10.5707 (40 %), 808 (20 %)synthwave music (corporate pop, chiptune, house, ambient pad)
trip_hop78–940.51–0.56minor, phrygian, dorian−11acoustic (50 %), 808 (10 %)trip hop music (lo-fi hip hop, heavy-bass hip hop, ambient pad, cinematic orchestral)
big_beat124–1380.50–0.54minor, mixolydian, phrygian, dorian−8.5acoustic (45 %), 909 (20 %), 808 (10 %)big beat breakbeat music with distorted drums (drum and bass, techno, rock with electric guitars, heavy-bass hip hop)
electro_house126–1300.50–0.52minor, dorian−8909 (50 %)dirty electro house dance music with big synth leads (house, dubstep, techno, corporate pop)
nu_disco112–1240.50–0.56minor, dorian, major−10acoustic (30 %), 707 (20 %), 909 (15 %)disco music (house, corporate pop, synthwave, jazz)
filter_house118–1260.50–0.55dorian, minor, mixolydian−9909 (50 %)french house music with a filtered disco loop (house, funk, techno, corporate pop)
dance_pop116–1280.50–0.52major, minor, dorian−8.5909 (30 %), 808 (20 %)upbeat dance pop music (corporate pop, house, synthwave, future bass)
neo_psychedelia96–1220.50–0.55mixolydian, dorian, major, lydian−10acoustic (70 %)dreamy psychedelic pop music with phased guitars and organ (rock with electric guitars, indie pop, synthwave, funk)
art_rock70–1000.50–0.53minor, dorian, phrygian, harmonic minor−10.5acoustic (70 %)progressive rock music with piano, strings and synthesizers (rock with electric guitars, cinematic orchestral, indie pop, ambient pad)
idm96–1400.50–0.56lydian, dorian, minor, phrygian, major−10none: synthesizedglitchy intelligent dance music with complex broken beats and bells (glitch hop, drum and bass, ambient pad, chiptune)
dub_techno116–1260.50–0.54minor, dorian, phrygian−10.5909 (30 %), 808 (20 %)dub techno music with echoing chords (techno, minimal, ambient pad, house)
boom_bap86–960.55–0.62minor, dorian, phrygian−10acoustic (45 %), 808 (15 %)boom bap hip hop beat (lo-fi hip hop, trap, jazz, funk)
uk_drill138–1460.50–0.53minor, harmonic minor, phrygian−9808 (50 %)uk drill beat (trap, heavy-bass hip hop, dubstep, grime)
dubstep138–1420.50–0.52minor, phrygian, harmonic minor−9909 (30 %), 808 (25 %)dubstep music (drum and bass, trap, electro house, techno)
uk_garage130–1360.58–0.66minor, dorian, major−9.5909 (35 %), 808 (25 %)uk garage music (house, drum and bass, r&b, dubstep)
jungle160–1720.50–0.53minor, dorian, phrygian−9.5acoustic (60 %)jungle music (drum and bass, breakbeat, dubstep, reggae)
afrobeats100–1150.52–0.58major, minor, dorian−9.5808 (30 %), acoustic (30 %)afrobeats music (dancehall, reggaeton, house, r&b)
amapiano110–1160.54–0.60minor, dorian, major−10909 (30 %), 808 (30 %)amapiano music (deep house, afrobeats, house, jazz)
reggaeton88–1000.50–0.53minor, harmonic minor, dorian−9808 (50 %)reggaeton music (dancehall, latin pop, trap, afrobeats)
trance134–1400.50–0.51minor, dorian, major−9909 (60 %)trance music (techno, house, electro house, synthwave)
neo_soul72–920.55–0.62dorian, minor, major−11acoustic (60 %)neo soul music (r&b, jazz, lo-fi hip hop, funk)
alt_hip_hop76–980.54–0.60major, dorian, minor−10acoustic (30 %)alternative hip hop with lush jazz chords (neo soul, jazz rap, r&b, lo-fi hip hop, funk); layered (complexity 0.8)
hip_hop84–1000.50–0.54minor, harmonic minor, phrygian−9.5none: synthesizedhip hop beat with heavy bass (boom bap, trap, lo-fi hip hop, r&b)
rnb64–800.52–0.60minor, dorian, major, lydian−10808 (40 %), 909 (10 %)r&b music (heavy-bass hip hop, lo-fi hip hop, jazz, corporate pop)
funk96–1160.52–0.60dorian, mixolydian, minor−10acoustic (45 %), 707 (10 %)funk music (jazz, heavy-bass hip hop, rock with electric guitars, house)
tech_house124–1280.50–0.56minor, dorian, phrygian−8.5909 (40 %), 808 (15 %), 707 (10 %)tech house music (house, techno, minimal, drum and bass)
ambient60–900.50–0.52major, lydian, dorian, minor−14808 (20 %)ambient pad music (cinematic orchestral, solo piano, minimal, lo-fi hip hop)
grime138–1420.50–0.54minor, phrygian, harmonic minor−9808 (40 %), 909 (20 %)grime music (dubstep, trap, heavy-bass hip hop, drum and bass)
phonk130–1450.50–0.54phrygian, minor, harmonic minor−8808 (70 %)phonk music (trap, heavy-bass hip hop, dubstep, lo-fi hip hop)
reggae66–840.56–0.64minor, major, dorian−11acoustic (40 %), 808 (10 %)reggae music (heavy-bass hip hop, jazz, funk, acoustic guitar)
g_funk88–1000.55–0.60dorian, minor, mixolydian−10808 (40 %)west coast g-funk hip hop beat with a whining synth lead (funk, heavy-bass hip hop, boom bap, r&b)
gangsta_rap84–960.53–0.58minor, phrygian, harmonic minor−10acoustic (30 %), 808 (10 %)hardcore gangsta rap beat with a dark piano loop (boom bap, trap, heavy-bass hip hop, cinematic orchestral)
jazz_rap86–1000.56–0.62dorian, minor, major−11acoustic (50 %)jazz rap hip hop beat with jazz samples and upright bass (jazz, boom bap, lo-fi hip hop, neo soul)
chipmunk_soul80–960.52–0.56major, minor, dorian−9.5acoustic (25 %), 808 (15 %)soulful hip hop beat with sped-up soul vocal samples (boom bap, r&b, gospel, heavy-bass hip hop)
crunk80–1040.50–0.53minor, phrygian, harmonic minor−8808 (70 %)crunk hip hop with booming 808s and loud synth stabs (trap, heavy-bass hip hop, electro house, dubstep)
cloud_rap128–1480.50–0.53minor, dorian, major−10.5808 (50 %)cloud rap beat with dreamy hazy reverb pads (trap, ambient pad, lo-fi hip hop, synthwave)
emo_rap130–1700.50–0.53minor, dorian, major−9808 (60 %)emo rap trap beat with a sad guitar loop (trap, rock with electric guitars, lo-fi hip hop, indie pop)
rage150–1700.50–0.52minor, phrygian, harmonic minor−7.5808 (50 %)rage trap beat with loud distorted synth leads (trap, dubstep, electro house, heavy-bass hip hop)
plugg140–1600.50–0.52major, dorian, minor−9.5808 (50 %)pluggnb trap beat with soft bells and lush chords (trap, r&b, lo-fi hip hop, future bass)
ny_drill138–1460.50–0.53minor, harmonic minor, phrygian−8.5808 (50 %)brooklyn drill beat with sliding 808s and a dark choir (uk drill, trap, heavy-bass hip hop, cinematic orchestral)
chicago_drill130–1500.50–0.53minor, harmonic minor, phrygian−8.5808 (60 %)chicago drill beat with menacing brass and bells (trap, uk drill, cinematic orchestral, heavy-bass hip hop)
rnb_90s66–1000.54–0.60major, minor, dorian−10.5808 (30 %), acoustic (20 %)90s r&b slow jam with electric piano and finger snaps (r&b, neo soul, funk, boom bap)
new_jack_swing100–1180.58–0.64minor, dorian, mixolydian−10808 (35 %), 707 (25 %)new jack swing with a swung drum machine and synth stabs (funk, r&b, synthwave, dance pop)
alt_rnb60–900.50–0.56minor, dorian, phrygian−10.5808 (50 %)dark alternative r&b with atmospheric reverb and 808s (r&b, trap, ambient pad, neo soul)
big_room126–1300.50–0.51minor, phrygian, harmonic minor−7.5909 (40 %)big room house music (electro house, trance, house, corporate pop)
progressive_house124–1280.50–0.52minor, major, dorian−8.5909 (50 %)progressive house music with euphoric piano chords and big synths (trance, house, electro house, corporate pop)
slap_house120–1260.50–0.52minor, dorian, phrygian−8909 (35 %), 808 (20 %)slap house music with a bouncy metallic bassline (house, tech house, electro house, future bass)
hardstyle150–155straightminor, harmonic minor, phrygian−7none: synthesizedhardstyle music with a distorted kick and euphoric synths (trance, techno, electro house, dubstep)
hard_techno145–1550.50–0.51phrygian, minor, dorian−7.5none: synthesizedhard techno music with a distorted pounding kick (techno, drum and bass, trance, dubstep)
gabber170–190straightminor, phrygian, harmonic minor−7none: synthesizedgabber hardcore techno music with a heavily distorted kick (techno, drum and bass, hardstyle, trance)
hyperpop140–1700.50–0.52major, minor, mixolydian−7808 (40 %)hyperpop music with distorted 808s and bright glitchy synths (trap, future bass, chiptune, corporate pop)
jersey_club135–1450.50–0.52minor, major, dorian−8808 (40 %)jersey club music with bouncing triplet kick drums and vocal chops (trap, house, uk garage, future bass)
afro_house120–1240.52–0.56minor, dorian, phrygian−9.5909 (25 %), 808 (15 %)afro house music with tribal percussion and a deep groove (house, afrobeats, tech house, minimal)
melodic_techno120–1260.50–0.52minor, dorian, phrygian−9909 (40 %)melodic techno with arpeggiated synths (techno, trance, house, minimal)
baile_funk126–1360.50–0.53minor, phrygian, harmonic minor−7.5808 (60 %)baile funk beat with booming 808 kicks and congas (reggaeton, trap, heavy-bass hip hop, dancehall)
breakcore165–1900.50–0.52minor, dorian, phrygian−8.5acoustic (50 %)breakcore music with frantic chopped amen breakbeats (drum and bass, glitch hop, jungle, dubstep)
alt_rock100–1400.50–0.52minor, dorian, mixolydian, major−9.5acoustic (100 %)alternative rock music with distorted electric guitars (grunge rock, punk rock, indie rock, heavy metal, pop rock)
pop_punk150–1900.50–0.51major, minor, mixolydian−9acoustic (100 %)pop punk rock music with fast drums and distorted guitars (punk rock, alternative rock, emo rock, pop rock, heavy metal)
nu_metal88–1080.50–0.54minor, phrygian, harmonic minor−8.5acoustic (100 %)nu metal rap rock music with heavy distorted guitars (heavy metal, alternative rock, heavy-bass hip hop, punk rock, industrial rock)

The last twelve are the festival’s, the hard styles’ and the scenes of the last few years. Big room, progressive house and slap house are the edm family, with “edm” one of big room’s other names (and electro house’s, future bass’s and trance’s: song("edm") asks which). Hardstyle, hard techno and gabber are the hard dance family: their kicks are always synthesized, never a kit’s, and distorted in their own lanes, folded for hardstyle’s ringing tail and clipped square for gabber’s, with a drummer of their own who rolls the kick into the next phrase. Jersey club’s kick plays its five-kick bounce (two quarters, two dotted eighths and an eighth) and bursts into triplets at a phrase’s end; baile funk’s drums play the tamborzão, its low drum in five uneven hits under rim slaps and a higher hand drum; breakcore chops a sampled break harder and faster than jungle does.

The ten after synthwave lean on effect chains in their profiles: trip-hop’s drums go through parallel compression and a crushed copy, and its delay feeds back harder in the breaks; big beat’s acid line opens its filter across the builds; filter house’s loop sweeps a resonant lowpass with the arrangement; art rock’s guitars turn distorted in its climaxes; IDM’s pads are gated harder as each groove goes on; dub techno’s chord echoes feed back and swell in the break, all of it values by section that follow the form.

The five after dub techno are built on their drums and their bass: boom bap’s sampled break under a chopped soul or jazz phrase, drill’s late snare and hats in threes over a sliding 808, dubstep’s wobble over a clean sub, garage’s two-step kick and shuffle, jungle’s chopped breakbeat under a deep sub. Each is close kin of a style the ears know well (lo-fi hip hop, trap, drum and bass, house), and its “against” list names that style, so its genre score runs lower than most: the ears often hear the family before the genre.

The last five bring grooves of their own: afrobeats’ clave, congas and shakers, amapiano’s log drum under a steady kick, reggaeton’s dembow, trance’s rolling bass and long breakdown, neo-soul’s laid-back live kit under ninth and eleventh chords.

The “against” list matters: the genre score is high only when a song reads as its genre more than as the styles it is usually confused with, and more than stock library music (corporate background music, children’s piano music and the like), which every genre is measured against.

Fusing genres

Any number of genres joined by + are one genre: trip_hop+idm or trip_hop+neo_soul+dub_techno+idm in song(), claudius make --genre, new_song, remake, or Fused with in the studio’s New song dialog, its remakes of a recording and Change the genre. genres::fuse makes two into one from their profiles:

from the first genrefrom the second
tempo, keys, harmony (three quarters of the time), forms, transitions, the mix and the master, what the ears listen forthe drum lanes, their kits, the drums bus, the drum levels, a quarter of the progressions
the partsits first sound and its styles added to each part of the same role, and its parts of roles the first has none of, as optional parts in the sections with energy 0.6 or more

The second genre’s lanes play in the first genre’s sections: a lane of the same name where that lane played, the others where most of the first genre’s drums played. Swing is the average of the two, humanize the larger, and the flaws either genre accepts are accepted. Sounding like the second genre no longer counts against the song: its query leaves the first genre’s list of confusions. More than two fuse one after another: the first two fuse, then the third fuses with them and plays the drums in place of the second, and so on, so that the first leads, the last plays the drums, and every one between lends its sounds, its styles, its parts and some of its progressions. Each takes a quarter of the progressions from those before it: the last has a quarter, the one before it three sixteenths, and the first keeps the largest share up to five genres. A fusion’s Apple Loops, its store genre and the demo’s sounds are the first genre’s. The Fusions recipes hear three of them.

What a profile contains

Each profile (crates/claudius/data/genres/*.json) has:

fieldwhat it decides
family, aliasesthe family the studio and claudius genres list it under (hip hop, house), and the other names, eras, scenes and artists a search finds it by (90s hip hop, golden age); new_song takes an alias no other genre has
bpm, swing, humanizetempo and feel ranges
modes, harmony, markov, ext, bars_per_chordkeys, harmonic styles, how often a fresh Markov progression is written, chord extensions, chord lengths
formsthe section plans, with layers, energies and flags; each song plays one its own way
drumsthe lanes: per-step hit probabilities and velocity ranges per variant, or a euclidean rhythm; the genre’s other grooves on a lane (alts: patterns a song plays instead of the template, each with its chance, so that one song’s hats run in sixteenths and another’s sit on the offbeats); drum voice parameter ranges; which Apple Loops one-shots may replace the voice; choke groups (open and closed hat)
kits, kit_mixwhich recorded drum machines the drums may be played on, and how often; how often a lane plays a kit of its own
palettefor each role, how often a part keeps its own sounds, and which kinds of sound it draws from otherwise: synths, or the installed packs’ strings, brass, woodwinds, mallets, pianos, guitars and more. It draws only what the genre has a place for: the synths of its parts’ families, any synth pad for a pad, or the synths a role lists in synths; and of mallets, woodwinds and brass, whose sound pierces a mix, only those its synths stand in for and the instruments its parts name (or a role lists in instruments). The sounds of an era gone, the 80s FM and pulse-width presets, the string machine, an FM piano and General MIDI’s synth patches, it plays only where a part names one or the role is retro
partsbass, chords, pad, lead, arp, keys: their own presets and instruments, writing styles (one drawn for each song, a style listed twice drawn twice as often), registers (each song plays a part a few semitones higher or lower), density, voicing, and the chance a song leaves the part out; a part may double another (doubles, octave), playing its notes on a sound of its own, as a fuzzy synth bass an octave over an 808
loopsthe Apple Loops a song may layer, by instrument, genre and descriptors
samplingthe samples its songs are built on, from free online libraries: whether they are by default (by_default), and for a break, a phrase, a texture, a vocal chop and a bass note, the kinds of record to search for, what the ears should hear, how many to keep, how often a song plays one and re-chops it, how many semitones a phrase may be played up or down (pitch) and whether a voice in it is sped up with it (speeds_voices, chipmunk soul’s) or played at its own speed a little under the genre’s range rather than stretched (under, trip hop’s), its mix, the moves a phrase is treated with and how often (treat), and the layers it plays instead of
transitionsrisers, impacts, downlifters, reverse crashes, riser length
mixthe loudness target, reverb and delay, bus and master chains, sidechain release, role level offsets; each song varies its reverb, delay, sends and colours
query, altswhat the ears should hear, and its confusions
accepted_flawsflaws the ears may hear that are the genre’s sound, such as lofi’s hiss, so they do not count against it
complexityhow layered its songs are when nobody says: 0.5, the genre as its profile writes it, unless it is a layered genre

To add a genre or change one, drop a JSON file with the same fields into the claudius/genres folder of your configuration directory (~/Library/Application Support/claudius/genres/ on macOS, ~/.config/claudius/genres/ on Linux). A file whose name matches a built-in genre replaces it. A good start is a copy of the built-in file closest to what you want.

Making songs

claudius make --genre techno                          # a new song, seeded from the clock
claudius make --genre trap --key "F# minor" --bpm 142 --seed 7 --stems
claudius make --genre deep_house --loops              # built around an Apple Loops family
claudius make --genre lofi --synth-only               # no recordings at all
claudius make --genre house --sample chop.wav         # flip a recording into the song

In a script, song("trap", #{ seed: 7, bpm: 142, key: "F# minor" }) makes the same song, and the edits after it apply on top. --bpm and --key change only the tempo and the key: the title, the form, progression A and the drum patterns are the ones --seed 7 gives without them, except that a key in another mode moves the chords into it, as key() does. The same genre, seed and options make the same song on any machine, in the studio’s New as on the command line; the sample packs and Apple Loops installed change only which recordings it plays.

How layered a song is

--complexity, from 0 to 1 (complexity in new_song and in a script’s song(), Layers in the studio’s New song dialog), says how much plays at once. At 0.5, or when nobody says, a song is the genre as its profile writes it. Above that, more of it layers up, each layer with a chance that grows to sure at 1:

  • a pad holding the chords, in a genre whose songs have none, in the intro, breaks and outro and under the hooks;
  • a counter-melody under the lead, sparser and lower, with it in the hooks and in its place in the verses;
  • an arpeggio sparkling high over the hooks, quietly, through a delay;
  • the harmony and the lead doubled on second instruments: the same notes, an octave up or in unison on another sound, 6 dB under and to the other side, and the bass an octave up through a high-pass and some drive, so that its harmonics carry it;
  • a clap on the snare’s backbeats, a shaker on the sixteenths, and a percussion line, a conga (or a conga, bongo or clave from the library) in a euclidean rhythm, never a cowbell;
  • in a song built on samples, the sampled break, texture, vocal chop and bass note it may play, and the drums a break stands in for, played over the break in the hooks.

Each comes in where the song lifts, its hooks and drops first (at 1 the verses too), so the song still builds. Below 0.5, down to 0, the song is thinned to its core: the parts a genre may leave out are left out, and so are the parts and drum lanes that only colour a section (all but the bass, the first harmony part, the kick, the snare, the clap and the hats), from its quieter sections most. The seed’s song is the same under its layers: its tempo, key, chords, form and patterns do not move with the complexity. The history says what was layered (layered at complexity 0.90: chords doubled an octave up on bell; a clap on the snare; ...).

claudius make --genre neo_soul --complexity 0.9     # keys on keys, a counter-melody, a pad, a shaker
claudius make --genre techno --complexity 0.1       # the kick, the hats and the bass

A double is a part that plays another part’s notes on a sound of its own (doubles and octave in part()), so it follows its part through edits, mutations and a new seed.

Mutation

A mutation is one edit a producer might try, chosen from 25 operators:

areaoperators
harmonya theory-aware substitution in A or B (a chord a third away, extended or plain, a secondary dominant, a chord borrowed from the parallel mode, a suspension, a swap, a rotation); a new progression from one of the genre’s styles
drumsadd, remove, nudge or re-accent one hit; regenerate a lane from the grammar; swap a lane’s sound (a recorded one-shot, or one synth parameter moved); move every lane to another kit, or back to synthesis
partsrewrite a part (new seed); another style; another preset; tweak the patch (cutoff, resonance, release, drive, detune); move the register; change a lead’s density
mixa track 1–3 dB up or down; a reverb or delay send; a sidechain depth; a pan; the reverb’s decay or the delay’s time
forma track into or out of a section; a section 4 or 8 bars longer or shorter; toggle a section’s fills, gap, impact or filter sweep; another drum variant for a section
globaltempo by 1–4 BPM within the genre’s range; key by up to 5 semitones; swing; another Apple Loop

Operators are not equally likely. The critic’s top four issues raise the weight of the operators that address them, by 1 + 4 × the issue’s severity: band and width problems favour level, sound, kit, patch, space and pan edits; form problems favour the form operators; a part:lead issue favours rewriting the lead; a weak genre reading favours presets, styles, drum grooves and kits, tempo and harmony. Every mutation records what it did, and the song keeps the list as its lineage.

Mutation edits what the generator writes: drum lanes, parts, loops and their mix. Pattern tracks are moved between sections and follow tempo, key and swing, but their code is never changed.

claudius mutate out/house-crimson-tide-9/blueprint.json -n 4 writes four mutated variants into mutations/ next to it, each rendered and judged, with what changed. The MCP tool mutate tries a few variations of the open song and keeps the best if it beats the current one.

Evolution

claudius evolve runs a (μ + λ) evolution: it starts from fresh songs (or --from a blueprint), and in each generation the best songs so far are parents of new children, each made by one or two mutations or by a crossover of two parents (drums and form from one, harmony and parts from the other) followed by mutations. A child identical to one already heard is skipped. Each candidate is judged on a preview, the build-up into the first drop and the drop (--preview-bars, 32 by default), and at the end the best are rendered in full.

optiondefault
--start4fresh songs to start from
--generations5
--population4parents kept per generation
--children8children per generation
--preview-bars32bars auditioned per candidate
--keep3best songs rendered in full at the end

A short run, two generations of four children from two deep house songs:

claudius evolve --genre deep_house --seed 4 --start 2 --generations 2 --children 4 --keep 1
ears loaded in 3.7 s
evolving deep_house (2 start, 2 generations x 4 children, 32-bar previews, with ears)
  g0-0  78.4  Velvet Orbit
  g0-1  86.5  Hollow Harbor
  g1-0  86.1  from g0-1: key Bb dorian -> Eb dorian
  g1-1  86.4  from g0-1: form: clap out of build
  g1-2  84.9  from g0-1: hat: sampled hh (tr909:hh) -> hat cut from 'Times of Plenty Open Hi-Hat' (Apple Loops); key Bb dorian -> F# dorian
  g1-3  85.9  from g0-1: harmony A: i7 IV7 -> i7 iv7 v7 i7 (minor_soul); mix: shaker +2.0 dB (now +2.0)
generation 1: best 86.5
  g2-0  85.1  from g0-1: crossover: drums and form of one parent, harmony and parts of the other; drums (sparse): re-accented a hat hit; key Bb dorian -> G dorian
  g2-1  86.1  from g0-1: form: drop loses fills
  g2-2  84.8  from g1-3: form: build now 4 bars; form: groove loses fills
  g2-3  85.8  from g1-0: crossover: drums and form of one parent, harmony and parts of the other; mix: chords sidechain depth 0.28; mix: kick -1.8 dB (now -1.8)
generation 2: best 86.5
searched 10 candidates in 17 s; rendering the best 1 in full
#1 g0-1 (Hollow Harbor): preview 86.5, full song 86.1

A + marks a child that beats the best parent. In this short run none did, so the winner is a starting song, g0-1, and its full render scores a little under its preview (the preview hears only the build and the first drop). Small differences in score are within the critic’s noise, so treat a gain of half a point as a draw and listen. Evolution is most useful from a weak start (a score in the 70s, like g0-0) or aimed at one problem, and less so for polishing a song that already scores well.

The MCP tool evolve does the same on the open song; a generation takes 10 to 40 seconds.

Judging against references

--refs <files or folders> on make, script, evolve, render and judge adds a typicality score: how close the song’s ears embedding is to a set of reference tracks you choose (at least two). It counts as a sixth score with the same weight as genre and production, and an issue appears when the song is unlike the references.

What the score is

The total is a weighted mean: mix 0.3, arc 0.2, theory 0.2, and with the ears genre 0.15 and production 0.15 (plus references 0.15 when given). A high score means no measurable problems and a confident genre reading, not a hit. Optimising against the ears can please the models without the music getting better, which is earshot’s own warning; judge finished songs by ear.

Example songs, the 1990s to the 2020s

claudius comes with example songs, each in the style of the hits of one scene of a decade: Bristol trip hop, big beat, boom bap, G-funk and piano house; French house, electropop, UK garage, trance, crunk and art rock; festival EDM, future bass, dubstep, tropical house, trap and alternative R&B; the 80s revival in synth-pop, the disco revival, afrobeats, reggaeton, amapiano and tech house. Ten more remake famous music in the public domain, from Bach’s Toccata and Fugue in D minor and Für Elise to the Habanera from Carmen, each played as it was written in a style of today, and three are built to show layered sounds: a bass, chords or a snare played by several sounds at once. Each is a script whose opening notes say how its style is made: the tempo and the groove, the chords, the sounds, the arrangement and the mix. Opening one is a way to hear how a style is built, to read how, and to start a song from it.

None of them copies a record or a song anyone still owns. A style is named for the artists it is heard on, so you know what to expect, but every melody, bass line, chord voicing and drum pattern of a song in a style is its own: a hit’s melody and words belong to the people who wrote it, and claudius plays only what it is free to. A classic remade is named for the piece and plays its composer’s music note for note, which belongs to everyone now, in an arrangement of its own. The examples play claudius’ own synths and drum voices, so they sound the same without the sample packs, offline and in the online demo.

Opening one

  • In the studio: New song, then From an example. Choose a card (hover it for its notes) and Open it. It replaces the song that is open, which undo brings back, and the Script tab shows the script with its notes.
  • With an assistant: examples lists them and, given a name, says how that one is made; open_example opens one in the studio, rendered and judged. Ask for “the 90s trip hop example” or “show me how French house is made”.
  • On the command line: claudius examples lists them, and claudius examples NAME prints one’s script:
claudius examples blue_hour_static > blue_hour_static.rhai
claudius script blue_hour_static.rhai --out ~/Music/claudius

The scripts are in the repository too, under crates/claudius-api/songs.

The songs

decadesongstyleheard onlisten for
1990sBlue Hour Static (blue_hour_static)Bristol trip hopMassive Attack, Portishead, Trickya slow, swung beat through tape and vinyl, a sub bass holding each root, wide dark strings, a vibraphone line with long echoes
1990sAcid Rocket (acid_rocket)big beatThe Prodigy, The Chemical Brothers, Fatboy Slima sped-up break crushed in parallel, an acid bass line that is the hook, two chords only
1990sConcrete Diaries (concrete_diaries)boom bapNas, Pete Rock, A Tribe Called Questa snare 14 ms late and humanized hits, a kick that changes over four bars, a jazz loop on a taped clavinet, horns through a phaser in the hook
1990sSunday Lowrider (sunday_lowrider)G-funkDr. Dre, Snoop Dogg, Warren Ga dorian funk vamp, a rubbery bass sliding between roots and fifths, a high whining lead gliding far above it all
1990sDiamond Floor (diamond_floor)piano houseRobin S, Black Box, CeCe Penistonhouse piano chords hammered on the offbeats, an organ bass between the kicks, a diva’s chopped phrases as the hook
2000sChrome Boulevard (chrome_boulevard)French filter houseDaft Punk, Stardust, Modjoa two-bar disco loop whose lowpass filter is the arrangement, deep pumping under the kick, a vocoder-like lead
2000sFlashbulb (flashbulb)electropopLady Gaga, Britney Spears, Keshachords that rock back and forth instead of resolving, a buzzing bass on eighths, offbeat stabs, a hook doubled an octave up
2000sSundown Shuffle (sundown_shuffle)UK garageCraig David, Artful Dodger, MJ Colethe two-step kick that skips beat 3, a heavy shuffle, organ stabs of minor ninths, an organ bass bouncing off the kick
2000sAfterlight Horizon (afterlight_horizon)uplifting tranceTiësto, ATB, Paul van Dykthe rolling bass after every kick, a plucked arpeggio climbing the chords, a breakdown with the anthem alone, a supersaw drop
2000sFloor Shaker (floor_shaker)crunkLil Jon, Ying Yang Twins, Three 6 Mafiaa booming 808, claps loud enough to shout over, a harmonic minor riff a half step from the root, brass stabs
2000sSatellite Hymn (satellite_hymn)art rockRadiohead, Muse, Coldplaya piano alone in the verses, then two distorted power-chord guitars panned hard left and right, and a high string line like a falsetto
2010sHigher Than the Lights (higher_than_the_lights)festival EDMAvicii, Swedish House Mafia, Martin Garrixvi IV I V on a piano in the breakdown, a snare roll and a beat of silence before the drop, a supersaw hook and a mix that pumps
2010sCoral Skies (coral_skies)future bassFlume, The Chainsmokers, Illeniumhalf time at 150 BPM, a held supersaw that swells back after every kick, triplet hat rolls, vocal chops
2010sFracture Line (fracture_line)dubstepSkrillex, Rusko, Flux Pavilionhalf time at 140 BPM, a wobble bass as the lead doubled by a distorted one, a phrygian half step, a drop of drums and bass alone
2010sIsland Tide (island_tide)tropical houseKygo, Thomas Jack, Felix Jaehnhouse slowed to 112 BPM, snaps and shakers, bright major chords, a marimba-like mallet hook
2010sIce Avenue (ice_avenue)trapMetro Boomin, Migos, 21 Savagehats rolling in triplets and thirty-seconds, an 808 that is kick and bass, a dark harmonic minor string line
2010sGlass Penthouse (glass_penthouse)alternative R&BThe Weeknd, Frank Ocean, PARTYNEXTDOORa slow, sparse beat with a late snare and a long tail, minor sevenths hanging on a worn electric piano, a voice-like line that runs down the scale
2020sMidnight Overdrive (midnight_overdrive)synth-pop, the 80s revivalThe Weeknd, Dua Lipa, M83168 BPM straight, a gated-reverb snare, an octave bass and a sixteenth arpeggio under a saw lead
2020sSatin Signal (satin_signal)disco-popDua Lipa, Doja Cat, The Weekndan open hat on every offbeat, an octave disco bass, a guitar-like chop and congas, strings that stab only in the choruses
2020sCalm Waters (calm_waters)afrobeatsBurna Boy, Wizkid, Remaa kick on the tresillo, shakers and congas carrying the groove, highlife-style plucked chords on the offbeats, a call-and-response topline
2020sLuna Callejera (luna_callejera)reggaetonBad Bunny, Karol G, J Balvinthe dembow, a kick on every beat under the snare’s “boom-ch-boom-chick”, an 808 on the roots, plucked chords on the offbeats
2020sMidnight in Jozi (midnight_in_jozi)amapianoKabza De Small, Tyla, DJ Maphorisathe log drum, a woody pitched bass that is also the hook, jazzy ninths on a percussive piano, shakers rolling sixteenths
2020sLate Checkout (late_checkout)tech houseFisher, Chris Lake, John Summita rubbery bassline in sixteenths as the hook, a rimshot looping through a delay, a breakdown without the kick and a build that snaps back

Classics remade

songstyleremakeslisten for
Joy Machine (joy_machine)festival EDMBeethoven’s Ode to Joy (1824)the theme alone on a piano, a snare roll and a beat of silence, then the drop playing it on a supersaw over a reharmonization with a minor chord
Canon Study (canon_study)lo-fi hip hopPachelbel’s Canon in D (around 1700)the Canon’s eight chords and its ground bass under a swung, dusty beat, its descending violin line on a mallet
Mountain Kings (mountain_kings)drum and bassGrieg’s In the Hall of the Mountain King (1875)the theme’s chromatic climb at 172 BPM over the two-step beat and a reese bass, the piano alone in the intro and the breakdown
Toccata and Fugue in D Minor (toccata_and_fugue)rap rockBach’s Toccata and Fugue in D minor (around 1704)Bach’s opening on an organ alone, the turn on A and the run down to C sharp and D, then on a wall of distorted guitars over a rock beat with a hip hop swing
Rondo alla Turca (rondo_alla_turca)club rapMozart’s Rondo alla Turca (1783)Mozart’s theme on short, plucked strings in the gaps of a bouncing club beat, a deep bass on the roots, a picked guitar in the hooks
Moonlight Sonata (moonlight_sonata)dark, minimal hip hopBeethoven’s Moonlight Sonata (1801)the sonata’s rocking triplets on a piano at 79 BPM, its bass in octaves on a sub and a driven moog bass, a sparse, heavy beat with the hats laid back
Für Elise (fur_elise)minimal electropopBeethoven’s Für Elise (1810)E and D sharp rocking down to A on a plucked synth, a kick on every beat and finger snaps, a distorted bass bouncing on A and E, a half-time bridge with a sliding 808
Eine kleine Nachtmusik (eine_kleine_nachtmusik)synth-popMozart’s Eine kleine Nachtmusik (1787)G and D, up the chord to D, on a soft square in the verses and a bright saw an octave up in the hooks, a gated snare, a saw bass in eighths, a string machine
Morning Mood (morning_mood)slow-building electronic popGrieg’s Morning Mood (1875)Grieg’s flute tune on a breathy, whistled lead over deep house that builds, a plucked bass on the roots, an arpeggio whose filter opens over the hooks
Habanera (habanera)synth-funk rapthe Habanera from Bizet’s Carmen (1875)Bizet’s habanera bass on a rubbery synth, his line down by half steps from D on brass, stabs on the offbeats over a swung boom bap beat

Layered sounds

Three songs built to show layered sounds: a bass, chords or a snare played by several sounds at once, each in its own band, with its own level, duck and effects, summed into one track.

songstyleheard onlisten for
Neon Rumble (neon_rumble)bass houseJauz, Joyryde, Habstraktone bass line played by three: a sine sub under 90 Hz that alone ducks under the kick, a reese distorted from 90 Hz to 1.2 kHz, and a saw an octave up over it, gated into a sixteenth stutter
Skyline Fracture (skyline_fracture)melodic dubstepSeven Lions, Illenium, Said the Skyhuge chords of a warm pad under 300 Hz, a supersaw spread wide above it and a pluck shimmering on top; a sub under a wobble kept out of its way
Reese Machine (reese_machine)neurofunk drum and bassNoisia, Mefjus, Phacea reese split into three bands, the sub clean, the body phased, the top crushed and gated; a snare of a snare, a clap and a burst of noise

Each script starts from blank() in its genre, so it brings the genre’s mix (its buses, master chain and loudness) and writes everything else itself. To make one your own, change a line and run it again: the tempo, the progression, a pattern, a sound. Starting a song and the quick reference say what each function does.

House, deep house and techno

Three styles built on the same foundation, a kick on every beat, and different in nearly everything else: house is warm and swung with piano and vocals, deep house is slower and jazzier, techno is hypnotic, dark and dry. Each recipe below is a complete song from a blank start, with the reasons for its choices and the critic’s verdict when we rendered it. They use sampled instruments and drum machines, so they need the default sample packs (claudius setup).

Save a recipe as a .rhai file and render it with claudius script house.rhai.

House: “Glass Avenue”

blank("house");
title("Glass Avenue");
tempo(122); key("A minor"); swing(0.58);
prog("A", "Am7 Fmaj7 Dm7 Em7");
prog("B", "Fmaj7 G Em7 Am7");
bars_per_chord(1);

track("kick",  s("bd*4").bank("tr909"));
track("clap",  s("~ cp ~ cp").bank("tr909").room(0.2));
track("hat",   s("[~ hh]*4").bank("tr808").gain(0.7).pan(0.15));
track("ohat",  s("[~ oh]*4").bank("tr909").gain(0.5).pan(-0.15));
track("shaker", s("shaker*8").gain("[0.3 0.6]*4").pan(-0.3).level(-3));
track("roll",  s("<sd*2 sd*2 sd*4 sd*4 sd*8 sd*8 sd*8 sd*8>").bank("tr909")
                 .gain("<0.4 0.45 0.5 0.55 0.65 0.75 0.85 1>"));

track("bass",   note("<a1 f1 d2 e2>").struct("~ x ~ x ~ x ~ [x x]").s("organ_bass").legato(0.7));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~").voicing(55, 74).s("piano").legato(0.5).room(0.2).level(2));
track("pad",    chord("prog").voicing(52, 72).s("string_ensemble").role("pad").level(-2).room(0.35));
track("vox",    note("<[~ ~ e3 ~ ~ ~ c3 ~] [~ ~ a2 ~ ~ ~ c3 ~] [~ ~ a2 ~ ~ ~ f2 ~] [~ ~ b2 ~ ~ ~ ~ ~]>").s("voice").role("vocal").legato(0.9).room(0.3).delay(0.15).level(-4));
track("lead",   n("<[4 ~ 4 2 4 ~ 6 4] [5 ~ 5 4 2 ~ 0 ~] [3 ~ 3 2 0 ~ 2 3] [4 ~ ~ 6 4 ~ ~ ~]>")
                  .octave(4).s("rhodes").room(0.25).delay(0.2));

form([
  sec("intro", 8, "kick hat shaker chords").filter_in(),
  sec("groove", 16, "kick clap hat shaker bass chords"),
  sec("break", 8, "pad chords"),
  sec("build", 8, "kick clap hat pad lead roll").gap(),
  sec("drop", 16, "kick clap hat ohat shaker bass chords pad lead vox").impact(),
  sec("outro", 8, "kick hat shaker bass"),
]);

Why it is built this way:

  • Tempo and swing. 122 BPM sits in the middle of house’s range. Swing 0.58 is on the heavy side for house; it makes the shaker and the bass pickups lean, which reads as warmth rather than as techno’s grid.
  • Harmony. Am7 Fmaj7 Dm7 Em7 is the minor-soul progression (i7 VImaj7 iv7 v7): sevenths everywhere, no dominant pull, so it loops forever. The break moves to B, which lifts to G before falling back.
  • Drums. A 909 kick and clap, the instruments of house. The closed hat comes from the 808 because it is softer than the 909’s, and the open hat on the same offbeats gives the classic “tss” lift in the drop only. The roll doubles every two bars across the 8-bar build, and stops at eighths: house builds less violently than trance.
  • Bass. An organ bass on the offbeats, with a sixteenth pickup at the end of each bar ([x x]), plays between the kicks instead of on them, which is the house bounce. It sits on the roots of the progression.
  • Chords. A sampled grand piano on the tresillo rhythm (x ~ ~ x ~ ~ x ~), the sound of 90s house.
  • Vocal. The voice pack’s sung vowel plays a two-note answer in each bar of the drop. Pitched low, inside the recording’s range, it sounds like a vocal chop rather than a synth.
  • Lead. A Rhodes motif with chord tones on beats 1 and 3, enters in the build so the drop is a return, not a surprise.
  • Form. The intro’s filter_in() opens a lowpass on the piano over eight bars; the drums are never filtered, so the intro needs a music part for the sweep to be heard. The build keeps the kick (pattern tracks get no automatic kick drop-out), so its energy rises into the drop rather than dipping; the gap() gives the drop its breath.

The critic’s verdict:

  ears: 'house music' z +3.6 (closest confusion 'techno music' +3.4); production z +1.6 vs 'a low quality recording with hiss' +1.0; p_real 0.65
        sounds like: house music, techno music, tech house music, drum and bass music
  verdict: 87/100 (arc 0.85, genre 0.79, mix 0.93, production 0.66, theory 1.00). Fix first: dull 4-8 kHz: hats, claps and snare lack bite (presence -28.7 dB, healthy from -26); fizzy top end (air -16.1 dB, healthy up to -17)

House and techno sit close together for the ears, and a 909 groove pulls towards techno. An earlier version of this recipe had only drums in the intro and read as techno (sounds more like 'techno music' than 'house music', by z +3.5 to +3.4); putting the filtered piano in the intro tipped it to house. The mix notes point at the hats: there is too much above 8 kHz and not enough at 4 to 8 kHz, which a brighter clap and a darker hat would balance.

Try:

  • Swap the piano for a Rhodes (.s("rhodes")) and the lead for a piano for a deeper, softer track.
  • Replace the offbeat bass with the root on every beat, struct("x*4"), for a harder, more driving groove.
  • Put the vocal in the build too, so its hook is introduced before the drop.

Deep house: “Velvet Hours”

blank("deep_house");
title("Velvet Hours");
tempo(121); key("F minor"); swing(0.57);
prog("A", "Fm9 Bbm9 Dbmaj7 Cm7");
prog("B", "Dbmaj7 Cm7 Bbm9 Bbm9");
bars_per_chord(1);

track("kick",   s("bd*4").bank("tr909").gain(0.9));
track("rim",    s("~ ~ rim ~ ~ ~ rim ~ ~ ~ rim ~ ~ rim ~ ~").bank("tr909").gain(0.6).pan(0.3).delay(0.1));
track("hat",    s("[~ hh]*4").bank("tr808").gain(0.6).pan(0.2));
track("shaker", s("shaker*8").gain("[0.3 0.55]*4").pan(-0.3).level(-2));
track("clap",   s("~ cp ~ cp").bank("tr808").room(0.3).level(-2));

track("bass",   note("<f1 bb1 db2 c2>").struct("x ~ ~ x ~ ~ x ~ ~ ~ x ~ ~ ~ ~ ~").s("sub_bass").legato(0.8));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ ~ ~").voicing(53, 72).s("rhodes").room(0.3).delay(0.12));
track("pad",    chord("prog").voicing(50, 74).s("warm_pad").role("pad").level(-3).room(0.4));
track("lead",   n("<[4 ~ ~ 6 4 ~ 2 ~] [2 ~ ~ 4 3 ~ ~ ~] [4 ~ 5 4 2 ~ ~ ~] [~ ~ 1 2 4 ~ ~ ~]>")
                  .octave(4).s("vibes").room(0.35).delay(0.25));

form([
  sec("intro", 8, "kick hat shaker rim chords").filter_in(),
  sec("groove", 16, "kick hat shaker rim clap bass chords"),
  sec("break", 8, "pad chords"),
  sec("build", 8, "kick hat shaker pad chords lead"),
  sec("drop", 16, "kick hat shaker rim clap bass chords pad lead"),
  sec("outro", 8, "kick hat shaker rim bass"),
]);

Why:

  • Slower and swung. 121 BPM and swing 0.57: deep house walks where house runs.
  • Ninth chords. C is a note of all four chords in Fm9 Bbm9 Dbmaj7 Cm7, so the voice-led Rhodes voicings barely move and the harmony shimmers rather than steps. The lead does the same: its strong beats land on C and A♭, notes most of the chords share.
  • The Rhodes plays only twice a bar, on the charleston rhythm (x ~ ~ x), leaving air. Space is the style.
  • Softer drums. The 808’s clap and hat are rounder than the 909’s; the rim shot on a syncopated pattern with a touch of delay is the deep house percussion signature.
  • Sub bass on a syncopated pattern (x ~ ~ x ~ ~ x ~ ~ ~ x): felt more than heard, under warm sounds.
  • No impact. Deep house prefers a riser and a downlifter to a crash and a boom; the genre’s transitions leave the impact out, and the drop has no impact().
  ears: 'house music' z +3.8 (closest confusion 'minimal electronic music' +3.1); production z +1.9 vs 'a low quality recording with hiss' +1.3; p_real 0.52
        sounds like: house music, tech house music, minimal electronic music, drum and bass music
  verdict: 86/100 (arc 0.81, genre 0.91, mix 0.90, production 0.63, theory 1.00). Fix first: dull 4-8 kHz: hats, claps and snare lack bite (presence -31.2 dB, healthy from -26)

The deep house genre score is strong: the ears hear house clearly over its confusions. The one issue, a dull presence range, is the style’s own softness (808 hats, a warm pad, a lowpassed master); raising the clap and the hat by 2 to 3 dB fixes it if you want it brighter.

Try:

  • prog("A", "Gm9 C9 Gm9 C9") with key("G dorian"): the dorian vamp, two chords for the whole track.
  • A walking bass through each chord’s notes, one per beat: note("<[f1 ab1 c2 eb2] [bb1 db2 f2 ab1] [db2 f2 ab2 c2] [c2 eb2 g2 bb1]>") without the struct().

Techno: “Hollow Engine”

blank("techno");
title("Hollow Engine");
tempo(130); key("F phrygian"); swing(0.5);
prog("A", "i i II i");
prog("B", "i");
bars_per_chord(2);

track("kick",  s("bd*4").bank("tr909"));
track("hat",   s("hh*16").bank("tr909").gain("[0.35 0.25 0.7 0.25]*4").pan(0.35));
track("ohat",  s("[~ oh]*4").bank("tr909").gain(0.6).pan(-0.3).room(0.2));
track("clap",  s("~ cp ~ cp").bank("tr909").room(0.25).level(-2));
track("rim",   s("rim(5,16,2)").bank("tr909").gain(0.7).pan(0.35).delay(0.2));
track("ride",  s("[~ rd]*4").bank("tr909").gain(0.5).pan(0.25));
track("roll",  s("<cp*2 cp*4 cp*8 [cp*16]>").bank("tr909").gain("<0.5 0.65 0.8 1>"));

track("bass",  note("<f1!4 gb1!2 f1!2>").struct("[~ x x x]*4").s("saw_bass").legato(0.6).level(-3));
track("acid",  note("f2 f2 f3 f2 ab2 f2 gb2 f2 f2 c3 f2 eb3 f2 f2 db3 f2")
                 .velocity("1 0.6 0.9 0.6 0.7 0.6 1 0.6 0.6 0.9 0.6 1 0.6 0.6 0.9 0.7")
                 .legato(0.7).s("acid").role("synth").delay(0.3).pan(0.2).level(-4));
track("stab",  chord("prog").struct("~ x ~ ~ ~ ~ x ~").voicing(52, 70).s("stab").room(0.5).delay(0.4).pan(-0.2).level(-1));
track("pad",   chord("prog").voicing(45, 70).s("warm_pad").role("pad").room(0.45).level(-2));

form([
  sec("intro", 8, "kick hat rim stab").filter_in(),
  sec("groove", 16, "kick hat ohat clap rim bass"),
  sec("break", 8, "pad stab acid").prog("A"),
  sec("build", 8, "kick hat clap acid roll").gap(),
  sec("drop", 16, "kick hat ohat clap rim ride bass stab pad").impact(),
  sec("outro", 8, "kick hat rim"),
]);

Why:

  • Phrygian. F phrygian has a G♭ a semitone above the tonic, and the progression only moves between F minor and G♭ (i i II i, two bars a chord). That half step is the darkness of techno; there is almost no harmony beyond it.
  • A rolling bass. Three sixteenths after every kick ([~ x x x]*4), never on the beat, so kick and bass interlock into one continuous low-end engine. saw_bass keeps it audible without piling on sub.
  • An acid line, sixteen steps with accents written as velocities: the acid preset’s resonant filter opens on the loud steps, which is the 303 sound. It plays in the break and the build, then leaves the drop to the drums and stabs.
  • Euclidean percussion. rim(5,16,2) spreads five rim shots over the bar against the four kicks, and the ride joins in the drop. Panned hats, rim and ride keep the dry, mono-heavy low end from making the whole track mono.
  • Stabs with long delay and reverb fill the space between hits, two per bar, and turn into echoes.
  • A clap roll instead of a snare: techno builds on the clap.
  ears: 'techno music' z +4.5 (closest confusion 'drum and bass music' +3.5); production z +1.3 vs 'a distorted clipped recording' +1.5; p_real 0.63
        sounds like: techno music, drum and bass music, tech house music, house music
  verdict: 86/100 (arc 0.82, genre 1.00, mix 0.92, production 0.45, theory 1.00). Fix first: nearly mono (correlation 0.97): widen pads, chords and effects; sounds about as much like a clipped recording as a professional mix: less drive and saturation, or a quieter master

A perfect genre score: nothing about this reads as anything but techno. The production score is the weak point; the ears hear the saturated 909, the drive of the acid and the techno master’s saturation as close to “distorted”. That is partly the style. Lowering the acid further, or keeping it out of the build too, raises production at some cost to character; the call is yours.

Try:

  • A 32-bar intro and groove, as techno DJs expect: change the bar counts and nothing else.
  • prog("B", "i") is there for a reason: put .prog("B") on the break for eight bars of pure F minor.
  • Replace the acid with stabs on every offbeat, struct("[~ x]*4"), for a 90s Detroit feel.

Trap and lofi

Two descendants of hip-hop at opposite ends: trap is fast hi-hats, a booming 808 and dark minor melodies at 140 BPM in half time; lofi is a dusty, swung loop of jazz chords at 84 BPM that sounds like a worn record. Both recipes need the default sample packs (claudius setup).

Trap: “Paper Satellite”

blank("trap");
title("Paper Satellite");
tempo(140); key("C harmonic minor"); swing(0.5);
prog("A", "Cm Ab Fm G");
prog("B", "Ab G Cm Cm");
bars_per_chord(2);

track("kick",  s("bd ~ ~ ~ ~ ~ ~ bd ~ ~ bd ~ ~ ~ ~ ~").bank("tr808"));
track("clap",  s("~ ~ [cp, sd] ~").bank("tr808").room(0.2));
track("hat",   s("<[hh*2 hh*2 hh*2 hh*2] [hh*2 hh*2 hh*2 hh*6] [hh*2 hh*2 hh*2 hh*2] [hh*2 hh*4 hh*2 hh*8]>")
                 .bank("tr808").gain("[0.9 0.6]*4").pan(0.12));
track("ohat",  s("~ ~ ~ oh ~ ~ ~ ~").bank("tr808").gain(0.5).pan(-0.2));
track("808",   note("<c2!2 ab1!2 f1!2 g1!2>").struct("x ~ ~ ~ ~ ~ ~ x ~ ~ x ~ ~ ~ ~ ~").s("808").legato(1.0).duck(0));

track("keys",  chord("prog").voicing(55, 72).s("piano").room(0.3).level(-1));
track("pad",   chord("prog").voicing(48, 70).s("choir").role("pad").room(0.4).level(-4));
track("lead",  n("<[7 ~ 6 7 4 ~ ~ ~] [~ ~ 2 3 4 ~ 2 ~] [7 ~ 6 7 5 ~ ~ ~] [~ ~ 4 5 7 ~ 5 ~] [5 ~ 4 5 3 ~ ~ ~] [~ ~ 2 3 5 ~ 3 ~] [6 ~ 4 6 8 ~ ~ ~] [4 ~ ~ ~ 6 ~ ~ ~]>")
                 .octave(4).s("bell").room(0.3).delay(0.25));

form([
  sec("intro", 8, "keys pad lead").filter_in(),
  sec("hook", 16, "kick clap hat ohat 808 keys pad lead").impact(),
  sec("verse", 16, "kick clap hat 808 keys"),
  sec("hook", 16, "kick clap hat ohat 808 keys pad lead").impact(),
  sec("outro", 8, "keys pad lead"),
]);

Why:

  • Half time. At 140 BPM the clap lands on beat 3 only (~ ~ [cp, sd] ~), so the groove feels like 70 BPM while the hats run at full speed. The clap is layered with the snare in one step ([cp, sd]), a standard trap trick for a thicker backbeat.
  • Hi-hat rolls. The hats are written beat by beat, with a sixteenth-triplet roll (hh*6) on the last beat of bar 2, and sixteenths on beat 2 and thirty-seconds on beat 4 of bar 4. The <...> cycles four bars, so the rolls come back at the same place in every phrase, and the accents ([0.9 0.6]*4) keep the eighths from sounding like a machine gun.
  • The 808 is the bass. It shares the kick’s rhythm exactly (x ~ ~ ~ ~ ~ ~ x ~ ~ x), holds each note until the next (legato(1.0)), and follows the chord roots two bars at a time (<c2!2 ab1!2 f1!2 g1!2>). duck(0) turns off the sidechain that pattern tracks get by default: ducking an 808 under a kick on the same beat would cut off its attack.
  • Harmonic minor. C harmonic minor gives G major as the fifth chord (Cm Ab Fm G), with a B that pulls hard back to C: the dark, classical tension of a lot of trap. The bell melody uses that B on the G chord.
  • Choir and piano. A sustained piano and a low choir pad are the cinematic bed under the drums; the verse drops the choir, the open hat and the lead so the hook has somewhere to return to.
  ears: 'trap beat' z +3.5 (closest confusion 'hip hop beat with heavy bass' +3.2); production z +1.1 vs 'a recording made on a phone' +0.8; p_real 0.27
        sounds like: trap beat, hip hop beat with heavy bass, lo-fi hip hop beat, a success chime
  verdict: 89/100 (arc 0.96, genre 0.81, mix 0.97, production 0.57, theory 1.00). Fix first: fizzy top end (air -15.6 dB, healthy up to -17); sounds about as much like a phone recording as a professional mix: a thin or narrow mix is the usual cause

The low end is the 808’s: a lot of sub, not much above it. That is trap’s sound, and trap’s profile tells the critic so: its sub may reach −1 dB of the whole. Drive on the 808 (mix("808", #{ drive: 12 })) adds harmonics above 60 Hz, where small speakers can hear it, at the same loudness; .level(4) on it as well makes it hit harder.

Try:

  • Glide: overlap the 808 notes (legato(1.2)) and they slide into each other, since the 808 preset has glide.
  • A sparser verse: section("verse", #{ layers: "kick clap 808 keys" }) takes the hats out too.
  • Swap the bell for pizzicato or flute (sampled), two other trap lead sounds.

Lofi: “Rain on the Avenue”

blank("lofi");
title("Rain on the Avenue");
tempo(84); key("F major"); swing(0.6);
prog("A", "Gm9 C9 Fmaj9 Dm9");
prog("B", "Bbmaj7 C9 Am7 Dm9");
bars_per_chord(1);

track("kick",  s("bd ~ ~ ~ ~ ~ ~ bd ~ ~ bd ~ ~ ~ ~ ~").bank("tr808").gain(0.9));
track("snare", s("~ sd ~ sd").bank("acoustic").gain(0.8).room(0.15));
track("hat",   s("hh*8?0.1").bank("tr808").gain("[0.6 0.35]*4").pan(0.2).level(4));
track("ohat",  s("~ ~ ~ ~ ~ ~ ~ oh").bank("tr808").gain(0.5).pan(-0.2).level(2));

track("bass",  note("<g1 c2 f1 d2>").struct("x ~ ~ x ~ x ~ ~").s("upright_bass").legato(0.9));
track("keys",  chord("prog").struct("x ~ ~ ~ ~ x ~ ~").voicing(50, 72).s("rhodes").room(0.3).late(0.02));
track("lead",  n("<[2 ~ ~ 1 2 ~ 4 ~] [~ ~ 4 3 1 ~ ~ ~] [2 ~ ~ 4 6 ~ 4 ~] [5 ~ 4 2 0 ~ ~ ~]>")
                 .octave(4).s("kalimba").room(0.35).delay(0.2).level(-1));

form([
  sec("intro", 4, "keys").filter_in(),
  sec("verse", 16, "kick snare hat bass keys"),
  sec("hook", 16, "kick snare hat ohat bass keys lead"),
  sec("verse", 16, "kick snare hat ohat bass keys lead"),
  sec("outro", 8, "keys lead"),
]);

Why:

  • The ii–V–I. Gm9 C9 Fmaj9 Dm9 is the jazz cadence in F major with ninths on every chord, then the relative minor to loop back. Lofi borrows its harmony from jazz; the ninths are what make it sound wistful rather than plain.
  • Heavy swing and lazy keys. Swing 0.6 drags every off-beat sixteenth, and .late(0.02) puts the Rhodes a hair behind the beat, like a player leaning back. The keys play on beat 1 and the and of 3 only.
  • Mixed kits. An 808 kick (mono, deep) with the acoustic kit’s snare (a real drum in a room), and 808 hats with ?0.1 dropping one hit in ten so the pattern never repeats exactly. The kick plays on beat 1, on the last sixteenth of beat 2 and on the and of 3: a boom-bap pattern that pushes into the second half of the bar.
  • Upright bass on the chord roots with long notes, and a kalimba melody: acoustic, plucked, warm.
  • The genre does the rest. blank("lofi") brings lofi’s mix: a bitcrusher and a lowpass on the drums bus, tape wow and flutter, vinyl crackle and hiss on the master, and a quiet −12.5 LUFS target. That darkening is why the hats are 4 dB up: without it the critic finds no air above 8 kHz.
  ears: 'lo-fi hip hop beat' z +4.0 (closest confusion 'hip hop beat with heavy bass' +3.3); production z +2.0 vs 'a distorted clipped recording' +1.5; p_real 0.32
        sounds like: lo-fi hip hop beat, hip hop beat with heavy bass, jazz music, minimal electronic music
  verdict: 90/100 (arc 0.90, genre 0.92, mix 0.97, production 0.64, theory 1.00). Fix first: recessed mids: the lead and chords are buried (mid -19.0 dB, healthy from -18); too much sub (boomy): lower the bass / kick, or highpass the music bus (sub -3.2 dB, healthy up to -4)

The ears hear hiss, because there is hiss: the vinyl on the master is the style. So lofi’s production reading leaves hiss out, and the thin sound of a phone recording that a lowpassed drum bus has, and compares the master with the next flaw instead, here clipping. The first version of this recipe used the acoustic kit’s kick and a vibraphone lead, and the critic read it as jazz (sounds more like 'jazz music' than 'lo-fi hip hop beat') and found the low end not mono (the acoustic kick is a stereo room recording). The 808 kick and the kalimba fixed both.

Try:

  • .s("piano") on the keys and .lpf(3000) for a muffled, sampled-from-a-record piano.
  • swing(0.66) for a full triplet shuffle.
  • A B section: sec("hook", 16, ...).prog("B") plays the Bbmaj7 C9 Am7 Dm9 progression, but write a second lead for it, since this one fits A.

Drum and bass, synthwave, future bass

Three styles that lean on synthesizers: liquid drum and bass with a rolling breakbeat under pads, synthwave’s eighties arpeggios and gated drums, and future bass’s pumping supersaw chords. All three use sampled drums, so they need the default sample packs (claudius setup).

Drum and bass: “Liquid Orbit”

blank("dnb");
title("Liquid Orbit");
tempo(174); key("F minor"); swing(0.5);
prog("A", "Fm Db Ab Eb");
prog("B", "Db Eb Fm Fm");
bars_per_chord(2);

track("kick",  s("bd ~ ~ ~ ~ ~ ~ ~ ~ ~ bd ~ ~ ~ ~ ~").bank("acoustic"));
track("snare", stack([s("~ sd ~ sd"), s("~ ~ ~ ~ ~ ~ ~ sd:1 ~ ~ sd:1 ~ ~ ~ ~ ~").gain(0.35)]).bank("acoustic").room(0.15));
track("hat",   s("hh*8").bank("acoustic").gain("[0.7 0.45]*4").pan(0.15));
track("ride",  s("[~ rd]*4").bank("acoustic").gain(0.45).pan(-0.2));

track("bass",  note("<f1!2 db1!2 ab1!2 eb1!2>").s("reese").legato(1.0));
track("pad",   chord("prog").voicing(48, 72).s("pad").role("pad").room(0.4).level(-2));
track("arp",   chord("prog").struct("x x").arp("updown").voicing(60, 76).s("pluck").role("arp").delay(0.3).room(0.3));
track("keys",  chord("prog").struct("x ~ ~ x ~ ~ x ~").voicing(55, 72).s("rhodes").room(0.3).level(-2));

form([
  sec("intro", 16, "pad arp").filter_in(),
  sec("build", 8, "hat ride pad arp keys").gap(),
  sec("drop", 32, "kick snare hat ride bass pad arp keys").impact(),
  sec("break", 16, "pad arp keys"),
  sec("drop", 16, "kick snare hat ride bass pad arp keys").impact(),
  sec("outro", 8, "pad arp"),
]);

Why:

  • The two-step. At 174 BPM, a kick on beat 1 and on the and of 3 (bd ~ ~ ~ ~ ~ ~ ~ ~ ~ bd), with the snare on 2 and 4: the basic drum and bass rhythm. Two ghost snares (variation sd:1, at a third of the level) in a separate layer of the stack() give it the shuffle of a chopped breakbeat; a gain pattern on the whole snare would have turned down the backbeat with them.
  • A recorded kit. The acoustic kit sounds like a sampled break, which is where the style comes from. The ride on the offbeats keeps the top end moving at half the hats’ rate.
  • Reese bass. Two detuned saws a bar at a time, on the chord roots two bars each, so the bass is one slow, growling movement under fast drums.
  • Three harmonic layers at three speeds: a pad holding the chords, a Rhodes on a slow syncopated rhythm, and a pluck arpeggio (updown over two events a bar) running eighths with a long delay.
  • Long sections. Drum and bass phrases are long; the first drop is 32 bars, and the song is 96 bars, 2:12 at 174 BPM. Anything under 90 seconds would cost form points.
  ears: 'drum and bass music' z +3.4 (closest confusion 'techno music' +2.7); production z +1.1 vs 'a low quality recording with hiss' +0.3; p_real 0.76
        sounds like: drum and bass music, energetic and driving music, synthwave music, inspirational corporate background music
  verdict: 93/100 (arc 0.96, genre 0.88, mix 0.99, production 0.72, theory 1.00). Fix first: dull 4-8 kHz: hats, claps and snare lack bite (presence -26.5 dB, healthy from -26)

The best score in the cookbook. The energy arc is nearly perfect because the sections are clearly layered: the intro and break have no drums at all, the drops have everything.

Try:

  • .s("wobble") on the bass for a heavier, neurofunk movement (its filter LFO is tempo-synced).
  • Busier hats: hh*16 with .gain("[0.7 0.3 0.5 0.3]*4") for a rolling sixteenth feel.
  • Replace the arp with a lead melody in F minor, with chord tones on beats 1 and 3 of each bar.

Synthwave: “Neon Harbor”

blank("synthwave");
title("Neon Harbor");
tempo(100); key("A minor"); swing(0.5);
prog("A", "Am F C G");
prog("B", "F G Am Am");
bars_per_chord(1);

track("kick",  s("bd ~ bd ~").bank("tr707"));
track("snare", s("~ sd ~ sd").bank("tr707").room(0.45));
track("hat",   s("hh*16").bank("tr707").gain("[0.6 0.3 0.45 0.3]*4").pan(0.2));

track("bass",  note("<[a1 a2]*4 [f1 f2]*4 [c2 c3]*4 [g1 g2]*4>").s("saw_bass").legato(0.8));
track("arp",   chord("prog").struct("x*4").arp("updown").voicing(57, 76).s("pluck").role("arp").delay(0.25).pan(0.15));
track("pad",   chord("prog").voicing(52, 76).s("strings").role("pad").room(0.45).level(-2));
track("lead",  n("<[4 ~ ~ 4 2 ~ 0 ~] [0 ~ ~ 2 5 ~ 4 ~] [4 ~ ~ 4 6 ~ 4 ~] [6 ~ ~ 4 3 ~ ~ ~]>")
                 .octave(4).s("square_lead").room(0.3).delay(0.2));

form([
  sec("intro", 8, "pad arp").filter_in(),
  sec("verse", 16, "kick snare hat bass arp pad"),
  sec("chorus", 16, "kick snare hat bass arp pad lead").impact(),
  sec("break", 8, "pad lead").prog("A"),
  sec("chorus", 16, "kick snare hat bass arp pad lead").impact(),
  sec("outro", 8, "pad arp"),
]);

Why:

  • The 707. Roland’s TR-707 is the drum machine of eighties pop. A kick on 1 and 3, a snare on 2 and 4 with a lot of reverb: the big, simple backbeat of the decade.
  • Octave bass. Each bar alternates the root and its octave in eighths ([a1 a2]*4), the driving bass of synth pop, on a buzzy saw_bass.
  • Arpeggios in sixteenths. chord("prog").struct("x*4").arp("updown") gives four notes per beat from a triad (up and down without repeating the ends is four steps), so the arpeggio is straight sixteenths and always on the right chord.
  • String machine and square lead. strings is the synth preset, slow attack and vibrato, more Juno than orchestra; square_lead is a mono square wave with delayed vibrato. Both are synthesized on purpose: this is the one style where “computer-generated” is the aesthetic.
  • A pop form. Verse, chorus, a short break with only pad and lead, and the chorus again: synthwave is song-shaped rather than DJ-shaped.
  ears: 'synthwave music' z +3.5 (closest confusion 'upbeat corporate pop music' +3.0); production z +0.5 vs 'a cheap synthesized beep' +0.3; p_real 0.61
        sounds like: synthwave music, inspirational corporate background music, uplifting and hopeful music, upbeat corporate pop music
  verdict: 90/100 (arc 0.95, genre 0.87, mix 1.00, production 0.55, theory 1.00). Fix first: sounds about as much like a cheap synth as a professional mix: sampled instruments in place of synth patches usually read better

The ears’ worst flaw is “a cheap synthesized beep”, which for synthwave is half the point. A sampled string_ensemble pad instead of the strings synth would raise production and make it less eighties.

Try:

  • tempo(86) makes it outrun-slow; tempo(118) makes it italo disco.
  • A tom fill in the last beat of every fourth bar, with a big reverb: track("toms", s("<~ ~ ~ [~ ~ ~ [lt mt ht ht]]>").bank("tr707").room(0.5)), added to the choruses’ layers.
  • key("F# minor") and render again: the chords, the arpeggio and the lead follow, because they are written with prog and n(). The bass is written in note names and stays in A; move it with .transpose(-3).

Future bass: “Golden Bloom”

blank("future_bass");
title("Golden Bloom");
tempo(150); key("D major"); swing(0.5);
prog("A", "Dmaj9 A Bm9 Gmaj9");
prog("B", "Gmaj9 A Bm9 Bm9");
bars_per_chord(1);

track("kick",  s("bd ~ ~ ~ ~ ~ ~ ~ ~ ~ bd ~ ~ ~ ~ ~").bank("tr909"));
track("clap",  s("~ ~ [cp, sd] ~").bank("tr808").room(0.25));
track("hat",   s("[~ hh]*4, ~ ~ ~ [~ hh hh hh]").bank("tr808").gain(0.6).pan(0.2).level(-3));

track("bass",   note("<d2 a1 b1 g1>").struct("x ~ ~ ~ ~ ~ ~ ~ ~ ~ x ~ ~ ~ ~ ~").s("saw_bass").legato(1.0).level(-3));
track("chords", chord("prog").struct("x ~ ~ x ~ ~ x ~ ~ ~ x ~ x ~ ~ ~").voicing(55, 79).s("supersaw").legato(0.9).duck(0.85).room(0.25).level(2));
track("pad",    chord("prog").voicing(50, 74).s("pad").role("pad").room(0.4).level(-3));
track("lead",   n("<[4 ~ 2 ~ 4 ~ 5 4] [6 ~ 4 ~ 6 ~ 7 6] [5 ~ 4 ~ 2 ~ 4 ~] [3 ~ 2 ~ 4 ~ ~ ~]>")
                  .octave(4).s("pluck").room(0.3).delay(0.25));

form([
  sec("intro", 8, "pad lead").filter_in(),
  sec("verse", 16, "kick clap hat bass pad lead"),
  sec("build", 8, "clap hat chords pad").gap(),
  sec("drop", 16, "kick clap hat bass chords lead").impact(),
  sec("break", 8, "pad lead"),
  sec("build", 8, "clap hat chords pad").gap(),
  sec("drop", 16, "kick clap hat bass chords lead pad").impact(),
  sec("outro", 8, "pad lead"),
]);

Why:

  • The pump. The supersaw chords duck under the kick at depth 0.85: they nearly vanish on every kick and swell back, which is the future-bass sound. The kick only plays twice a bar (beat 1 and the and of 3), so the swells are long.
  • Syncopated chords. x ~ ~ x ~ ~ x ~ ~ ~ x ~ x ~ ~ ~ is a sixteenth-note rhythm built from threes and twos, the chopped chord rhythm of the style. The chords only enter in the builds and drops; the verse keeps them back.
  • Major ninths. Dmaj9 A Bm9 Gmaj9 is the pop I V vi IV with ninths, bright and bittersweet.
  • Half-time drums at 150 BPM, with the layered clap and snare on beat 3, as in trap, and a hat skip at the end of each bar ([~ hh hh hh]).
  • A saw bass on the kick, not a sub: the first version used sub_bass and the critic found too much sub and a thin low end at once.
  ears: 'future bass music' z +2.4 (closest confusion 'dubstep music' +2.8); production z +1.1 vs 'a low quality recording with hiss' +0.3; p_real 0.53
        sounds like: synthwave music, hip hop beat with heavy bass, drum and bass music, techno music
  verdict: 85/100 (arc 0.96, genre 0.41, mix 0.96, production 0.70, theory 1.00). Fix first: fizzy top end (air -14.8 dB, healthy up to -17); sounds more like 'dubstep music' than 'future bass music'

Future bass is the style the ears are least sure of: it reads close to dubstep and synthwave, which share its sounds. The air band is high because a supersaw at the front of the mix is bright; .lpf(9000) on the chords tames it. An earlier version with a chip arpeggio read as “chiptune video game music”, and taking it out helped.

Try:

  • duck(0.6) on the chords for a subtler pump, or 0.95 for an extreme one.
  • Vocal chops in the drops: track("vox", note("<[~ d3 ~ a2] [~ c#3 ~ a2]>").s("voice").role("vocal").legato(0.5)), sung vowels on chord notes.
  • bars_per_chord(2) and a slower lead for a more anthemic, half-speed drop.

Trip-hop, big beat, electro house, nu-disco, filter house

Five styles where the production is half the song: dusty breaks and dub delays, distorted drums crushed in parallel, a bass riff dirtied in the drop only, a band glued on a bus of its own, a disco loop sweeping through a filter. Each recipe starts from a generated song and adds layers of processing with effect chains: parallel chains side by side, buses of your own, and settings that move by section, which follow the form when you move a section. They run without the sample packs; with them, the drums and some parts play recorded kits and instruments.

Trip-hop: “Grey Harbour”

song("trip_hop", 2);
title("Grey Harbour");
fx("keys", [
  #{ fx: "parallel", dry: 1, chains: [
    #{ amount: 0.35, fx: [#{ fx: "bitcrush", bits: 8, downsample: 4 }, #{ fx: "filter", mode: "bp", cutoff: 1400, res: 0.3 }] },
  ] },
  #{ fx: "phaser", rate_hz: 0.15, stages: 4, depth: 0.6, feedback: 0.3, mix: 0.35 },
]);
fx("lead", [
  #{ fx: "filter", mode: "hp", cutoff: 320 },
  #{ fx: "saturate", kind: "tape", drive_db: sections(2, #{ hook: [2, 8] }) },
]);
send_fx(#{ delay: #{ fx: "delay", beats: 0.75, feedback: sections(0.3, #{ "break": [0.3, 0.7], outro: [0.3, 0.8] }), damping: 0.6, pingpong: true, mix: 1 } });

Why:

  • What the genre already does. It is built on samples from free online libraries (Songs built on samples): here a 96 BPM drum break, whose own kick, snare and hat the drum lanes play; two bars of “Scary & Suspense”, a string phrase the song takes its key (E flat minor), tempo and chords from; vinyl crackle under it all; and a sub bass, cellos and a high melody around them. The drums go through parallel compression with tape drive and a crushed, lowpassed copy; the music bus dips 3.5 dB in the breaks. Without gathered samples the song plays electric piano and strings in the phrase’s place, and its drum lanes in the break’s.
  • A broken copy of the keys. A parallel chain bitcrushes the electric piano and band-passes it around 1.4 kHz, at a third of the level, under the clean sound: the chords keep their warmth and gain a worn, sampled edge.
  • A melody that wears in. The lead’s tape drive rises from 2 to 8 dB across each hook, by section, so the second half of every hook is grainier than the first.
  • Dub throws. The delay the sends feed repeats longer as each break goes on (feedback 0.3 to 0.7), and longer still into the outro, so the echoes swell where the drums drop out.
  ears: 'trip hop music' z +2.8 (closest confusion 'lo-fi hip hop beat' +3.5); production z +1.9 vs 'a distorted clipped recording' +1.1; p_real 0.83
        sounds like: lo-fi hip hop beat, house music, glitch hop music, hip hop beat with heavy bass
  verdict: 86/100 (arc 0.92, genre 0.46, mix 1.00, production 0.70, theory 1.00). Fix first: sounds more like 'lo-fi hip hop beat' than 'trip hop music'

Its credits.txt names the three samples, their authors and licences. Lo-fi hip hop is the style trip-hop is most often taken for: both are slow, swung, dusty and sampled, and the ears still hear lo-fi first here. A darker phrase and heavier drums pull it toward trip-hop; jazzy sevenths and comping electric piano pull it back toward lo-fi.

Try:

  • fx("strings", []) and hear how much of the mood the filter that opens in the hooks carried.
  • send_fx(#{ delay: #{ fx: "delay", beats: 1.5, feedback: 0.45, damping: 0.7, pingpong: true, mix: 1 } }) for slower, darker echoes.

Big beat: “Rubber Siren”

song("big_beat", 1);
title("Rubber Siren");
fx("riff", [
  #{ fx: "filter", mode: "ladder", cutoff: sections(1800, #{ build: [600, 6000], drop: 4000 }), res: 0.6, drive: 1.5 },
  #{ fx: "parallel", dry: 0.8, chains: [
    #{ amount: 0.5, fx: [#{ fx: "saturate", kind: "fold", drive_db: 14 }, #{ fx: "filter", mode: "hp", cutoff: 700 }] },
  ] },
  #{ fx: "chorus", rate_hz: 0.4, depth_ms: 4, delay_ms: 14, mix: 0.8 },
]);
master(#{ fx: [
  #{ fx: "eq", bands: [#{ kind: "highpass", freq: 30 }] },
  #{ fx: "compressor", threshold_db: -10, ratio: 2.2, attack_ms: 15, release_ms: 120, knee_db: 6 },
  #{ fx: "saturate", kind: "tanh", drive_db: sections(2, #{ drop: 4 }), mix: 0.4 },
] });

Why:

  • What the genre already does. A fast two-bar break on an acoustic kit (or a 909), crushed in parallel: one copy compressed at 12:1 and clipped, one bitcrushed to 8 bits and high-passed, both under the clean drums. An acid line whose ladder filter opens across each build and whose resonance climbs with it.
  • A riff that screams in the build. The riff’s own ladder filter sweeps from 600 Hz to 6 kHz across every build and settles at 4 kHz in the drops; a folded, high-passed copy beside it adds the fuzz without thinning its body, and a wide chorus pulls it out of the centre.
  • A master that gets hotter in the drops. The master’s saturator drives 4 dB in the drops and 2 elsewhere. The loudness stage still lands the song on its target, so the drops are denser rather than louder.
  ears: 'big beat breakbeat music with distorted drums' z +4.2 (closest confusion 'drum and bass music' +3.2); production z +1.7 vs 'a recording made on a phone' +0.5; p_real 0.84
        sounds like: funk music, playful and quirky music, jazz music, drum and bass music
  verdict: 96/100 (arc 0.95, genre 0.99, mix 1.00, production 0.81, theory 1.00)

Big beat accepts sounding distorted: the critic does not count “a distorted clipped recording” against it, as it does not count hiss against lo-fi.

Try:

  • part("acid", #{ seed: 7 }) for another acid line on the same filter moves.
  • tempo(138) for a faster, rave-ier take; the delay and the break stay in time.

Electro house: “Voltage Room”

song("electro_house", 2);
title("Voltage Room");
fx("lead", [
  #{ fx: "saturate", kind: "tanh", drive_db: 4, mix: 0.3 },
  #{ fx: "bitcrush", bits: sections(16, #{ build: [16, 6] }), downsample: 1, mix: sections(0, #{ build: [0, 0.6] }) },
  #{ fx: "width", width: sections(1, #{ drop: 1.5 }) },
]);
mix("chords", #{ bus: "synths" });
mix("pad", #{ bus: "synths" });
bus("synths", [
  #{ fx: "compressor", threshold_db: -18, ratio: 3, attack_ms: 10, release_ms: 100, makeup_db: 2 },
  #{ fx: "eq", bands: [#{ kind: "highpass", freq: 180 }] },
]);

Why:

  • What the genre already does. Four on the floor, a big clap, a saw bass riff in the mids pumped at 0.75 by the sidechain, and beside it a folded, high-passed copy whose filter opens across the builds and whose level rises in the drops: the dirt arrives with the drop.
  • A lead that breaks up before the drop. Across each build, the lead’s bitcrusher goes from 16 bits to 6 and its mix from nothing to 60 %: the hook disintegrates into the drop, then comes back clean and 1.5 times as wide.
  • A synth bus. The chords and the pad go to a bus of their own, compressed together and high-passed at 180 Hz, so they sit as one wall behind the lead and leave the low mids to the bass.
  ears: 'dirty electro house dance music with big synth leads' z +3.9 (closest confusion 'techno music' +3.5); production z +1.3 vs 'a cheap synthesized beep' +1.0; p_real 0.59
        sounds like: techno music, tech house music, house music, chiptune video game music
  verdict: 89/100 (arc 0.86, genre 0.86, mix 1.00, production 0.57, theory 1.00). Fix first: sounds about as much like a cheap synth as a professional mix: sampled instruments in place of synth patches usually read better

The ears place electro house between house and techno, which is where it comes from; the genre profile asks for the dirty bass and the big leads by name, so that the song has to have both to read as itself.

Try:

  • section("drop", #{ energy: 1.0, layers: "kick clap hat ohat bass lead" }) for a stripped, riff-only drop.
  • mix("bass", #{ duck: 0.9 }) for an even harder pump.

Nu-disco: “Mirrorball Lane”

song("nu_disco", 1);
title("Mirrorball Lane");
mix("guitar", #{ bus: "band" });
mix("keys", #{ bus: "band" });
mix("strings", #{ bus: "band" });
bus("band", [
  #{ fx: "eq", bands: [#{ kind: "highpass", freq: 120 }, #{ kind: "highshelf", freq: 8000, gain_db: 1.5 }] },
  #{ fx: "compressor", threshold_db: -20, ratio: 2.5, attack_ms: 20, release_ms: 150, makeup_db: 2 },
]);
fx("strings", [
  #{ fx: "phaser", rate_hz: 0.25, stages: 6, depth: 0.7, feedback: 0.35, mix: sections(0.2, #{ "break": [0.2, 0.7], hook: 0.3 }) },
  #{ fx: "width", width: 1.4, mono_below_hz: 200 },
]);

Why:

  • What the genre already does. Four on the floor with open hats on the offbeats, an octave or walking bass under a compressor, a muted guitar (a recorded clean guitar with the packs) chorused and compressed hard, electric piano on the offbeats, strings, and sometimes a brassy hook.
  • The band on one bus. Guitar, keys and strings go through one high-passed, brightened, compressed bus, the way a disco session glued its rhythm section and strings together before the mix.
  • Strings that swirl into the break. The phaser’s mix rises from 20 % to 70 % across the break and settles at 30 % in the hooks; the strings are spread 1.4 times wider, and mono below 200 Hz.
  ears: 'disco music' z +3.8 (closest confusion 'jazz music' +3.3); production z +1.8 vs 'a distorted clipped recording' +1.2; p_real 0.90
        sounds like: funk music, playful and quirky music, jazz music, celebratory and joyful music
  verdict: 91/100 (arc 0.91, genre 0.86, mix 1.00, production 0.63, theory 1.00)

Funk is what the ears hear first, and that is the family the style comes from, so the genre is not checked against it; jazz, house, synthwave and corporate pop are the confusions that count.

Try:

  • part("bass", #{ style: "funk" }) for a busier, more seventies bass: fingerstyle sixteenths with ghost notes.
  • key("D major") and prog("A", "Imaj7 vi7 ii7 V7") for a sunnier hook.

Filter house: “Velours”

song("filter_house", 2);
title("Velours");
fx("bass", [
  #{ fx: "filter", mode: "lp", cutoff: sections(900, #{ groove: [900, 1800], drop: 2600 }), res: 0.35 },
  #{ fx: "parallel", dry: 1, chains: [
    #{ amount: sections(0, #{ drop: 0.35 }), fx: [#{ fx: "saturate", kind: "tube", drive_db: 12 }, #{ fx: "filter", mode: "hp", cutoff: 400 }] },
  ] },
]);
master(#{ fx: [
  #{ fx: "eq", bands: [#{ kind: "highpass", freq: 30 }] },
  #{ fx: "compressor", threshold_db: -12, ratio: 2.2, attack_ms: 10, release_ms: 120, knee_db: 4 },
  #{ fx: "saturate", kind: "tape", drive_db: sections(1.5, #{ drop: 3 }), mix: 0.35 },
] });

Why:

  • What the genre already does. The loop, a disco phrase of chords pumped at 0.8 by the kick, goes through a resonant lowpass that follows the arrangement section by section: it opens across the intro and the groove, sits wide open in the drops, closes across each break and again across the outro. A phaser and a chorus move it, and a hard compressor squashes it.
  • A bass that follows the loop. Its own lowpass opens across the groove and sits at 2.6 kHz in the drops, where a tube-driven copy, high-passed at 400 Hz, comes in beside it.
  • A tape-hot drop. The master’s tape saturation drives twice as hard in the drops.
  ears: 'french house music with a filtered disco loop' z +4.2 (closest confusion 'house music' +3.7); production z +1.3 vs 'a low quality recording with hiss' +1.2; p_real 0.53
        sounds like: house music, tech house music, drum and bass music, techno music
  verdict: 87/100 (arc 0.95, genre 0.87, mix 0.93, production 0.51, theory 1.00). Fix first: dull 4-8 kHz: hats, claps and snare lack bite (presence -28.9 dB, healthy from -26); sounds about as much like a hissy recording as a professional mix: noise-built sounds (hats, shakers, risers) and long reverbs are the usual cause; fizzy top end (air -16.1 dB, healthy up to -17)

The filtered loop takes the presence band with it while it is closed, which the critic hears as dull hats; a brighter hat (drum_sound("hat", "tr909:hh")) or a clap a little louder (mix("clap", #{ level: 1.5 })) answers it.

Try:

  • section("break", #{ layers: "loop" }) for a break of nothing but the loop closing down.
  • fx("loop", []) to hear the loop unfiltered: the arrangement goes flat.

Dance-pop, neo-psychedelia, art rock, IDM, dub techno

Five more styles where the production carries the song: a pop hook that blooms in the chorus, guitars and organ swirling through phasers and flangers, a piano that breaks up as the song grows, bells crushed and drowned in turn, chords lost in their own echoes. As in the breaks and disco recipes, each starts from a generated song and adds layers with effect chains, and runs without the sample packs.

Dance-pop: “Neon Promise”

song("dance_pop", 1);
title("Neon Promise");
fx("hook", [
  #{ fx: "eq", bands: [#{ kind: "highpass", freq: 220 }, #{ kind: "peak", freq: 3000, gain_db: 2, q: 1 }] },
  #{ fx: "compressor", threshold_db: -20, ratio: 4, attack_ms: 3, release_ms: 70, makeup_db: 2 },
  #{ fx: "parallel", dry: 1, chains: [
    #{ amount: sections(0, #{ hook: 0.3 }), fx: [#{ fx: "reverb", decay: 3.5, predelay_ms: 40, mix: 1 }, #{ fx: "filter", mode: "hp", cutoff: 600 }] },
  ] },
]);
fx("chords", [#{ fx: "width", width: sections(1, #{ hook: 1.6 }), mono_below_hz: 200 }]);

Why:

  • What the genre already does. A song form (verse, pre-chorus, chorus, three times, with a bridge), a pop beat in the verses (the kick on 1 and 3 and a push) and four on the floor in the choruses, a pumping synth bass, plucked chords and a hook in a singer’s range.
  • A hook that sings. The hook is treated like a vocal: high-passed, a presence lift at 3 kHz, compressed at 4:1. In the choruses only, a long, high-passed reverb blooms beside it, a third as loud, the way a chorus vocal opens up.
  • A wider chorus. The chords widen to 1.6 in the choruses and stay as they are elsewhere, mono below 200 Hz.
  ears: 'upbeat dance pop music' z +3.0 (closest confusion 'house music' +2.9); production z +1.2 vs 'a low quality recording with hiss' +0.7; p_real 0.72
        sounds like: celebratory and joyful music, playful and quirky music, confident and cool music, techno music
  verdict: 87/100 (arc 0.87, genre 0.66, mix 1.00, production 0.64, theory 1.00)

Dance-pop and house share the kick, the tempo and the sidechain; the verses’ pop beat, the song form and a hook that carries the song are what tell them apart.

Try:

  • prog("A", "vi IV I V") for the minor-feeling version of the same four chords.
  • mix("hook", #{ level: 2 }) to push the hook in front, as a mix with a singer would.

Neo-psychedelia: “Saffron Halo”

song("neo_psychedelia", 3);
title("Saffron Halo");
fx("organ", [
  #{ fx: "tremolo", beats: 0.5, depth: 0.25 },
  #{ fx: "flanger", rate_hz: 0.08, depth_ms: 3, delay_ms: 4, feedback: 0.55, mix: sections(0.2, #{ "break": [0.2, 0.7] }) },
]);
fx("lead", [
  #{ fx: "tape", wow: 0.8, flutter: 0.35, drive_db: 3, lowpass_hz: 8000 },
  #{ fx: "delay", beats: 1.5, feedback: 0.5, damping: 0.6, pingpong: true, mix: sections(0.15, #{ outro: [0.15, 0.6] }) },
]);

Why:

  • What the genre already does. A loose acoustic kit, a droning electric bass with a folded copy beside it, guitars through a phaser that swirls harder in the bridge, a chorus, and fuzz that grows in the choruses; an organ with tremolo and chorus; a flanged pad; tape wobble on the master.
  • An organ that takes off. A slow flanger sweeps the organ, two parts dry to one wet, and across the bridge it rises to 70 %: the jet-plane swoosh of psychedelic records.
  • A melody that melts. Heavy tape wow on the lead, and a dotted-half-note delay of its own whose mix rises across the outro, so the song ends in echoes.
  ears: 'dreamy psychedelic pop music with phased guitars and organ' z +3.6 (closest confusion 'indie pop music' +3.0); production z +1.5 vs 'a distorted clipped recording' +0.5; p_real 0.57
        sounds like: indie pop music, funk music, rock music with electric guitars, upbeat corporate pop music
  verdict: 93/100 (arc 0.94, genre 0.89, mix 0.99, production 0.75, theory 1.00). Fix first: boxy or harsh mids (mid -7.4 dB, healthy up to -8)

The style reads as indie pop, rock or funk depending on the seed: a bass that walks pulls it toward funk, which is why the generated bass holds or pulses instead.

Try:

  • key("A lydian") for the floating, raised-fourth sound of the dreamier records.
  • fx("guitar", [#{ fx: "phaser", rate_hz: 0.15, stages: 8, depth: 0.9, feedback: 0.6, mix: 0.7 }]) for a slower, deeper swirl.

Art rock: “Glass Cathedral”

song("art_rock", 3);
title("Glass Cathedral");
fx("piano", [
  #{ fx: "parallel", dry: 1, chains: [
    #{ amount: sections(0, #{ verse: [0, 0.4], hook: 0.25 }), fx: [#{ fx: "bitcrush", bits: 6, downsample: 8 }, #{ fx: "filter", mode: "bp", cutoff: 1600, res: 0.35 }] },
  ] },
]);
fx("strings", [#{ fx: "filter", mode: "lp", cutoff: sections(1800, #{ build: [1800, 9000], hook: 9000 }), res: 0.1 }]);

Why:

  • What the genre already does. The arc of the song, as a band plays it: a quiet piano and a crushed, arpeggiated synth, then an acoustic kit and a finger or pick bass, a clean guitar arpeggio, a rise on the toms, and loud climaxes where two distorted power-chord guitars come in, panned wide, and the bass distorts. Then a fall to piano and strings, and the climax again. There are no risers or impacts, the chords are dark (here E harmonic minor), and tape runs over the mix. The arpeggio is gated harder across the verses, and the drums are compressed in parallel harder in the climaxes.
  • A piano that breaks up. Across each verse a bitcrushed, band-passed copy of the piano fades in beside the clean one, up to 40 %, and stays at a quarter in the climaxes: the acoustic sound turns digital as the song grows.
  • Strings that open into the climax. Their lowpass goes from 1.8 kHz to 9 kHz across the rise and stays open in the climaxes.
  ears: 'progressive rock music with piano, strings and synthesizers' z +3.9 (closest confusion 'inspirational corporate background music' +2.8); production z +1.4 vs 'a cheap synthesized beep' +0.5; p_real 0.54
        sounds like: uplifting and hopeful music, inspirational corporate background music, playful children's piano music, romantic music
  verdict: 92/100 (arc 0.99, genre 1.00, mix 0.93, production 0.71, theory 0.95). Fix first: not enough sub: the kick and bass lack weight (sub -15.6 dB, healthy from -14)

The arc is nearly perfect because the form is written as one: the climaxes have everything, and the intro, the fall and the outro have almost nothing. Piano and strings building to a climax is also the shape of stock inspirational music, the reading the ears keep closest. The distorted guitars and the tape keep this one rock.

Try:

  • tempo(76) for a slower, heavier version; the arpeggio’s eighths become a slow pulse.
  • section("fall", #{ layers: "piano" }) for a fall to the piano alone.

IDM: “Prism Engine”

song("idm", 2);
title("Prism Engine");
fx("bells", [
  #{ fx: "parallel", dry: sections(1, #{ drop: 0.6 }), chains: [
    #{ amount: sections(0, #{ groove: [0, 0.3], drop: 0.5 }), fx: [#{ fx: "bitcrush", bits: 5, downsample: 7 }, #{ fx: "filter", mode: "bp", cutoff: 2600, res: 0.45 }] },
    #{ amount: sections(0.1, #{ "break": [0.1, 0.6] }), fx: [#{ fx: "reverb", decay: 6, predelay_ms: 60, mix: 1 }] },
  ] },
]);
fx("bass", [#{ fx: "filter", mode: "ladder", cutoff: sections(600, #{ groove: [600, 1800], drop: 2400 }), res: 0.5, drive: 1.4 }]);

Why:

  • What the genre already does. Two-bar broken beats on synthesized drums, with ratchets on the hats and snares, ghost notes, euclidean clicks and toms; the drums crushed in parallel, and in the peak compressed and folded too; pads gated harder as each groove goes on; a delay in sixteenth-note dots that feeds back across the break.
  • Bells in three states. The bells run clean, crushed and drowned at once, in proportions that change by section: the crushed, band-passed copy rises across the grooves and takes half the sound in the peak, where the clean bells drop to 60 %; a six-second reverb swells across the break.
  • A bass that opens up. A resonant ladder filter on the bass opens across the grooves and stays open in the peak.
  ears: 'glitchy intelligent dance music with complex broken beats and bells' z +4.7 (closest confusion 'drum and bass music' +2.9); production z +1.3 vs 'a distorted clipped recording' +0.8; p_real 0.76
        sounds like: minimal electronic music, future bass music, drum and bass music, dubstep music
  verdict: 94/100 (arc 0.95, genre 1.00, mix 1.00, production 0.63, theory 1.00). Fix first: boxy or harsh mids (mid -8.0 dB, healthy up to -8)

IDM accepts “a cheap synthesized beep”: synthesized sounds are what the style is made of, so they are not counted against it.

Try:

  • tempo(136) and swing(0.5) for a faster, more rigid machine.
  • part("bells", #{ seed: 11 }) for another melody through the same three states.

Dub techno: “Harbour Fog”

song("dub_techno", 3);
title("Harbour Fog");
send_fx(#{
  delay: #{ fx: "delay", beats: 0.75, feedback: sections(0.45, #{ "break": [0.45, 0.75], drop: [0.5, 0.62] }), damping: 0.75, pingpong: true, mix: 1 },
  reverb: #{ fx: "reverb", decay: 3.2, damping: 0.65, predelay_ms: 35, width: 1.4, mix: 1, lowcut: 300 },
});
fx("rim", [#{ fx: "filter", mode: "bp", cutoff: sections(2500, #{ drop: [2500, 4500] }), res: 0.4 }]);

Why:

  • What the genre already does. A soft, steady kick, rimshots and quiet hats, one or two minor chords stabbed and sent half into the delay and half into the reverb, through a lowpass that breathes with the arrangement (it opens across the intro and the groove, closes across the break, opens again in the deep section); a deep sub; the music bus dips in the break.
  • Echoes that swell and settle. The delay the sends feed is darker than the genre’s, and its feedback climbs to 0.75 across the break, so the chord echoes pile up into a cloud, then settles between 0.5 and 0.62 in the deep section.
  • A rimshot that brightens. A resonant band-pass on the rim lane rises from 2.5 to 4.5 kHz across the deep section, and its delay send carries the change into the echoes.
  ears: 'dub techno music with echoing chords' z +3.5 (closest confusion 'techno music' +3.7); production z +1.5 vs 'a low quality recording with hiss' +0.9; p_real 0.75
        sounds like: techno music, drum and bass music, house music, tech house music
  verdict: 87/100 (arc 0.83, genre 0.71, mix 1.00, production 0.66, theory 1.00). Fix first: sounds more like 'techno music' than 'dub techno music with echoing chords'

Dub techno is techno, and the ears often say so; what makes it dub is the space around the chords, which the delay’s feedback and the long reverb give it.

Try:

  • bars_per_chord(8) and prog("A", "i7 i7 iv7 i7") for a slower, more hypnotic harmony.
  • mix("chords", #{ delay: 0.8 }) to send even more of the chords into the echoes.

Boom bap, alternative hip hop, UK drill, dubstep, UK garage, jungle

Six styles built on their drums and their bass: a sampler’s lazy swing, lush chords layered over a distorted 808, a half-time snare over sliding 808s, a wobble, a shuffle, a chopped breakbeat. As in the other recipes, each starts from a generated song and changes it with effect chains, and runs without the sample packs.

Boom bap: “Dusty Corners”

song("boom_bap", 3);
title("Dusty Corners");
bus("drums", [
  #{ fx: "compressor", threshold_db: -16, ratio: 4, attack_ms: 15, release_ms: 90, makeup_db: 3 },
  #{ fx: "saturate", kind: "tape", drive_db: 5, mix: 0.6 },
  #{ fx: "parallel", dry: 1, chains: [
    #{ amount: 0.3, fx: [#{ fx: "bitcrush", bits: 12, downsample: 2 }, #{ fx: "filter", mode: "hp", cutoff: 300 }] },
  ] },
]);
fx("keys", [
  #{ fx: "filter", mode: "hp", cutoff: 180 },
  #{ fx: "tape", wow: 0.3, flutter: 0.2, drive_db: 3, lowpass_hz: 10000 },
]);

Why:

  • What the genre already does. Three verses and hooks built on samples from free libraries (Songs built on samples). Here they are a hip hop drum loop, whose own kick, snare and hat the drum lanes play, a neo-soul chord loop the song takes its key and chords from, chopped and crushed to 12 bits, and a texture under them, with an organ bass and horns in the hooks. Without gathered samples, the drum lanes and a piano or Rhodes play in their place.
  • A sampler’s drums. The drums bus is compressed at 4:1 with an attack slow enough to let the kick and snare crack through, then saturated on tape; beside it, a third as loud, a copy crushed to 12 bits and half the sample rate, above 300 Hz, for the grit of an old sampler.
  • A loop that leaves room, without samples. When the keys play in the phrase’s place, they are high-passed at 180 Hz, as a sampled loop is thinned to sit over a bass, and run through a tape that wavers a little.
  ears: 'boom bap hip hop beat' z +3.3 (closest confusion 'lo-fi hip hop beat' +5.0); production z +1.7 vs 'a low bitrate mp3 with artifacts' +1.1; p_real 0.86
        sounds like: lo-fi hip hop beat, hip hop beat with heavy bass, glitch hop music, minimal electronic music
  verdict: 86/100 (arc 0.96, genre 0.45, mix 1.00, production 0.66, theory 1.00). Fix first: sounds more like 'lo-fi hip hop beat' than 'boom bap hip hop beat'

Its credits.txt names the three samples. Lo-fi hip hop grew out of boom bap, sampled loops and all, and the ears hear it first; the harder drums, the brighter mix and the song form of verses and hooks are what boom bap keeps of its own.

Try:

  • swing(0.62) for a lazier lean.
  • part("horns", #{ preset: "whistle" }) for a whistled hook in place of the horns.

Alternative hip hop: “Flower Garden”

song("alt_hip_hop", 2);
title("Flower Garden");
part("keys", #{ style: "charleston" });
fx("keys", [
  #{ fx: "tape", wow: 0.25, flutter: 0.2, drive_db: 2, lowpass_hz: 12000 },
]);
bus("bass", [
  #{ fx: "saturate", kind: "hard", drive_db: 8, mix: 0.5 },
  #{ fx: "filter", mode: "lp", cutoff: 6000 },
]);

Why:

  • What the genre already does. Ninth and eleventh chords in a major key with its minor iv borrowed and chromatic mediants (Imaj9 iii7 bIIImaj7 IVmaj9), on a Rhodes over a warm pad and strings; a distorted 808 with a fuzzy synth bass an octave over it, a double of the 808’s notes (fuzz); a swung kit with a clap on the snare; and a beat switch, eight or sixteen bars of half time on the second progression (switch) before the bridge and the last hook. Its songs are layered at complexity 0.8 unless asked otherwise: here the keys doubled an octave up, a shaker, a percussion line and an arpeggio come in where the song lifts.
  • The keys on the charleston, the dotted push that lets the chords breathe between the drums, and through tape, which wobbles them like a record.
  • The bass bus driven hard, so that the 808 and its double growl together, and a lowpass over them so that the growl stays under the keys.

With sampled: true (or --sampled), the song is built on a 70s soul or jazz record its producers would dig for, chopped under the same layers.

UK drill: “Southside Glide”

song("uk_drill", 2);
title("Southside Glide");
fx("bass", [
  #{ fx: "saturate", kind: "tube", drive_db: 6, mix: 0.5 },
  #{ fx: "eq", bands: [#{ kind: "peak", freq: 110, gain_db: 2, q: 1 }] },
]);
fx("keys", [
  #{ fx: "filter", mode: "lp", cutoff: sections(2500, #{ hook: [2500, 9000] }), res: 0.2 },
  #{ fx: "width", width: 1.5, mono_below_hz: 200 },
]);

Why:

  • What the genre already does. Around 140 BPM felt at half time: a snare on the third beat, answered late every other bar, hats in threes that roll, a sparse kick with an 808 that follows it; dark minor and harmonic minor chords on piano, strings or choir, and a bell or flute line in the hooks. The song opens on its hook.
  • An 808 that growls. Tube saturation, half wet, gives the 808 harmonics a phone speaker can play, and a 2 dB lift at 110 Hz gives it weight.
  • Keys that open in the hooks. A lowpass on the keys rises from 2.5 to 9 kHz across each hook and stays at 2.5 kHz elsewhere, so the verses stay dark; above 200 Hz they are widened to 1.5.
  ears: 'uk drill beat' z +2.4 (closest confusion 'hip hop beat with heavy bass' +3.4); production z +1.0 vs 'a recording made on a phone' +0.4; p_real 0.47
        sounds like: hip hop beat with heavy bass, trap beat, lo-fi hip hop beat, an electric piano
  verdict: 84/100 (arc 0.99, genre 0.29, mix 1.00, production 0.67, theory 1.00). Fix first: sounds more like 'hip hop beat with heavy bass' than 'uk drill beat'

Drill is a child of trap, and the ears hear the family; the snare that answers late and the hats in threes are what drill has of its own.

Try:

  • tempo(144) for a more urgent roll.
  • mix("bass", #{ level: 2 }) for an 808 that leads the mix.

Dubstep: “Concrete Tide”

song("dubstep", 4);
title("Concrete Tide");
fx("wobble", [
  #{ fx: "filter", mode: "lp", cutoff: sections(900, #{ drop: [600, 2400], drop2: [900, 3200] }), res: 0.5 },
  #{ fx: "saturate", kind: "fold", drive_db: 6, mix: 0.4 },
]);
fx("snare", [#{ fx: "parallel", dry: 1, chains: [
  #{ amount: 0.4, fx: [#{ fx: "reverb", decay: 1.8, predelay_ms: 10, mix: 1 }] },
] }]);

Why:

  • What the genre already does. 140 BPM at half time: a big snare on the third beat over a sparse kick; in the drops, a wobbling mid bass over a clean sub; pads on dark minor and phrygian chords; eight-bar risers into the drops and a stripped back break between them.
  • A wobble that opens. A resonant lowpass on the wobble climbs from 600 Hz to 2.4 kHz across the first drop and from 900 Hz to 3.2 kHz across the second, so the second hits harder; a wavefolder after it adds grit.
  • A bigger snare. A reverb of its own beside the snare, at 40 %, gives it a short, heavy tail.
  ears: 'dubstep music' z +3.1 (closest confusion 'drum and bass music' +3.3); production z +0.7 vs 'a distorted clipped recording' +0.9; p_real 0.39
        sounds like: hip hop beat with heavy bass, drum and bass music, dubstep music, synthwave music
  verdict: 86/100 (arc 1.00, genre 0.59, mix 0.99, production 0.46, theory 1.00). Fix first: sounds about as much like a clipped recording as a professional mix: less drive and saturation, or a quieter master; sounds more like 'drum and bass music' than 'dubstep music'; fizzy top end (air -16.6 dB, healthy up to -17)

Dubstep’s bass is meant to be dirty, and the ears read some of that as clipping; a gentler drive_db: 3 on the wavefolder, or master(#{ lufs: -10 }), trades some of the grit for a cleaner reading.

Try:

  • part("wobble", #{ style: "sustain" }) for one long wobble a chord.
  • mix("sub", #{ level: 2 }) for more weight under it.

UK garage: “Late Bus Home”

song("uk_garage", 2);
title("Late Bus Home");
swing(0.64);
fx("lead", [
  #{ fx: "filter", mode: "bp", cutoff: 1800, res: 0.3 },
  #{ fx: "delay", beats: 0.375, feedback: 0.35, pingpong: true, mix: 0.3 },
]);
fx("chords", [
  #{ fx: "chorus", rate_hz: 0.6, depth_ms: 3, delay_ms: 12, mix: 0.4 },
  #{ fx: "width", width: 1.4, mono_below_hz: 200 },
]);

Why:

  • What the genre already does. 130 to 136 BPM with a heavy shuffle: a two-step kick on the one and after the third beat, never on it; snares on 2 and 4 with ghost notes, shuffled hats, shakers and a rim; a bouncing sub or organ bass under minor 7th chords on organ, Rhodes or stabs; verses and hooks around a break.
  • More shuffle. swing(0.64) pushes every second sixteenth later still.
  • A lead like a chopped vocal. A band-pass at 1.8 kHz narrows the lead to a voice’s middle, and a ping-pong delay of a dotted sixteenth (0.375 beats) makes it skip between the speakers.
  • Chords that shimmer. A chorus and a width of 1.4 above 200 Hz spread the chords around the lead.
  ears: 'uk garage music' z +2.5 (closest confusion 'house music' +3.7); production z +1.6 vs 'a distorted clipped recording' +0.9; p_real 0.64
        sounds like: house music, tech house music, drum and bass music, funk music
  verdict: 83/100 (arc 0.93, genre 0.31, mix 1.00, production 0.68, theory 1.00). Fix first: sounds more like 'house music' than 'uk garage music'

Garage grew out of house, and the ears often say so; the kick that skips the third beat and the shuffle are what make it garage.

Try:

  • swing(0.6) for a tighter, straighter groove.
  • part("chords", #{ preset: "organ" }) for the organ stabs of the late 90s.

Jungle: “Rinse at Dawn”

song("jungle", 1);
title("Rinse at Dawn");
send_fx(#{ delay: #{ fx: "delay", beats: 0.75, feedback: sections(0.4, #{ "break": [0.4, 0.7] }), damping: 0.6, pingpong: true, mix: 1 } });
bus("drums", [
  #{ fx: "compressor", threshold_db: -14, ratio: 4, attack_ms: 3, release_ms: 60, makeup_db: 3 },
  #{ fx: "saturate", kind: "tube", drive_db: 3, mix: 0.4 },
]);
mix("chords", #{ delay: 0.5 });

Why:

  • What the genre already does. 160 to 172 BPM: a chopped breakbeat with ghost snares on an acoustic kit, a deep sub or reese bass moving at half the speed of the drums, dub chords and stabs sent into long delays, warm pads; a long intro, a build, and two drops around a break.
  • Echoes that pile up. The delay the sends feed climbs from 0.4 to 0.7 feedback across the break, so the chords’ echoes build into the second drop, and the chords send half their signal into it.
  • A squashed break. The drums bus is compressed at 4:1 with a 3 ms attack, the way a sampler’s break was squashed to make it roll, then warmed with a tube.
  ears: 'jungle music' z +2.7 (closest confusion 'drum and bass music' +2.9); production z +0.8 vs 'a low quality recording with hiss' +0.6; p_real 0.84
        sounds like: jazz music, energetic and driving music, drum and bass music, aggressive music
  verdict: 86/100 (arc 0.99, genre 0.54, mix 1.00, production 0.55, theory 1.00). Fix first: sounds about as much like a hissy recording as a professional mix: noise-built sounds (hats, shakers, risers) and long reverbs are the usual cause; sounds more like 'drum and bass music' than 'jungle music'

Jungle is drum and bass’s parent, and the ears know the family; the chopped break and the space around the chords are what make it jungle.

Try:

  • tempo(160) for a slower roll.
  • mix("pad", #{ reverb: 0.6 }) for a deeper fog behind the break.

Afrobeats, amapiano, reggaeton, trance, neo-soul

Five grooves from further afield: a clave and congas, a log drum under a steady kick, the dembow, a trance breakdown, a laid-back live kit. As in the other recipes, each starts from a generated song and changes it with effect chains, and runs without the sample packs.

Afrobeats: “Lagos Sunset”

song("afrobeats", 4);
title("Lagos Sunset");
fx("guitar", [
  #{ fx: "chorus", rate_hz: 0.8, depth_ms: 2, delay_ms: 10, mix: 0.35 },
  #{ fx: "delay", beats: 0.25, feedback: 0.25, pingpong: true, mix: 0.2 },
]);
mix("conga", #{ pan: -0.35, reverb: 0.2 });
mix("shaker", #{ pan: 0.4 });

Why:

  • What the genre already does. A kick on one and three with a pickup, claps on 2 and 4, a rim on the clave, shakers in sixteenths and congas tuned to the key; bright major and minor chords on guitar plucks and keys, a warm sub, a sung-sounding lead in the hooks; three hooks and a break.
  • A guitar that ripples. A quick chorus and a ping-pong echo a sixteenth long make the guitar’s plucks ripple between the speakers.
  • Percussion around the beat. The congas move left and into the reverb, the shaker right, so the groove fills the space around the kick and the claps.
  ears: 'afrobeats music' z +3.2 (closest confusion 'reggaeton music' +2.7); production z +1.6 vs 'a recording made on a phone' +0.5; p_real 0.74
        sounds like: playful and quirky music, upbeat corporate pop music, funk music, celebratory and joyful music
  verdict: 93/100 (arc 0.97, genre 0.80, mix 1.00, production 0.76, theory 1.00)

The ears hear afrobeats first and reggaeton second: the two share a dancing, syncopated kick, and the clave, the congas and the guitar are afrobeats’ own.

Try:

  • swing(0.56) for a looser roll.
  • part("lead", #{ preset: "whistle" }) for a whistled hook.

Amapiano: “Soweto Steps”

song("amapiano", 1);
title("Soweto Steps");
fx("logdrum", [
  #{ fx: "filter", mode: "lp", cutoff: sections(700, #{ drop: [700, 1800], drop2: [900, 2400] }), res: 0.35 },
  #{ fx: "saturate", kind: "tube", drive_db: 4, mix: 0.4 },
]);
fx("keys", [#{ fx: "parallel", dry: 1, chains: [
  #{ amount: sections(0, #{ break2: 0.4 }), fx: [#{ fx: "reverb", decay: 4, predelay_ms: 30, mix: 1 }, #{ fx: "filter", mode: "hp", cutoff: 500 }] },
] }]);

Why:

  • What the genre already does. A steady kick under shakers and offbeat open hats, a clap on 2 and 4 and a rim; the log drum, a pitched bass of short, woody notes in syncopated lines; jazzy minor 7th and 9th chords on piano and Rhodes, airy pads, a whistle or flute; long grooves, breaks that hold back, and drops.
  • A log drum that opens. A resonant lowpass on the log drum opens from 700 Hz to 1.8 kHz across the first drop and from 900 Hz to 2.4 kHz across the second, and a tube gives it its knock.
  • Keys that drift off. In the second break only, a long reverb beside the keys, high-passed at 500 Hz, comes in at 40 %.
  ears: 'amapiano music' z +2.3 (closest confusion 'afrobeats music' +4.2); production z +1.1 vs 'a low quality recording with hiss' +0.6; p_real 0.80
        sounds like: techno music, confident and cool music, drum and bass music, celebratory and joyful music
  verdict: 82/100 (arc 0.93, genre 0.26, mix 1.00, production 0.61, theory 1.00). Fix first: sounds more like 'afrobeats music' than 'amapiano music'; sounds about as much like a hissy recording as a professional mix: noise-built sounds (hats, shakers, risers) and long reverbs are the usual cause

Amapiano grew out of South African house, jazz and kwaito, and the ears, which know afrobeats better, often hear that instead; the log drum is what makes it amapiano. The hiss they hear is the shakers and open hats, which the genre lives on.

Try:

  • part("logdrum", #{ style: "kick_follow" }) for a log drum that answers the kick.
  • mix("lead", #{ delay: 0.45 }) for a whistle that echoes further.

Reggaeton: “Noche Eterna”

song("reggaeton", 4);
title("Noche Eterna");
fx("snare", [
  #{ fx: "eq", bands: [#{ kind: "peak", freq: 2500, gain_db: 3, q: 1 }] },
  #{ fx: "compressor", threshold_db: -18, ratio: 4, attack_ms: 2, release_ms: 50, makeup_db: 2 },
]);
fx("lead", [
  #{ fx: "saturate", kind: "tape", drive_db: 4 },
  #{ fx: "delay", beats: 0.75, feedback: 0.3, pingpong: true, mix: 0.25 },
]);

Why:

  • What the genre already does. The dembow: a kick on every beat and the snare after the first and before the third of each half bar; hats, a rim, shakers in the hooks; minor chords on plucks, piano or strings, a sub on the roots, a synth or voice-like lead; three hooks and a break.
  • A snare that snaps. A 3 dB lift at 2.5 kHz and fast compression bring the dembow’s snare to the front, where the rhythm lives.
  • A warmer lead. Tape saturation, then a ping-pong delay of a dotted eighth.
  ears: 'reggaeton music' z +4.0 (closest confusion 'afrobeats music' +4.3); production z +1.6 vs 'a cheap synthesized beep' +0.7; p_real 0.79
        sounds like: hip hop beat with heavy bass, trap beat, tech house music, house music
  verdict: 90/100 (arc 0.96, genre 0.68, mix 1.00, production 0.73, theory 1.00). Fix first: sounds more like 'afrobeats music' than 'reggaeton music'

The ears hear afrobeats and trap in it as well; the dembow is what tells reggaeton from both.

Try:

  • tempo(90) for a slower, heavier sway.
  • part("chords", #{ preset: "keys" }) for piano chords in place of the plucks.

Trance: “Afterglow”

song("trance", 4);
title("Afterglow");
fx("chords", [
  #{ fx: "filter", mode: "lp", cutoff: sections(4000, #{ "break": [800, 6000], build: [6000, 12000], drop: [12000] }), res: 0.25 },
  #{ fx: "width", width: 1.6, mono_below_hz: 200 },
]);

Why:

  • What the genre already does. Four on the floor with offbeat open hats and a clap on 2 and 4, a rolling bass, a euphoric minor progression under supersaw chords, a lead and an arpeggio; a long breakdown of pads, chords and the lead alone, a build that rolls on the clap, then the drop.
  • Chords that open with the song. A lowpass on the chords rises from 800 Hz to 6 kHz across the breakdown, on to 12 kHz across the build, and stays open in the drop; elsewhere it sits at 4 kHz. Above 200 Hz they are widened to 1.6.
  ears: 'trance music' z +3.8 (closest confusion 'techno music' +4.2); production z +1.0 vs 'a low quality recording with hiss' +0.7; p_real 0.74
        sounds like: techno music, drum and bass music, confident and cool music, chiptune video game music
  verdict: 87/100 (arc 0.94, genre 0.66, mix 1.00, production 0.57, theory 1.00). Fix first: sounds more like 'techno music' than 'trance music'; sounds about as much like a hissy recording as a professional mix: noise-built sounds (hats, shakers, risers) and long reverbs are the usual cause

Trance and techno share the kick, the tempo and the hats, and the ears hear techno in it; the breakdown and the chords that open across it are trance’s own.

Try:

  • bars_per_chord(4) for a slower, more hypnotic harmony.
  • mix("lead", #{ reverb: 0.5 }) for a lead that soars further back.

Neo-soul: “Velvet Hours”

song("neo_soul", 4);
title("Velvet Hours");
fx("keys", [
  #{ fx: "tremolo", beats: 0.5, depth: 0.2 },
  #{ fx: "chorus", rate_hz: 0.35, depth_ms: 3, delay_ms: 14, mix: 0.35 },
]);
bus("drums", [
  #{ fx: "compressor", threshold_db: -18, ratio: 3, attack_ms: 25, release_ms: 150, makeup_db: 3 },
  #{ fx: "saturate", kind: "tape", drive_db: 4, mix: 0.5 },
  #{ fx: "width", width: 1.0, mono_below_hz: 120 },
]);

Why:

  • What the genre already does. A laid-back groove on a live kit, with ghost notes and a cross-stick in the verses and a ride in the hooks; rich 9th and 11th chords on Rhodes, a round bass that walks between roots, soft strings, a sung-sounding lead; verses, hooks, and a bridge of the keys alone.
  • A Rhodes that breathes. A gentle tremolo in eighth notes and a slow chorus, the sound of a Rhodes’ own vibrato through a chorus pedal.
  • Drums from a record. The drums are compressed slowly, with a 25 ms attack that lets each hit keep its front, then warmed on tape; below 120 Hz they stay mono.
  ears: 'neo soul music' z +2.8 (closest confusion 'jazz music' +3.1); production z +1.5 vs 'a recording made on a phone' +0.4; p_real 0.64
        sounds like: jazz music, funk music, hip hop beat with heavy bass, indie pop music
  verdict: 89/100 (arc 0.97, genre 0.55, mix 1.00, production 0.78, theory 1.00). Fix first: sounds more like 'jazz music' than 'neo soul music'

Neo-soul sits between jazz and R&B, and the ears hear both; the laid-back kit under the Rhodes is what makes it neo-soul.

Try:

  • swing(0.6) for a lazier lean.
  • part("keys", #{ preset: "tine_piano" }) for a brighter electric piano.

Fusions

Genres joined by + make one, as many as you like: song("art_rock+idm", 4), claudius make --genre trip_hop+neo_soul+idm, or Fused with in the studio’s New song dialog (and in its remakes of a recording, and in Change the genre). The first genre leads: its tempo, keys and harmony, its form, its parts and its mix, and what the ears listen for. The last plays the drums, with its kits and its drums bus, where the first genre’s drums played. Every genre after the first lends its first sound and its writing styles to the parts of the same role, and brings in now and then the parts the genres before it have nothing like, and some of its progressions. Fusing genres has the details.

A fusion is a starting point: the ears hear it as whatever it now sounds like, which is the point of fusing.

Art rock with IDM’s drums: “Paper Satellites”

song("art_rock+idm", 4);
title("Paper Satellites");
fx("piano", [#{ fx: "parallel", dry: 1, chains: [
  #{ amount: sections(0, #{ hook: 0.3 }), fx: [#{ fx: "bitcrush", bits: 6, downsample: 6 }, #{ fx: "filter", mode: "bp", cutoff: 1800, res: 0.3 }] },
] }]);

Why:

  • Art rock’s song, IDM’s machine. The arc of art rock (a quiet piano and arpeggio, a rise, loud climaxes, a fall) over IDM’s synthesized two-bar broken beats with ratchets, clicks and toms, crushed in parallel on IDM’s drums bus.
  • Sounds from both. The arpeggio and the lead may pick up IDM’s bells and arpeggio sounds; the piano, strings, the clean guitar and the two distorted power-chord guitars of the climaxes stay art rock’s.
  • A piano that breaks up in the climaxes. A crushed, band-passed copy beside the piano at 30 % in the hooks.
  ears: 'progressive rock music with piano, strings and synthesizers' z +3.6 (closest confusion 'chiptune video game music' +2.9); production z +1.0 vs 'a recording made on a phone' +0.7; p_real 0.66
        sounds like: chiptune video game music, ambient synth pad music, uplifting and hopeful music, inspirational corporate background music
  verdict: 82/100 (arc 0.97, genre 0.93, mix 1.00, production 0.59, theory 0.99). Fix first: sounds close to stock background music ('chiptune video game music'): too clean and polite for 'progressive rock music with piano, strings and synthesizers'

The machine drums and IDM’s bells pull the song toward chiptune, which the critic counts against it as stock music; the arc stays nearly perfect, because the form is art rock’s. Fusing the other way, idm+art_rock, keeps IDM’s song over art rock’s acoustic kit.

Dub techno with trip-hop’s drums: “Low Tide Relay”

song("dub_techno+trip_hop", 2);
title("Low Tide Relay");

Why:

  • Echoes over a break. Dub techno’s chords drowned in feedback and reverb, its filter breathing with the arrangement, its sub, over trip-hop’s swung two-bar break and ghost snares on an acoustic kit, compressed and crushed in parallel on trip-hop’s drums bus, at dub techno’s 124 BPM.
  • No new parts to write. One line makes the whole song: what each genre is good at, taken from each.
  ears: 'dub techno music with echoing chords' z +2.9 (closest confusion 'house music' +3.4); production z +1.5 vs 'a distorted clipped recording' +0.8; p_real 0.70
        sounds like: trap beat, house music, hip hop beat with heavy bass, tech house music
  verdict: 85/100 (arc 0.88, genre 0.51, mix 1.00, production 0.68, theory 1.00). Fix first: sounds more like 'house music' than 'dub techno music with echoing chords'; a thin low end: bass or kick too quiet (low -7.2 dB, healthy from -7)

A heavy break at 124 BPM is closer to house and hip hop than to dub techno’s soft kick, and the ears say so. tempo(96) takes it back toward trip-hop, with the echoes kept.

Big beat with electro house’s drums: “Static Riot”

song("big_beat+electro_house", 3);
title("Static Riot");

Why:

  • Big beat’s riff and acid, a dance-floor kick. Big beat’s acid line, stabs and riff, its form of builds and drops, over electro house’s four-on-the-floor, claps and offbeat hats.
  • A bass between the two. The bass keeps big beat’s sounds and register and picks up electro house’s offbeat and syncopated styles.
  ears: 'big beat breakbeat music with distorted drums' z +2.8 (closest confusion 'techno music' +4.0); production z +1.4 vs 'a low quality recording with hiss' +0.7; p_real 0.65
        sounds like: techno music, drum and bass music, confident and cool music, tech house music
  verdict: 84/100 (arc 0.93, genre 0.36, mix 1.00, production 0.68, theory 0.99). Fix first: sounds more like 'techno music' than 'big beat breakbeat music with distorted drums'; 7% of the lead is outside E minor

Without its breakbeat, big beat reads as techno: the breaks are most of what the style is. The fusion the other way round, electro_house+big_beat, keeps electro house’s form and puts big beat’s crushed breaks under it.

Try:

  • song("trip_hop+idm", 3) for trip-hop’s dark chords and strings over IDM’s broken machine beats.
  • song("nu_disco+filter_house", 7) for a disco band over filter house’s drums, squashed on its drums bus.
  • Three genres: song("house+dnb+lofi", 2) is house’s song with lo-fi’s drums, and drum and bass’s sounds, styles and parts lent to it on the way: the last genre plays the drums.

The drum machine

A drum lane is a step sequencer, and each step can do more than strike. trig() gives a step what a drum machine’s trig gives it:

  • a chance to play, and a condition for when;
  • a ratchet of strokes inside it, and a flam;
  • a nudge off the grid;
  • and what it changes in the sound for that stroke: its pitch, decay, tone and pan.

A lane can also keep a time and feel of its own. lane() gives it a length (a polymeter against the others), a speed, a swing and a groove, and groove() takes a groove from a record. A beat you play or beatbox, or a drum loop, becomes the lanes’ steps (Beatbox a beat).

In the studio, right-click a step in the step sequencer and open Trig, or right-click a lane for its time and feel. Each recipe below starts from a generated song and changes only its drums.

Hats that roll

Trap’s hats move in rolls. A ratchet puts several strokes inside one sixteenth, and a ramp makes them swell into the next beat or fade away from it. A roll on the condition "1:2" comes every other time round the pattern, so the four-bar loop doesn’t repeat itself exactly.

song("trap", 5);
trig("hat", 6, #{ ratchet: 4, ramp: 1 });                   // 64ths swelling into beat 3
trig("hat", 30, #{ ratchet: 3, ramp: -1 });                 // a triplet fading out of bar 2
trig("hat", 46, #{ ratchet: 6, ramp: 1, cond: "1:2" });     // a long roll, every other time round
trig("perc", 14, #{ pitch: 5, flam: 12 });

A turnaround in the last bar

A condition counts the times round a pattern from each section’s start, so "last" plays only in the bar before the next section. That’s where a drummer puts a fill: a clap pickup, a kick, a doubled hat. "4:4" plays every fourth time round, closing each four-bar phrase.

song("house", 3);
trig("clap", 15, #{ v: 0.6, cond: "last" });
trig("kick", 14, #{ v: 0.7, cond: "last" });
trig("hat", 14, #{ ratchet: 2, cond: "4:4" });
trig("ohat", 10, #{ prob: 0.5, decay: 1.6 });                // now and then, longer

Loose and late

Lofi leans back. Snares nudged a little late of the grid drag, ghost notes that play only some of the time keep the groove from looping, and a flam thickens the backbeat. The chance is drawn afresh each time round, but it’s the same in every render of the song, so what you like stays.

song("lofi", 2);
trig("snare", 4, #{ nudge: 0.12 });
trig("snare", 12, #{ nudge: 0.12, flam: 14 });
trig("snare", 7, #{ v: 0.3, prob: 0.5 });                   // a ghost, half the time
trig("hat", 11, #{ v: 0.4, prob: 0.6, nudge: 0.2 });

Hats that move

Locks change the sound for one stroke. Hats panned left and right of each other, one darker, one shorter, make a two-step pattern that moves in the stereo field.

song("dnb", 4);
trig("hat", 2, #{ pan: -0.5, tone: 0.3 });
trig("hat", 6, #{ pan: 0.5, tone: -0.3 });
trig("hat", 10, #{ pan: -0.5, decay: 0.6 });
trig("hat", 14, #{ pan: 0.5, decay: 0.6 });
trig("snare", 4, #{ flam: 10 });
trig("snare", 12, #{ flam: 10 });

Percussion by chance

Techno’s percussion can be generative: steps that play only sometimes, each at its own pitch, never come round the same way twice in a row. A ride that doubles every time round but the first lets the section in clean.

song("techno", 7);
for s in [1, 3, 9, 11] {
    trig("perc", s, #{ prob: 0.35, pitch: s % 3 - 1 });
}
trig("ride", 14, #{ ratchet: 2, cond: "!first" });

Judged without the listening models, these five render at 95 to 97 out of 100, as their songs do without the trigs.

Hats in twelve

A lane of its own length comes round on its own cycle. Hats twelve steps long start their pattern again every three beats while the kick keeps four, so the accent wanders across the bar and lands back on the downbeat after three bars. Percussion ten steps long turns against both.

song("techno", 7);
drum("hat", "x.xx.xx.x.x.x.xx");
lane("hat", #{ length: 12 });
lane("perc", #{ length: 10 });

Triplets on a straight beat

A lane’s speed scales its steps. At 0.75 its sixteenths become eighth-note triplets, three to a beat, and at 1.5 sixteenth-note triplets, over drums that stay straight.

song("trap", 5);
drum("perc", "x.xx.x.xx.x.x.xx");
lane("perc", #{ speed: 0.75 });
lane("ohat", #{ speed: 1.5 });

Swing on one lane

The song can play straight while one lane swings: hats at 62% over a kick and clap on the grid. swing: 0 gives the lane the song’s swing again.

song("house", 3);
swing(0.5);
lane("hat", #{ swing: 0.62 });
lane("shaker", #{ swing: 0.58 });

A dragged feel

dilla drags each off-beat and the backbeat late by its own amount and leans on the downbeats, the way a drummer plays behind the beat. Lanes take as much of a groove as groove_amount gives them: the hats all of it and the snare a little less, so the backbeat drags less than the hats.

song("lofi", 2);
lane("hat", #{ groove: "dilla" });
lane("snare", #{ groove: "dilla", groove_amount: 0.6 });
lane("kick", #{ groove: "dilla", groove_amount: 0.4 });

Behind and ahead of the beat

J Dilla’s drunk feel was not random: on an MPC he moved whole pads with its shift timing, the snare a few dozen milliseconds late on every backbeat, the kick a little early, the hats left on the grid, so that the parts pull against each other the same way in every bar. late does that to a lane, or to a part: every hit that many milliseconds behind the beat (ahead, below zero), at any tempo. The genres that play that way do it already, a neo-soul snare 18 to 38 ms behind and its bass 12 to 30, a boom bap snare 8 to 24; lane() and part() set your own.

song("neo_soul", 4);
lane("snare", #{ late: 32 });    // laid back
lane("kick", #{ late: -8 });     // pushed
part("bass", #{ late: 20 });     // the bass behind the drums
humanize(0.6);                   // and each hit drifts besides, as a player's does

humanize() is the other half: a drift, not a jitter. Each hit moves with the ones around it, behind for a while and ahead for a while, as a drummer’s does (see humanize()), up to about 15 ms at 1. In the studio, a lane’s settings in the sequencer have a feel slider for its late.

A groove from a record

A break, a loop or a whole song has a feel of its own: how late its off-beats come, whether its backbeat sits behind the beat, which sixteenths are hit hardest. groove() measures that in a recording’s drums and keeps it with the song, and the lanes play in it as in one of claudius’ own. In the studio, choose the file under New song, From a recording, then Put the song’s drums in its groove and Take its groove. An assistant calls extract_groove.

song("lofi", 2);
groove("break", "loops/Funk Break 96bpm.wav");     // the tempo in the name is the one it is measured at
lane("hat", #{ groove: "break" });
lane("snare", #{ groove: "break", groove_amount: 0.8 });

The tempo matters most. claudius hears it from the drums when it isn’t given, but a loop’s tempo heard can come out twice or half what it is, and then the groove is measured against the wrong sixteenths. A tempo in the file’s name or a third argument (groove("break", "loops/break.wav", 96)) is used as it is, and extract_groove and the studio also take an Apple Loop’s from GarageBand’s catalogue.

Beatbox a beat

The quickest way to a beat of your own is to make it with your mouth. Record a take over a section with the studio’s Record button: a kick (“b”), a snare (“k” or “pf”) and hats (“ts”), a bar or two round and round. Then right-click the take in the arrangement, choose Turn it into drums and a length. claudius names each hit, puts it on the song’s grid, folds the times round into the pattern, writes it into the kick, snare (or clap) and hat lanes, and mutes the take. A hat you did only every other time round plays half the time.

The lanes then take everything above: a ratchet on the hats, a groove, a length of their own. An assistant does the same with transcribe_drums, and a drum loop goes in as a file:

song("lofi", 2);
drums_from("loops/Lazy Break 85bpm.wav", #{ bars: 2 });
lane("hat", #{ groove: "dilla" });
trig("hat", 14, #{ ratchet: 3, ramp: 1 });

It names a kick, a snare and a hat well when the sounds are clear; check what it wrote in the step sequencer, as a beatboxed snare’s release can come out as a kick a step later.

Remaking a song from audio

claudius remake listens to a recording and reworks it in any genre, so that it stays the song it is: all of it plays through, its voice and its chords as they are, without its drums and its bass (taken apart from the rest with earshot’s models; without them, its low end), in its own sections and on its chords, with the genre’s drums, bass and mix under it. With --flip it makes a new song of the genre on the recording’s own sound instead: its hook and passage after passage of it, its voice in them, its drums and a flip cut from all over it, under the genre’s drums, bass, parts and mix. With --rebuild it makes the song itself again, every part of it played on claudius’s sounds: its drums, its bass and the rest as the notes and hits it plays, so that each can be changed. With --skeleton it writes a new song on the recording’s skeleton only (tempo, key, chords, sections, drum habits, the style of its bass), with none of its audio. This recipe remakes a song whose answers we know, so you can see what the analysis gets right and what it gets wrong, reworks it, flips it, rebuilds it, remakes its skeleton, then edits and evolves the result.

A song to remake

Any audio file ffmpeg can read works. To follow along without one, render the house recipe from House, deep house and techno first: claudius script house.rhai writes out/house-glass-avenue-1/song.mp3. We know exactly what is in it: 122 BPM, A minor, swing 0.58, the progression Am7 Fmaj7 Dm7 Em7 (i7 VImaj7 iv7 v7), and six sections (intro 8, groove 16, break 8, build 8, drop 16, outro 8).

What the analysis hears

claudius analyze out/house-glass-avenue-1/song.mp3
122.0 BPM (pulse clarity 0.66), A minor (confidence 0.76), swing 0.50, 64 bars from 0.00 s
  progression A: III VImaj7 iv7 v7  |  B: VImaj7 v7 v7 i7  (1 bar(s) per chord)
  bars 1-8  intro (A)  energy 0.86, kick hats
  bars 9-24  drop (B)  energy 0.94, kick bass hats
  bars 25-32  break (C)  energy 0.30
  bars 33-40  build (A)  energy 0.86, kick hats
  bars 41-56  drop (B)  energy 1.00, kick bass hats
  bars 57-64  drop (B)  energy 0.96, kick bass hats
  kick  xx--X.--Xx--X.--
  snare .-x-X-.-.-x-X-.-
  hats  x-X-X-X-x-X-X-X-
  bass style: syncopated

Against what we know:

  • Tempo, key, length, bar grid: right. The tempo comes from onset autocorrelation, the tempo whose grid lies on the onsets best and the kit’s backbeat (how), and a grid fitted to the kicks; the key from the chroma of the whole song.
  • Swing: missed (0.50 for 0.58). Swing is measured from the hi-hats on the off-beat sixteenths, and this song’s hats play eighths.
  • Progression: three chords out of four right. The first chord, Am7 (A C E G), was heard as C (III): it contains all of C major’s notes, and chords are read from chroma, the energy of each note name per bar.
  • Sections: all six, each to the bar (8, 16, 8, 8, 16, 8 bars), and the letter of the music each plays: the intro and the build play the same (A), the groove, the drop and the outro the same (B), the break its own (C) (how the sections are heard). No one sings, so they are named as a dance track’s are: the intro, the break, the build and the drop as written; the groove and the outro, the drop’s music and nearly as loud, are heard as drops too. It reports which sections have kick, bass and hats.
  • Drum habits: per sixteenth step, X very likely, x likely, . occasional, - never. The kick is on every beat, each one’s tail heard on the sixteenth after it. The snare line shows the claps on steps 5 and 13 (beats 2 and 4) plus hat energy leaking into the snare’s band on the eighths.
  • Bass style: syncopated, a fair name for an offbeat line with pickups.

The analysis is approximate by nature (it reads a finished mix, its stems apart where the ears are installed) and works best on steady electronic music.

Rework it in another genre

claudius remake out/house-glass-avenue-1/song.mp3 --genre trap --seed 3

It prints the analysis again, then the rework:

Faded Engine — trap at 122 BPM in A minor, 64 bars (2:06)
  progression A: i7 VImaj7 iv7 VII III VImaj7 iv7 v7
  progression B: i7 VImaj7 iv7 v i7 VImaj7 iv7 v i VImaj7 iv7 v i VI iv7 v
  progression C: VImaj7 v7 v7 i7 i v7 v7 i7
  progression D: v VImaj7 iv7 v7 v VImaj7 iv7 v
  progression E: III VImaj7 iv7 v7 i7 VImaj7 iv7 v7 i VImaj7 iv7 v7 i VImaj7 iv7 v
  progression F: bIImaj7 VI iv v bIImaj7 VI iv v7
  form: intro 8 | drop 16 | break 8 | build 8 | drop2 16 | drop3 8
  tracks: kick (sampled bd (tr808:bd)), snare (sampled sd (tr808:sd)), clap (sampled cp (tr808:cp)), hat (sampled hh (tr808:hh)), ohat (sampled oh (tr808:oh)), perc (sampled rim (tr808:rim)), bass (a rack of synth patch '808' + synth patch '808'), original (loop song, all of it (122 BPM)), crash (synth crash), impact (synth impact), reverse_crash (synth reverse_crash)
  ears: 'trap beat' z +4.0 (closest confusion 'hip hop beat with heavy bass' +4.2); production z +1.6 vs 'a low quality recording with hiss' +0.7; p_real 0.68
        sounds like: hip hop beat with heavy bass, trap beat, drum and bass music, lo-fi hip hop beat
  wrote out/remake-trap-faded-engine-3/song.mp3

Its history says what it kept:

reworked from 'song.mp3': all 64 bars of it, its voice and its chords as they are, without its drums and its bass, in its own 6 sections and on its chords; trap's bass, kick, snare, clap, hat, ohat, perc under it
  • All of it, from its first downbeat to its end, plays through as original, at its own speed and pitch: the piano, the pad, the voice and the lead as they are, each section brought halfway to the middle of their levels (by 9 dB at most, the gain moving over the last beat before a section), since the genre’s drums keep one level: a quiet verse would all but go under them, and a loud hook over them. The song keeps its shape, at half its range. With earshot’s models, claudius takes the recording apart into its vocals, drums, bass and the rest (Spleeter’s nets, about 8 s for a four-minute song, kept for the next time). original is then the rest, cut under 80 Hz, which leaves the drums and the low end to trap’s kick and 808. When the recording sings, its voice plays all through on a track of its own, vocals, mixed as a voice, so that you can turn it up, give it effects of its own or mute it, and the history says “its voice on a track of its own (vocals)”. Without the models, what strikes is taken out of it (fft::harmonic keeps what sustains), and so is what is under 150 Hz, voice and all, and the history says “its low end” instead. What is not its voice goes through the genre’s treatment of a phrase it samples: boom bap’s tape and 12 bits, lo-fi’s dust. A band that speeds up and slows down is followed beat for beat, and its bars are each stretched to one length, so that it stays on the song’s grid.
  • Its own sections, as the analysis heard them, bar for bar: the song is as long as the recording and changes where it changes.
  • Its chords, a bar each, a progression for each run of them (A, B, C), which the bass plays the roots of. The analysis hears roots best, and the bass is all of the genre that plays a pitch: chords, pads, keys and leads of the genre would play against the recording’s own, and against it where a chord was heard wrong (bIImaj7 above).
  • Its swing, so that the genre’s drums sit with it.

The tempo is the recording’s own, or double it when that is nearer the genre’s range (two bars of the song to each of the recording’s, a chord each), so that nothing is stretched: 122 BPM is under trap’s 130 to 150, and 244 further from it. It is halved (one bar of the song to two of the recording’s) when that is nearer and the recording holds each chord through two bars, three pairs of bars in four, since a bar of the song plays one chord: a recording of 170 BPM reworked as hip hop plays at 85, its beat in half time, where at 170 hip hop’s drums would play as fast as drum and bass. A slow song heard at twice its tempo, whose bars are each half of one, always holds its chords so, and plays at its own again. The reply says when the song is in double or half time. --bpm sets another tempo, and stretches the recording to it. The recording is kept in out/takes/song/, beside the song. To hear more of the genre, add its parts back over the recording in a script, or turn the recording down where they play.

Flip it into another genre

claudius remake out/house-glass-avenue-1/song.mp3 --genre deep_house --seed 3 --flip

It prints the analysis again, then the flip:

Faded Engine — deep_house at 122 BPM in A minor, 120 bars (3:56)
  progression A: i7 VImaj7 iv7 v i7 VImaj7 iv7 v
  progression A2: VImaj7 VII v7 i7 i VII v7 i7
  progression A3: III VImaj7 iv7 v7 III VImaj7 iv7 v
  progression A4: III VImaj7 iv7 v7 i7 VImaj7 iv7 v7 i VImaj7 iv7 v7 i VImaj7 iv7 v bIImaj7 VI iv v bIImaj7 VI iv v7
  progression A5: i7 VImaj7 iv7 v i7 VImaj7 iv7 v i VImaj7 iv7 v i VI iv7 v
  progression B: iiø7 v7 i7 i7 iiø7 v7 i7 VI7
  form: intro 16 | groove 16 | break 8 | build 8 | drop 32 | drop2 32 | outro 8
  tracks: kick (sampled bd (tr909:bd)), clap (sampled cp (tr909:cp)), hat (sampled hh (tr909:hh)), shaker (shaker cut from 'Loose Leaf Beat Shaker' (Apple Loops)), perc (sampled rim (tr909:rim)), bass (synth patch 'deep_bass'), chords (synth patch 'keys'), pad (synth patch 'vowel_pad'), lead (synth patch 'epiano'), top (loop 'Driving Fast Shaker' (House, Apple Loops) (128 BPM)), sample2 (loop song, another passage (122 BPM)), flip (loop song, a flip of it (122 BPM)), sample3 (loop song, bars 33-40 (122 BPM)), sample4 (loop song, bars 41-64 (122 BPM)), sample5 (loop song, bars 9-24 (122 BPM)), crash (synth crash), riser (synth riser)
  master: -11.1 LUFS, true peak -1.0 dBTP (pre-master -12.1 LUFS); done in 13.4 s
  ears: 'house music' z +3.7 (closest confusion 'techno music' +3.5); production z +1.6 vs 'a low quality recording with hiss' +1.4; p_real 0.78
        sounds like: house music, drum and bass music, techno music, tech house music
        aesthetics (of 10): enjoyment 7.4, production quality 8.2; held out: usefulness 8.1, complexity 5.5
  verdict: 90/100 (aesthetics 0.95, arc 0.94, genre 0.79, mix 1.00, production 0.55, theory 1.00, time 1.00). Fix first: sounds about as much like a hissy recording as a professional mix: noise-built sounds (hats, shakers, risers) and long reverbs are the usual cause
  wrote out/remake-deep_house-faded-engine-3/song.mp3

Its history says what came from where:

remixed from 'song.mp3': its hook (bars 9-16) without its drums, in its own key for the voice in it; another passage of it (bars 25-32); a flip of 64 half beats from 26 of its bars in intro, outro; on through it as the song goes (build bars 33-40, drop bars 41-64, drop2 bars 9-24)
sampled: phrase 'song', filtered until it lifts (another passage of it in groove, break, build)

Its bars from 9 to 64 play somewhere in the song: the groove and the break the other passage, 25 to 32; the build its own build, 33 to 40; the first drop 41 to 64 on end, from where that build resolves; the second drop 9 to 24. Its first eight bars play only in pieces of the flip.

  • Its hook, eight bars of it (here 9 to 16, the first of the music the analysis hears as its drops) without its drums, chosen as the Sample window chooses a loop of the hook (from the sections with chords that pull most toward being one, the bars that stand for most of the recording, loop most cleanly and play most alone), is the phrase the song is built on, as a song built on samples is: the song takes its key, its chords (progression A) and a tempo it plays at from it. A hook a voice sings in plays in its own key, at its own tempo or stretched, rather than sped up or slowed down, which would make its singer a chipmunk or a giant, and the history says “in its own key for the voice in it”. Chipmunk soul, whose sound is just that, speeds it up anyway. Without the models, it is what sustains of the recording.
  • Another passage of it, the eight bars of its break with the pad and the chords, chosen as the Sample window chooses a loop of another passage (from none of the hook’s sections, unlike the hook, looping cleanly), plays as sample2 in the groove and the break, on its own chords (progression A2).
  • On through it: every other section but the intro, the breaks and the outro plays as many of the recording’s bars on end as it has itself (32 at most), of the kind it plays (a drop’s or a hook’s, or the rest’s), from where the recording has the most of them that no section played before it, each on its own track and its own bars’ chords: the build plays bars 33 to 40 as sample3 (A3), the first drop 41 to 64 as sample4 (A4), and the second drop 9 to 24 as sample5 (A5). So a flip goes through the recording rather than coming round to the same two passages for minutes. A build lands where the recording’s own does: a section that builds into a drop plays the bars that end where one of the recording’s choruses or drops starts (first those its own builds lead into: here its build, 33 to 40, into its drop at 41), and the drop after it plays on from there, so the song’s drop comes where the recording resolves rather than while it is still building.
  • Its voice, when it sings (the ears hear a voice, or a pitch in a voice’s range carries a third of a phrase), sings on in those passages as it sang there: with the stems apart they are all of it but its drums. Without a voice, with the stems apart, they are its bass and the rest.
  • Its drums are the break in a genre that plays one (deep house does not; boom bap and trip-hop do): the drum break the Sample window would offer first, where its drums play most alone, busy and looping cleanly; its drum stem, apart, with the models.
  • A flip of it plays in the intro and the outro: eight bars of half beats, each from another bar of the recording that plays the hook’s chord there, at the same place in its bar (now and then another), here 26 of its bars, so the song is heard in pieces from all over it, still on the hook’s chords. Each piece is as loud as the hook (its bar brought to the hook’s level, by 18 dB at most), so a piece of a quiet verse does not drop away beside one of the chorus.

Everything else is the genre’s: the drums, the bass, the chords and the pad written on the hook’s chords, the form and the mix. The tempo here is the recording’s own, 122 BPM, which deep house plays; another genre plays it at a multiple of it, faster or slower by whole semitones as a sampler plays a record, or chopped onto its grid at two thirds to three halves of it (as boom bap, this one plays at 92, three quarters of it, chopped onto the grid at its own pitch, and its own drums are the break). The pieces are kept in out/takes/song/, beside the song. Made again with another --seed, a flip draws its hook, its other passage and its break anew among the good ones, the best most often, as Another take draws pieces in the Sample window.

Rebuild it, every note yours to change

claudius remake out/house-glass-avenue-1/song.mp3 --genre house --seed 3 --rebuild

A rebuild makes the song itself again, with every part played on claudius’s sounds rather than the recording’s: its drums, its bass and the rest of it become notes and hits you can edit, in its own sections and on its chords. It prints the analysis again, then the rebuilt song:

Faded Engine — house at 122 BPM in A minor, 64 bars (2:06)
  progression A: i7 VImaj7 iv7 v7 III VImaj7 iv7 v7
  progression B: i7 VImaj7 iv7 v i7 VImaj7 iv7 v i VImaj7 iv7 v i VI iv7 v
  progression C: VImaj7 VII v7 i7 i VII v7 i7
  progression D: III VImaj7 iv7 v7 III VImaj7 iv7 v
  progression E: III VImaj7 iv7 v7 i7 VImaj7 iv7 v7 i VImaj7 iv7 v7 i VImaj7 iv7 v
  progression F: bIImaj7 VI iv v bIImaj7 VI iv v7
  form: intro 8 | drop 16 | break 8 | build 8 | drop2 16 | drop3 8
  tracks: kick (sampled bd (tr909:bd)), clap (sampled cp (tr909:cp)), hat (sampled hh (tr909:hh)), bass (synth patch 'deep_bass'), keys (sampled wurlitzer (epianos:wurlitzer)), crash (synth crash)
  master: -10.0 LUFS, true peak -1.0 dBTP (pre-master -13.2 LUFS); done in 8.6 s
  wrote out/remake-house-faded-engine-3/song.mp3

Its history says what it heard:

rebuilt from 'song.mp3': its 6 sections bar for bar, on its chords; its drums struck as it strikes them, each section's folded into a pattern of its own (113 on clap, 236 on hat, 233 on kick); its bass as 229 notes on bass; the rest of it as 860 notes on keys
  • Its form is its sections bar for bar, each on a progression of its own, its bars’ chords: A to F, one to a section, so that every section plays its own notes rather than the first section’s again.
  • Its drums come from its drum stem (with the ears; see below): every kick, snare or clap and hat struck where it strikes them, each section’s hits folded into a pattern of its own (the section’s drum variant, intro, drop, break …), a step struck only some of the times round played with that chance, and each lane as far behind or ahead of the beat as the recording’s hits on the beats are. A clap struck with the kick, as house claps on two and four, is heard as both.
  • Its bass and the rest of it are the notes Spotify’s Basic Pitch hears in their stems, on the sixteenth-note grid: the bass one note at a time on bass, the rest (keys, guitars, synths, pads together) chords and all on keys, without the faint copies an instrument’s overtones leave over its notes, or the notes another instrument leaves in a stem 18 dB under its own.
  • Its voice, when it sings, stays on a track of its own, vocals, as a rework keeps it, and the melody it sings is written out on melody, which plays in no section until you put it in one (toggle_layer, or layers in a script). This song’s vowel line is too quiet to count as a voice.

Against what this song is, as measured when the rebuild came out: 99% of the rebuilt kicks and 98% of its hats land on sixteenths the song strikes, and they miss none of them; about two thirds of its claps are there. Nine of ten bass notes are its own (the pitch on the same sixteenth), and about two thirds of the piano’s, the pad’s and the Rhodes’ notes. The sections are the analysis’s, all six of them to the bar. The genre and the seed choose the sounds (a 909 kick, a Wurlitzer for the keys): change them with set_part or a script like any song’s.

Without the ears’ models there are no stems or notes to hear: a rebuild then plays the drum habits of its busiest sections wherever its kick is heard, and the genre’s bass and chord parts on its chords, as a song on its skeleton does, and its history says so.

On its skeleton only

claudius remake out/house-glass-avenue-1/song.mp3 --genre deep_house --seed 3 --skeleton

It prints the analysis again, then the new song:

Faded Engine — deep_house at 122 BPM in A minor, 64 bars (2:06)
  progression A: III VImaj7 iv7 v7
  progression B: VImaj7 VII v7 i7
  form: intro1 8 | drop2 16 | break3 8 | build4 8 | drop5 16 | drop6 8
  tracks: kick (sampled bd (tr909:bd)), clap (sampled cp (tr909:cp)), hat (sampled hh (tr909:hh)), shaker (shaker cut from 'Loose Leaf Beat Shaker' (Apple Loops)), perc (sampled rim (tr909:rim)), bass (synth patch 'deep_bass'), chords (synth patch 'keys'), pad (synth patch 'vowel_pad'), lead (synth patch 'epiano'), top (loop 'Deep Blue Void Hi-Hat' (House, Apple Loops) (126 BPM)), crash (synth crash), riser (synth riser), downlifter (synth downlifter), reverse_crash (synth reverse_crash)
  master: -11.0 LUFS, true peak -1.0 dBTP (pre-master -10.7 LUFS); done in 9.8 s
  ears: 'house music' z +3.3 (closest confusion 'techno music' +3.4); production z +1.8 vs 'a low quality recording with hiss' +0.8; p_real 0.83
        sounds like: techno music, tech house music, playful and quirky music, house music
        aesthetics (of 10): enjoyment 7.7, production quality 8.4; held out: usefulness 8.3, complexity 5.9
  verdict: 67/100 (aesthetics 1.00, arc 1.00, genre 0.68, mix 0.92, production 0.74, theory 0.97, time 1.00). Fix first: sounds close to stock background music ('upbeat corporate pop music'): too clean and polite for 'house music'; nearly mono (correlation 0.97): widen pads, chords and effects; 2:06 long, where deep house's forms run 3:21-3:32
  wrote out/remake-deep_house-faded-engine-3/song.mp3

What the remake keeps from the analysis, and what it takes from the genre:

from the recordingfrom the genre and the seed
tempo (rounded), key, swingevery sound: kits, Apple Loops one-shots, synth patches, sampled instruments
progressions A and B, bars per chordevery part’s notes, written by the theory engine on those progressions
the sections: lengths (rounded to 4 bars), what each is and its energywhich parts play where, chosen from what the analysis heard (kick, bass, hats) and each section’s energy
the kick, snare and hat habits, as the drum lanes’ step probabilitiesthe drum lanes the genre has, and its other lanes
the bass style, when the genre has itthe mix, transitions and master

The sections get builds and gaps before drops and impacts on them, an intro (if there is one) filters in, and breaks, intros and outros play progression B. On this machine the shaker was cut from Apple Loops and the top percussion is an Apple Loop; without Apple Loops, the shaker is synthesized and the loop is left out.

The arc check is perfect, the sections clearly layered; the critic marks it down as close to stock background music, too clean and polite for house, and short for deep house.

Edit the remake

Every remake is an ordinary song. A script can fix what the analysis got wrong and replace any part with your own. This one corrects the first chord of the skeleton remake and puts a written motif in place of the generated lead:

prog("A", "i7 VImaj7 iv7 v7");
track("lead", n("<[4 ~ 4 2 4 ~ 6 4] [5 ~ 5 4 2 ~ 0 ~] [3 ~ 3 2 0 ~ 2 3] [4 ~ ~ 6 4 ~ ~ ~]>")
                .octave(4).s("rhodes").room(0.3).delay(0.2));
claudius script fix.rhai --on out/remake-deep_house-faded-engine-3
  verdict: 71/100 (aesthetics 1.00, arc 1.00, genre 0.85, mix 1.00, production 0.72, theory 0.97, time 1.00). Fix first: sounds close to stock background music ('upbeat corporate pop music'): too clean and polite for 'house music'; 2:06 long, where deep house's forms run 3:21-3:32
  wrote out/deep_house-faded-engine-3/song.mp3

The generated parts follow the corrected progression on their own, since they are written from it. The new lead takes the generated lead’s place in every section it played in, all six. The critic likes it more (71 against 67, its genre 0.85 against 0.68), though taste is something you settle by listening. The edited song is written to out/deep_house-faded-engine-3/, next to the remake rather than over it, because a script names its folder after the genre, title and seed.

Evolve it

claudius evolve --genre deep_house --from out/deep_house-faded-engine-3/blueprint.json

starts evolution from the edited remake instead of fresh songs. The lead, a pattern track, keeps its notes; the drums, parts, mix, form and global feel are mutated.

Other ways to use its audio

Besides a rework, a flip and a rebuild, two commands put the recording’s sound in a song:

  • claudius chop song.mp3 cuts the recording into bar loops (2 bars by default, --bars) and drum one-shots, writes them into out/chops/, and adds them to your user library, where generated songs can pick them up as drum sounds. --find "a vocal chop" also uses the ears to cut out the moments that best match a description, three per description (--top).
  • claudius make --genre house --sample out/chops/<loop>.wav flips a recording into a new song: warped to the song’s tempo, transposed to its key, re-sliced in half-beat pieces (or played straight) and placed in the high-energy sections, as a track named sample1.

Only use recordings you have the right to use this way. analyze and remake --skeleton take nothing but measurements from a recording; a rework puts all of its audio in your song, and a flip, chop and make --sample pieces of it. A rebuild plays its composition note for note (its melodies, its chords, its bass line), and its voice when it sings: releasing it is a cover at least, which needs the song’s licence, and with the voice the recording’s too.

From an assistant, the MCP tools analyze and remake take a file path and do the same as the commands (remake with flip: true for a flip, rebuild: true for a rebuild, sampled: false for the skeleton only); a remake becomes the song open in the studio.

Overview

A claudius script is a Rhai program with two kinds of functions on top:

  • Song edits change the song that is open: tempo(124), key("A minor"), prog("A", "i7 VImaj7 iv7 v7"), mix("pad", #{ level: -4 }), form([...]).
  • Patterns describe music in Strudel-style mini-notation, and track(name, pattern) turns a pattern into a track of the song: track("hats", s("[~ hh]*4")).

Here is a complete song in eight lines. It builds everything itself, so it runs anywhere:

blank("house");
tempo(122); key("A minor"); prog("A", "Am7 Fmaj7 Dm7 Em7"); bars_per_chord(1);
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4"));
track("bass",  chord("prog").root().struct("~ x ~ x ~ x ~ [x x]").s("organ_bass").legato(0.7));
track("keys",  chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").room(0.25));
track("lead",  n("<[4 ~ 4 2] [5 ~ 2 0] [3 ~ 0 2] [4 ~ ~ ~]>").octave(4).s("pluck").delay(0.2));
form([sec("intro", 8, "drums keys").filter_in(), sec("drop", 16, "*").impact(),
      sec("break", 8, "keys lead"), sec("drop", 16, "*")]);

You hear a four-on-the-floor house groove in A minor at 122 BPM: kick, claps on 2 and 4, offbeat hats, an organ bass on the offbeats playing the root of each chord, electric piano stabs and a plucked melody. The intro opens a lowpass filter over eight bars, the first drop lands with a crash.

How a script runs

A script runs top to bottom against the current song and changes only what it names. There is always a current song:

  • song("house", 7) replaces it with a song the generator writes (genre, seed); see song().
  • blank("house") replaces it with an empty song: one 8-bar section, no tracks, and the tonic chord as its only progression; see blank().
  • Without either, edits apply to the song that is open: the one in the studio, the folder you pass with claudius script --on, or, when there is none, a blank house song.

Edits apply in order, so a later line sees what an earlier line did. key("D minor") after prog() transposes the progression; prog() after key() reads chord names in the new key. Where order matters, the reference says so.

When the script ends, the song is arranged, rendered and judged. That happens outside the script: a script only describes the song.

Where scripts run

wherehow
command lineclaudius script song.rhai renders into out/<genre>-<title>-<seed>/; --on <folder> edits a saved song; --print prints the result as a script instead of rendering
studiothe script tab runs against the open song; every change renders and is judged in the background
assistantsthe MCP tool run_script (read script_reference first)
HTTPPOST /api/command with {"cmd": "run_script", "code": "..."}

claudius reference prints the compact reference that assistants get.

The examples in this reference

Every example in these pages is run by the test suite. An example that starts with song(...) or blank(...) stands alone. One that does not edits a generated song, the same one every time: song("house", 9), “Crimson Tide”, 124 BPM in G dorian, with the tracks kick clap hat ohat shaker perc bass chords pad lead arp, the sections intro groove break drop outro and the progressions A and B. To try such an example yourself, put song("house", 9); on the line before it.

// on the open song: faster, and the hats out of the intro
tempo(126);
layer("intro", "hat", false);

Reading the reference

Signatures use plain names for parameters and say what each one accepts:

tempo(bpm)                 // bpm: number, 40..240
drum(lane, variant, steps, per_bar)

number means an integer or a decimal (124 or 124.5). integer means a whole number: Rhai keeps the two apart, so bars_per_chord(1.5) is an error, not a rounding. A pattern string is mini-notation in quotes. Where a number is clamped into a range rather than rejected, the reference says so.

The pages

Rhai in five minutes

Scripts are written in Rhai, a small scripting language that reads like JavaScript or Rust. You need very little of it: most scripts are a list of function calls. This page covers the parts that come up in music scripts. The Rhai book has the rest.

Statements and comments

Statements end with ;. Line breaks inside a call are fine, which is how long patterns stay readable:

blank("house");   // a comment runs to the end of the line
/* a block comment
   spans lines */
track("lead", n("0 2 4 7")
                .scale("A:minor")
                .s("pluck"));

Values

valuewrittennotes
integer8, -3whole numbers; some functions accept only these
decimal0.5, 124.0, -6.5
string"bd sd"patterns are strings; \" and \\ escape
booleantrue, false
array["kick", "hat"]
map#{ level: -3, pan: 0.2 }the options of mix(), part(), section(), song(), master(); a key the function does not know is an error
closure|x| x.fast(2)a small function, passed to every(), sometimes(), off() …

Integers and decimals are different types. Functions that take a count (ply(2), every(4, ...), octave(4), bars_per_chord(2), the bars of sec()) need an integer, and a decimal there is an error:

blank("house");
track("lead", n("0 2 4").octave(4.5));
Error: Function not found: octave (Pattern, f64) (line 2, position 26)

“Function not found” with a list of argument types almost always means one argument has the wrong type. Functions that take an amount (tempo(), gain(), level(), swing()) accept both.

Variables

let makes a variable, const a constant. Variables hold anything, patterns included:

blank("house");
let groove = "x ~ ~ x ~ ~ x ~";
const ROOTS = "<a1 f1 c2 g1>";
track("bass", note(ROOTS).struct(groove).s("sub_bass"));
track("keys", chord("<Am F C G>").struct(groove).s("epiano"));

Both tracks share one rhythm, so the bass and the chords hit together.

Calling methods

A pattern method is called with a dot and returns a new pattern, so calls chain left to right. Each method applies to everything before it:

blank("house");
track("hats", s("hh*8").gain(0.6).pan(0.2).every(4, |x| x.fast(2)));

Closures

Higher-order methods take a closure: |x| ... is a function of one pattern, x, that returns a pattern. A closure can use variables from around it:

blank("house");
let up = 7;
track("lead", n("0 2 4 2").scale("A:minor").every(2, |x| x.add(up)).s("pluck"));

When the song prints as a script, the closure prints with the value it used: .every(2, |x| x.add(7)).

Functions, loops and conditions

Rhai has fn, for, while, if and switch. They are useful for building strings and for repeated edits:

song("house", 9);

// the same reverb send on several tracks
for t in ["chords", "pad", "lead"] {
    mix(t, #{ reverb: 0.3 });
}

// a function that writes a pattern string
fn every_beat(sound) { sound + " " + sound + " " + sound + " " + sound }
track("rim", s(every_beat("rim")).gain(0.5));

let late_night = true;
if late_night { tempo(120); swing(0.56); } else { tempo(126); }

A function defined with fn cannot see variables from outside it; pass what it needs as arguments. Ranges are written 0..4 (0 to 3) and 0..=4 (0 to 4).

Strings

Strings join with +. Backtick strings fill in ${...}:

blank("house");
let n = 4;
track("kick", s(`bd*${n}`));
track("hats", s("[~ hh]" + "*4"));

Printing

print(x) and debug(x) write to the script’s log: the terminal for claudius script, the log panel in the studio. Lines printed by the script come after the lines claudius writes for each track().

blank("house");
track("kick", s("bd*4"));
print("kick written");
track kick: bd
kick written

What a script cannot do

A script cannot read or write files (except audio files named in .s(), see Sounds), import modules, call eval, or run forever. It stops with an error after 10 seconds or 5,000,000 operations. The full list is in Errors and limits.

Mini-notation

Mini-notation is the little language inside pattern strings: s("bd*4, [~ cp]*2"). It comes from TidalCycles and Strudel, and claudius implements most of it. This page is the exact grammar, taken from the tokenizer and parser in crates/claudius/src/pattern/mini.rs, followed by what each construct means and where claudius differs from Strudel.

A string is parsed when the pattern is built, so a syntax error stops the script at the line that wrote it.

Grammar

Two levels: the tokenizer cuts the string into tokens, the parser builds a pattern from them. Whitespace separates tokens and is otherwise ignored, so a ! and a! are the same.

Tokens

token       = symbol | rest | hold | number | word ;
symbol      = "[" | "]" | "<" | ">" | "{" | "}" | "(" | ")"
            | "," | "|" | "*" | "/" | "@" | "!" | "?" ;
rest        = "~"
            | "-" ;                (* only when the next character is not a digit or "." *)
hold        = "_" ;                (* only when the next character is not a word character *)
number      = num-start { digit | "." } ;
                                   (* not followed by a word character other than ".";
                                      the text must read as a decimal number, else "bad number" *)
word        = word-start { word-char | "/" ascii-letter }
                                   (* a slash followed by a letter stays in the word: "F/A", "V7/V" *)
            | num-start { digit | "." } word-char-not-dot { word-char } ;
                                   (* "808bd", "3am", "1-2": a number run that continues into letters *)
word-start  = letter | "#" | ":" | "_" | "'" | "^" ;
num-start   = digit | "-" | "." ;
word-char   = letter | digit | "#" | ":" | "." | "_" | "'" | "-" | "^" ;
word-char-not-dot = word-char - "." ;
letter      = (* any Unicode alphabetic character *) ;
ascii-letter = "a" .. "z" | "A" .. "Z" ;
digit       = (* any Unicode digit *) ;

A / followed by a letter belongs to the word it is in, so slash chords (F/A) and applied chords (V7/V) are single words. Anywhere else / is the “slower” modifier: [a b]/2, a/2.

Any other character is an error: unexpected '%' in "bd%4". That includes %, $, =, +, ", °, ♭ and ♯, so write bb rather than B♭, and o or dim rather than °.

Patterns

pattern     = stack ;                                (* the whole string *)
stack       = sequence { ( "," | "|" ) sequence } ;
sequence    = { step | "_" | "!" } ;                 (* may be empty: silence *)
step        = atom { modifier } ;
atom        = "[" stack "]"
            | "{" stack "}"
            | "<" alternation
            | "~" | "-"
            | word
            | number ;
alternation = alt-sequence { "," alt-sequence } ">" ;
alt-sequence = { step | "!" } ;
modifier    = "*" number
            | "/" number
            | "@" number
            | "!" [ number ]
            | "?" [ number ]
            | "(" number "," number [ "," number ] ")" ;

Rules the grammar alone does not show:

  • In a sequence, _ adds one step of length to the step before it, and a bare ! repeats the step before it. Either one with no step before it is an error.
  • Inside < >, _ and | are errors, and @ weights are read but ignored.
  • * and / take a number above 0 and up to 256.
  • A stack mixes , and | badly: write [a | b], c, not a | b, c (see Differences).
  • Size limits: a string is at most 4096 characters, brackets nest at most 64 deep, a sequence has at most 1024 steps, !n repeats a step at most 256 times, and a euclidean rhythm has at most 256 slots.

What each construct means

A pattern string describes one cycle, and in claudius one cycle is one bar. The constructs below divide the cycle, layer things in it, or change from one cycle to the next. Patterns and time explains cycles in full.

syntaxexamplemeaning
sequencebd sd bd sdthe steps share the cycle equally: four steps are four beats
restbd ~ bd ~, bd - bd -a step of silence
groupbd [sd sd]a sequence squeezed into one step
braces{bd sd}the same as [bd sd]
stackbd*4, hh*8play together, each with the whole cycle
alternation<a1 f1 c2 g1>one item per cycle, in turn
choicebd | cp | rimone sequence per cycle, picked at random
fasthh*8the step plays 8 times within its slot
slow[bd sd]/2the step’s content spreads over 2 cycles
weighta@3 bthe step takes 3 shares of the cycle (here 3/4)
holda _ _ bthe same as a@3 b
repeata!3 b, a ! bthe step repeated as separate steps (a a a b, a a b)
drophh?, hh?0.3the step plays with probability 1 − p (p = 0.5, or the number)
euclidbd(3,8), bd(3,8,2)k hits spread over n slots, rotated left by r
indexbd:3a word carrying a variation number (see Sounds)

Modifiers apply to the step they follow and chain left to right: hh*2? drops some of the doubled hits, [bd sd](3,8) plays the pair inside each euclidean hit.

Sequences and weights

A sequence divides the cycle by weight. Every step weighs 1 unless @ says otherwise, and each _ after a step adds 1:

blank("house");
track("lead", note("e4@3 d4 c4@2 d4 e4").s("pluck"));   // 3/8, 1/8, 2/8, 1/8, 1/8 of the bar

!n writes the step n times; each copy is a full step. a! with no number means one more copy, and ! after whitespace is the same token, so a ! b is a a b. A number after a bare ! is read as the count: a ! 3 is a a a, not a a 3.

Groups, stacks and alternation

[ ] makes a sub-sequence that takes one step. A comma at the top level, inside [ ] or inside < > stacks layers that all take the full span:

blank("house");
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4, hh*16?0.6"));

< > plays one item per cycle: <a1 f1 c2 g1> is A in bar 1, F in bar 2, C in bar 3, G in bar 4, then again. Items can be groups, and alternations nest: <a <b c>> plays a, b, a, c. Inside < >, ! repeats an item: <c2!2 ab1!2> plays C in bars 1 and 2, then A♭ in bars 3 and 4, a new event in every bar. <c2 ab1>/2 covers the same four bars with two events, each two bars long.

Speed

*n plays the step’s content n times within its slot; /n stretches it over n slots, so it continues in the next cycle. In x [a b c d]/2, the second half of bar 1 plays a b and the second half of bar 2 plays c d. The number can be a decimal above 0 and up to 256; it cannot be a pattern (bd*<2 3> is an error).

Euclidean rhythms

x(k,n,r) puts k hits on n equal slots as evenly as possible, with Bjorklund’s algorithm as Tidal and Strudel run it, and rotates the result left by r slots. A k larger than n fills every slot; an n of 0 is silence.

patternslots (x hit, . rest)
x(3,8)x..x..x.
x(3,8,2).x..x.x.
x(5,8)x.xx.xx.
x(5,8,2)xx.xx.x.
x(3,16)x....x....x.....
x(5,16)x..x..x..x..x...
x(7,16)x..x.x.x..x.x.x.

Randomness

? and | are random, but not from run to run: their random numbers are seeded from the text of the string. The same string gives the same choices on every render, a different bar gets a different choice, and any edit to the string (even a space) gives new choices. hh*16?0.3 thins a 16th-note hat differently in each bar of a section, and identically every time you render.

Values

What a word or number means depends on the pattern it is in:

patternwordsnumbers
s() / sound()sound names, name:2 for a variation, pack:instrumentsound names (808)
note()note names: c, c#4, eb3, fs2MIDI note numbers: 60 is middle C
n()an errorscale degrees from 0
chord()chord symbols, slash chords, Roman numerals, prog, prog:Ban error
seq(), and arguments of .gain(), .struct() …x, t, trueamounts

In a sound name, only a number after the last colon is a variation: bd:3 and tr808:sd:2 carry one, tr808:sd is a single name. Pitch has the note, scale and chord rules. In .struct() and .mask(), a value is “on” when it is a non-zero number or any word except 0, false and f.

Errors

Errors name the token the parser did not expect. These are the messages, as claudius script prints them:

blank("house");
track("x", s("[bd sd"));
Error: Runtime error: expected ']', found the end (line 2, position 12)
stringerror
bd sd]unexpected ']'
[bd sdexpected ']', found the end
<bd sdmissing '>'
bd(3,8expected ')', found the end
bd(3)expected ',', found ')'
bd*<2 3>expected a number, found '<'
bd/0'/' takes a number above 0 and up to 256, not 0
bd*1000'*' takes a number above 0 and up to 256, not 1000
_ bd'_' needs a step before it
! bd'!' needs a step before it
<bd | sd>unexpected '|'
<bd _ sd>unexpected '_'
bd . sdbad number '.'
bd%4unexpected '%' in "bd%4"
7/Vexpected a number, found 'V' (a word starting with a digit does not take a slash)
bd!300a step repeats at most 256 times
more than 1024 steps in one sequencea sequence has at most 1024 steps
bd(3,300)a euclidean rhythm has at most 256 steps
65 nested [brackets are nested more than 64 deep
a 5000-character stringmini-notation is limited to 4096 characters (this one has 5000)

A word that parses but means nothing is not an error at this stage; it is one when the track is made, and the message says what was expected: s("bdd") is an unknown sound, note("h3") cannot be read as a note, chord("Xyz") cannot be read as a chord, and n("0 e") is not a scale degree. See Errors and limits.

Differences from Strudel

Strudelclaudius
{a b, c d e} is a polymeterbraces are plain groups; there is no polymeter and no %
a . b c groups with dots. is an error
<a@3 b> holds a for 3 cyclesweights inside < > are ignored; write <a!3 b>
a ! 3 is a a 3a ! 3 is a a a
bd*<2 3> takes a pattern* and / take numbers only, above 0 and up to 256
a | b, c| binds across the comma: it plays b with a random pick of a or c; bracket it: [a | b], c
"c e g" with a cps of your choiceone cycle is always one bar at the song’s tempo

Patterns and time

A pattern is a description of events in time that claudius can ask questions of: “what happens in bar 3?” This page says exactly how those questions are asked and answered, because everything else (alternation, every, prog, randomness) follows from it.

One cycle is one bar

Pattern time is counted in cycles, and a cycle is always one bar of four beats at the song’s tempo. At 120 BPM a cycle lasts 2 seconds; at 174 BPM, 1.38 seconds. There is no separate cycles-per-second setting: change the tempo with tempo() and the patterns follow.

Every duration in the pattern language is a fraction of a bar:

durationcyclesin mini-notation
a bar1a
a half note0.5a b
a beat (quarter note)0.25a*4
an eighth note0.125a*8
a sixteenth note0.0625a*16
an eighth-note triplet1/12a*12
a sixteenth-note triplet1/24a*24

So .late(0.25) moves a pattern one beat later, and .off(0.125, f) adds a copy an eighth note behind.

Events

A pattern produces events. Each event has a whole, the span it occupies (start and end, in cycles), a value ("bd", "c3", 4, "Am7"), and controls set by methods such as .gain() or .legato(). In s("bd sd"), bar 1 has two events: bd from 0 to 0.5 and sd from 0.5 to 1.

Queries

When claudius needs a pattern’s events, it asks for a span of cycles, from b up to (not including) e, and gets the events whose start falls inside the span. An event that started earlier and is still sounding is not returned, and events are never cut into fragments.

This differs from Strudel, which returns fragments of events that overlap the span. You notice it in one place: an event longer than a bar exists only in the bar where it starts. note("<c3 g3>/2") has an event in bars 1 and 3, none in bars 2 and 4; each note still lasts its full two bars, so you hear it. Methods that read another pattern at each event look further back, so they still find it (see Reading one pattern from another).

Sections restart their patterns

A pattern track plays in the sections that list it (see Form). For a section of N bars, claudius asks the pattern for cycles 0 to N and places the result at the start of the section. Every section therefore starts the pattern from its first cycle:

  • an alternation <a b c> starts again from a;
  • .every(4, f) applies f on the first bar of each section, then every fourth bar;
  • chord("prog") follows the section’s progression from its first chord;
  • random choices repeat: bar 1 of every section makes the same choices.
blank("house");
tempo(120);
track("lead", n("<0 2 4 6>").scale("A:minor").octave(4).s("pluck"));
form([sec("groove", 6, "lead"), sec("break", 4, "lead")]);

The groove plays A, C, E, G, A, C; the break starts again on A. A section whose length is not a multiple of the pattern’s length cuts the pattern off, so a 4-bar idea in a 6-bar section plays once and a half.

Drum lanes written with drum() work the same way: their step pattern is tiled from the start of each section.

From events to notes

When a section is arranged, each event becomes a note:

  • start: the event’s start, in beats from the section’s first beat (cycle × 4);
  • length: the event’s whole length × legato (1 when not set), never shorter than 0.02 beats;
  • velocity: velocity, else gain, else 0.9 for sound patterns and 0.8 for the others; anything above 1 plays as 1;
  • pitch: from the value, as described in Pitch.

Events shifted by .late() or .early() follow the same rule: .late(0.25) pulls the last beat of cycle −1 into the first beat of every section, and drops the last beat of the section’s final bar.

Swing and humanize are not part of the pattern. They are applied when the song is rendered, to every track: see swing() and humanize().

What a pattern’s values mean

The constructor decides the pattern’s kind, and the kind travels with it through every method:

constructorkindvalues are
s(), sound()soundsound names
note()notenote names or MIDI numbers
n()degreescale degrees
chord()chordchord symbols, Roman numerals, prog
seq()plainnumbers and words, for controls and structure

stack() and cat() take the kind (and the track settings such as .s() and .scale()) of their first pattern. Stack patterns of one kind: stack([note("c3"), s("bd")]) reads bd as a note name and fails with cannot read 'bd' as a note.

Reading one pattern from another

.struct(p), .mask(p) and the per-event controls (.gain(p), .velocity(p), .legato(p), .add(p), .transpose(p), .n(p)) read a second pattern at the start of each event: they take the event of p that is sounding at that moment, including one that started in an earlier bar (up to 64 bars back).

blank("house");
// each bar's root, played on the struct's hits
track("bass", note("<a1 f1 c2 g1>").struct("x ~ x x ~ x x ~").s("sub_bass"));
// a different gain on each beat
track("hats", s("hh*16").gain("0.9 0.4 0.7 0.4"));

A value that lasts longer than a bar holds for all of it. Both of these play A for two bars, then F for two:

blank("house");
track("bass", note("<a1 f1>/2").struct("x ~ x ~").s("sub_bass"));
track("bass2", note("<a1!2 f1!2>").struct("x ~ x ~").s("sub_bass"));

Randomness

Random methods (? and | in mini-notation, .degrade(), .degradeBy(), .sometimes() and its relatives) are deterministic. Each decision comes from a hash of a seed and the start time of the event it is about, and the seed comes from code:

random partseeded by
?, | in a stringthe text of the string
.degrade(), .degradeBy(p)the code of the pattern before the call
.sometimes(f), .often(f) …the code of the pattern before the call, and the method’s name
.sometimesBy(p, f)the code of the pattern before the call

What follows from that:

  • The same script renders the same song every time, on every machine.
  • Different bars get different choices, and every section repeats the choices of its own first bars.
  • Two tracks with the same code make the same choices. s("hh*8?") on two tracks drops the same hits.
  • Editing the code before a random method changes its choices; editing after it does not. In s("hh*8").degrade().gain(0.6), changing the gain keeps the same hits, changing "hh*8" to "hh*8 " does not.

To hear a different variation of the same idea, change the code before the random method without changing the music: a space added inside the pattern string ("hh*8 ") is enough. .degrade() and .degradeBy(0.5) make identical choices, since they share a seed.

Pattern functions

Every function that makes or changes a pattern, with its parameters, what it accepts, the errors it raises and an example. Methods are called on a pattern (s("bd*4").fast(2)) and return a new pattern; the original is unchanged.

Many parameters accept a number, pattern string or pattern: gain(0.8), gain("1 0.6") and gain(seq("1 0.6")) are the same kind of argument. Anything else raises expected a number, a pattern string or a pattern. How a second pattern is read is explained in Reading one pattern from another.

Constructors

s() and sound()

s(pattern)        // number, pattern string or pattern
sound(pattern)    // the same

A pattern of sound names: drums, synth presets, sampled instruments, kit sounds such as tr808:sd (see Sounds). Each word is one hit; a number after the last colon picks a variation (bd:3, tr808:sd:2). A track whose sound pattern uses several names is split into one track per name (drums.bd, drums.hh …) so each gets its own mixing role.

blank("house");
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4"));

note()

note(pattern)     // note names or MIDI numbers

A pattern of pitches: c3, eb2, f#4, or MIDI numbers (60 is middle C). A name without an octave is in octave 3. The instrument comes from .s(); without it, the pluck synth plays. See Pitch.

Errors: a word that is not a note name, when the track is made: cannot read 'h3' as a note (names with an octave like c3, f#4, bb2, or MIDI numbers).

blank("house");
track("bass", note("<a1 f1 c2 g1>").struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));

n()

n(pattern)        // scale degrees, from 0

A pattern of scale degrees in the scale set by .scale(), or the song’s key when there is none. Degree 0 is the tonic in octave 3 (.octave() changes it); 7 in a seven-note scale is the tonic an octave up; negative degrees go down. Without .s(), the pluck synth plays. See Pitch.

Errors: a word instead of a number, when the track is made: n() takes scale degrees (0 1 2 -1 ...), not 'e'.

blank("house");
key("A minor");
track("lead", n("0 2 4 7 4 2").octave(4).s("pluck"));

chord()

chord(pattern)    // chord symbols, Roman numerals, prog, prog:NAME

A pattern of chords: names (Am7), slash chords (F/A), Roman numerals (ii7, V7/V). Each event plays every note of its chord, voiced with voice leading (see Voicing), or only its root with .root(). prog plays the song’s progression for the section; prog:B always plays progression B (or A when the song has no B). Without .s(), the epiano synth plays.

Errors: a word that is neither, when the track is made: cannot read 'Xyz' as a chord (names like Am7, Fmaj7, Bb, numerals like ii7, bVII, V7/V, or prog).

blank("house");
key("A minor"); prog("A", "Am7 Fmaj7 Dm7 Em7"); bars_per_chord(1);
track("keys", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano"));

seq()

seq(pattern)      // plain values

A pattern of plain numbers and words, for arguments: .gain(seq("1 0.6")), .struct(seq("x ~ x x")). A string argument does the same job, so seq() is mostly useful for building an argument once and reusing it.

stack()

stack([pattern, pattern, ...])

Plays patterns together. The result has the kind and track settings of the first pattern, so stack patterns of one kind.

Errors: stack() takes patterns when an item is not a pattern; stack() needs at least one pattern for [].

blank("house");
track("drums", stack([s("bd*4"), s("[~ cp]*2"), s("hh*8").gain(0.5)]));

cat()

cat([pattern, pattern, ...])

One pattern per bar, in turn: bar 1 plays the first, bar 2 the second, and so on, then again. Like stack(), it takes the kind and track settings of the first pattern. Errors as for stack(), with cat() in the message.

blank("house");
track("drums", cat([s("bd*4, hh*8"), s("bd*4, hh*8"), s("bd*4, hh*8"), s("bd*2 [bd*4], hh*16")]));

silence()

silence()

A pattern with no events.

Time

fast() and slow()

pattern.fast(factor)     // number above 0, up to 256
pattern.slow(factor)     // number above 0, up to 256

fast(2) plays the pattern twice per bar; slow(2) spreads one cycle over two bars. Factors can be decimals.

Errors: fast needs a number; fast takes a number above 0 and up to 256, not 1000; the same for slow.

blank("house");
track("hats", s("hh hh hh oh").fast(2));          // eighth notes, an open hat on the "and" of 2 and 4
track("pad", chord("<Am F>").slow(2).s("pad"));     // each chord for two bars

late() and early()

pattern.late(cycles)     // number; negative moves earlier
pattern.early(cycles)    // number; negative moves later

Shifts the pattern in time. late(0.25) is one beat; small values such as late(0.02) make a part sit lazily behind the beat. At a section’s start, a shifted pattern brings in the end of the bar before it.

Errors: late needs a number, early needs a number.

blank("lofi");
track("keys", chord("<Dm9 G9>").s("epiano").late(0.02));

rev()

pattern.rev()

Reverses each bar: the last event comes first.

blank("house");
track("lead", n("0 1 2 4").scale("A:minor").octave(4).every(2, |x| x.rev()).s("pluck"));

ply()

pattern.ply(count)       // integer, 1 to 256

Repeats each event count times inside its own slot: s("bd sd").ply(2) is s("[bd bd] [sd sd]").

Errors: ply takes a number above 0 and up to 256, not 300; ply takes a whole number from 1 to 256, not 1.5.

blank("trap");
track("hats", s("hh*8").lastOf(4, |x| x.ply(2)));

Higher-order functions

These take a closure |x| ... that receives the pattern and returns a changed one. Track settings written inside a closure (|x| x.s("piano")) have no effect: only the events it returns are used.

every() and lastOf()

pattern.every(n, f)      // n: integer (below 1 acts as 1), f: closure
pattern.lastOf(n, f)

every(n, f) uses f’s version in the first bar of every n, counted from the start of the section (bars 1, 5, 9 … for n = 4). lastOf(n, f) uses it in the last bar of every n (bars 4, 8, 12 …), which is where a fill belongs.

blank("house");
track("drums", s("bd*4, [~ cp]*2").lastOf(4, |x| x.fast(2)));   // a doubled bar before each phrase

sometimes() and its relatives

pattern.sometimes(f)       // probability 0.5
pattern.often(f)           // 0.75
pattern.rarely(f)          // 0.25
pattern.almostNever(f)     // 0.1
pattern.almostAlways(f)    // 0.9
pattern.sometimesBy(p, f)  // p: number; 0 never, 1 always

Decides once for each event of the pattern, with the given probability, whether f applies to it, the way Strudel does. The chosen events go through f and the others play as they are, so each event is either itself or f’s version of it, never both: s("hh*16").sometimes(|x| x.late(0.01)) plays sixteen hats, some nudged late, and .sometimes(|x| x.ply(2)) doubles some events and leaves the others single. A transform that changes speed (fast, slow) is the exception: it picks events in its own time, so its copies can land on top of originals. The choice is random but repeatable (see Randomness).

Errors: sometimesBy needs a number.

blank("house");
track("hats", s("hh*16").gain(0.6).sometimes(|x| x.gain(0.3)));         // accents vary hit by hit
track("ride", s("rd*8").sometimes(|x| x.ply(2)).gain(0.5));              // some eighths become two sixteenths
track("lead", n("0 2 4 2").scale("A:minor").octave(4).rarely(|x| x.add(7)).s("pluck"));

off()

pattern.off(cycles, f)   // cycles: number; f: closure

Plays the pattern and, on top of it, f’s version shifted later by cycles. A classic is an echo an eighth note behind, an octave up.

Errors: off needs a number.

blank("house");
track("arp", n("0 2 4 6").scale("A:minor").octave(4).off(0.125, |x| x.add(7)).s("pluck"));

superimpose()

pattern.superimpose(f)

Plays the pattern and f’s version together, unshifted. Use it for doublings: a third or an octave above.

blank("house");
track("lead", n("0 1 2 4").scale("A:minor").octave(4).superimpose(|x| x.add(2)).s("pluck"));

degrade() and degradeBy()

pattern.degrade()        // drops each event with probability 0.5
pattern.degradeBy(p)     // p: number; 0 keeps all, 1 drops all

Drops events at random, repeatably. degradeBy(0.3) keeps about 70 % of the events. The mini-notation ? does the same per step.

Errors: degradeBy needs a number.

blank("house");
track("shaker", s("shaker*16").degradeBy(0.3).gain(0.5));

Structure

struct()

pattern.struct(rhythm)   // number, pattern string or pattern

Takes the timing from rhythm and the values from the pattern. Every “on” event of the rhythm (any non-zero number, any word but 0, false, f) becomes an event with the value the pattern has at that moment. Rests in the rhythm are silent. Use it to give a melody or a chord progression a rhythm without rewriting it.

blank("house");
track("stabs", chord("<Am7 Dm7>").struct("~ x ~ x ~ x ~ [x x]").s("stab"));

mask()

pattern.mask(onoff)      // number, pattern string or pattern

Keeps the events of the pattern that start where onoff is on, and removes the others. Unlike struct(), it never adds events or changes timing.

blank("house");
track("hats", s("hh*16").mask("<1 [1 0] 1 [1 0 0 1]>"));   // the hats drop out in places, bar by bar

euclid() and euclidRot()

pattern.euclid(k, n)         // integers: k hits over n slots
pattern.euclidRot(k, n, r)   // and rotated left by r slots

The pattern played on a euclidean rhythm. s("rim").euclid(5, 16) is s("rim(5,16)"). n is 1 to 256, as in mini-notation (otherwise a euclidean rhythm has 1 to 256 steps, not 1000); k is held between 0 and n; r wraps around, so a negative r rotates right.

blank("techno");
track("rim", s("rim").euclidRot(5, 16, 2).gain(0.6));

Per-event controls

Each control is read from its argument at the start of every event, so a pattern string gives different values in different places.

gain() and velocity()

pattern.gain(amount)       // number, pattern string or pattern; 0..1
pattern.velocity(amount)

How hard each note is played. Both set the same thing; when both are present, velocity wins. Without either, sound patterns play at 0.9 and the others at 0.8. Values above 1 play as 1. On synthesized drums and audio files, the level follows velocity to the power 1.6, so 0.5 sounds about 10 dB below 1; synth presets and sampled instruments respond the way the instrument does, with tone as well as level (a sampled piano switches to softer recordings).

blank("house");
track("hats", s("hh*16").gain("[0.4 0.25 0.8 0.25]*4"));   // accent on the off-beat eighth

legato()

pattern.legato(fraction)   // number, pattern string or pattern; 1 = the full slot

How long each note lasts, as a fraction of its slot. 0.5 is staccato, 1 (the default) is the whole slot, and values above 1 overlap the next note. On the mono synths with glide (808, acid, reese, square_lead) an overlap makes the pitch slide into the next note; sub_bass and wobble tie the notes without starting the envelope again. Arpeggiated notes default to 0.9.

blank("house");
track("bass", note("a1*8").s("organ_bass").legato("0.4 0.9"));

add() and transpose()

pattern.add(amount)        // number, pattern string or pattern; rounded to a whole number
pattern.transpose(amount)  // the same, in semitones always

Both move pitches. transpose() always counts semitones. add() adds to the pattern’s values, so what one step means depends on the pattern:

patternadd(1) movestranspose(1) moves
note()one semitone upone semitone up
n()one scale degree up: add(7) is an octave in a seven-note scale, add(5) in a pentatonic onethe played note one semitone up
chord()the voicing range one semitone up (voice leading still picks the notes)every voiced note one semitone up
chord().root()the root one semitone upthe root one semitone up
s()the sample or drum sound one semitone upthe same

n("0 2 4").transpose(12) is the same line an octave up in any scale; n("0 2 4").add(7) is too, in a seven-note scale. Several calls add up.

blank("house");
key("A minor");
track("lead",  n("0 2 4 2").octave(4).add("<0 0 -2 -1>").s("pluck"));       // the motif moves by scale steps
track("lead2", n("0 2 4 2").octave(4).transpose(12).s("bell").level(-6));   // the same line an octave up
track("perc",  s("rim*8").transpose("0 7 12 7").gain(0.5));

n() on a sound pattern

pattern.n(index)           // number, pattern string or pattern

On an s() pattern, picks the variation of each sound, like bd:3. It replaces an index written in the word.

blank("house");
track("kick", s("bd*4").bank("tr909").n("0 0 3 0"));

Track settings

These describe the track rather than single events, so they apply to the whole track wherever they appear in the chain, and a later call replaces an earlier one. Only the pattern given to track() counts: settings inside a closure are ignored.

methodwhat it setsvalues
.s(name), .sound(name)the instrument of a note(), n(), chord() or seq() patterna sound name or a file path
.bank(name)the drum machine or kit for the names in an s() patterntr909, tr808, tr707, acoustic, uzu, apple …
.scale(name)the scale for n(), and the key for Roman numerals in chord()"A:minor", "D dorian", "E:minor:pentatonic", "C:blues"
.octave(n)the octave of degree 0 in n(), of note names without an octave, and of .root() notesinteger; default 3, 2 for .root()
.voicing(), .voicing(lo, hi)the range chord voicings stay inMIDI integers, default 52, 74
.arp(mode)arpeggiate each chord event"up", "down", "updown"
.root()a chord() pattern plays only each chord’s root (its slash bass, when it has one)octave 2 unless .octave(n) says otherwise
.role(name)the mixing rolekick, snare, bass, chords, pad, lead …
.level(db)level in dB relative to the role’s targetnumber
.pan(x)stereo position−1 left .. 1 right
.room(x), .reverb(x)reverb send0..1
.delay(x)delay send0..1
.duck(x)sidechain depth from the kick0..1; default 0.3, 0 on drums
.lpf(hz), .cutoff(hz)a lowpass filter on the trackHz
.hpf(hz)a highpass filter on the trackHz
.crush(bits)a bitcrusherbits, 1..24
.distort(db)tanh saturationdrive in dB

.scale() and .arp() check their argument: unknown scale 'Q:minor' (try "A:minor", "C:major", "D:dorian", "E:minor:pentatonic"), unknown arp 'sideways' ("up", "down" or "updown"). The numeric settings raise <name> needs a number for anything else, and are not clamped by the pattern; Mixing functions says what the mixer does with them. .s() on an s() pattern does nothing, since the words already name the sounds.

blank("deep_house");
track("keys", chord("<Fm9 Bbm9>").voicing(53, 72).s("epiano")
                .level(-2).pan(-0.2).room(0.3).delay(0.1).lpf(4000));

.root() turns a chord pattern into a bass line that follows it. On the song’s progression, the bass changes when the progression does:

blank("house");
key("A minor"); prog("A", "Am F/A C G"); bars_per_chord(1);
track("keys", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano"));
track("bass", chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("sub_bass"));   // A2 A2 C2 G2

Pitch: notes, scales and chords

Three pattern kinds carry pitch: note() (absolute notes), n() (scale degrees) and chord() (chords). This page gives the exact rules for each, then voicing and arpeggios. Pitches are MIDI numbers: 60 is middle C (C4), 69 is the A at 440 Hz, and each step is a semitone.

noteC1C2C3C4C5C6
MIDI243648607284

Note names

note() reads each word as a note name:

  • a letter a to g, upper or lower case;
  • any number of accidentals: # or s for sharp, b or f for flat (c#, cs, eb, ef, cbb);
  • an optional octave number. Without one, the octave is 3, or the track’s .octave(n).

So c is C3 (48), c4 is 60, a1 is 33, f#2 is 42, bb1 is 34. A number instead of a name is a MIDI note: note("60 64 67") is a C major triad from middle C. Decimals are rounded.

blank("house");
track("bass", note("a1 a1 [a2 a1] g1").s("sub_bass"));
track("keys", note("[a3, c4, e4] ~ [f3, a3, c4] ~").s("epiano"));   // chords written note by note

A word that is not a note name is an error when the track is made: cannot read 'h3' as a note (names with an octave like c3, f#4, bb2, or MIDI numbers).

Scale degrees

n() reads numbers as degrees of a scale, counted from 0:

  • degree 0 is the tonic in octave 3 (or .octave(n)): in A minor, A3 (57);
  • degree 7 in a seven-note scale is the tonic an octave up; degree 5 in a pentatonic scale;
  • negative degrees go down: −1 in A minor is G3;
  • decimals are rounded; a word that is not a number is an error (n() takes scale degrees (0 1 2 -1 ...), not 'e').

The scale is the track’s .scale(name), or the song’s key when the track has none. Writing melodies in degrees keeps them in key, and key() moves them with the song.

blank("house");
key("A minor");
track("lead", n("0 2 4 7 6 4 2 1").octave(4).s("pluck"));   // A C E A G E C B, from A4

Scale names

A scale is written as a tonic and a name, separated by : or spaces, in any case: "A:minor", "a minor", "E:minor:pentatonic", "F# dorian".

nameintervals (semitones from the tonic)
major, ionian, maj (or no name)0 2 4 5 7 9 11
minor, aeolian, natural_minor, min, m0 2 3 5 7 8 10
dorian0 2 3 5 7 9 10
phrygian0 1 3 5 7 8 10
lydian0 2 4 6 7 9 11
mixolydian0 2 4 5 7 9 10
harmonic_minor, harmonic0 2 3 5 7 8 11
pentatonic, major_pentatonic0 2 4 7 9
minor_pentatonic0 3 5 7 10
blues, minor_blues0 3 5 6 7 10
chromaticall twelve

Words after the tonic are joined with _, so "minor pentatonic" and "minor:pentatonic" both name minor_pentatonic. Locrian, melodic minor and other scales are not available; .scale() rejects them with unknown scale.

Keys

key() takes a tonic and a mode: "A minor", "Am", "F#m", "Eb" (major), "D dorian", "C# phrygian", "Bb mixolydian", "E harmonic minor". The tonic accepts #, b, ♯ and ♭. The seven modes in the first seven rows of the table above are the keys a song can be in; the pentatonic, blues and chromatic scales exist only for n().

Chord symbols

chord() reads a word as a chord symbol when it starts with a note letter: a root, then a quality suffix.

suffixchordnotes on C
(none), M, majmajorC E G
m, min, -minorC E♭ G
dim, o, °diminishedC E♭ G♭
aug, +augmentedC E G♯
sus2suspended 2ndC D G
sus4, sussuspended 4thC F G
5power chordC G
6major 6thC E G A
m6minor 6thC E♭ G A
7dominant 7thC E G B♭
maj7, M7, Δ, Δ7major 7thC E G B
m7, -7, min7minor 7thC E♭ G B♭
m7b5, ø, ø7half-diminishedC E♭ G♭ B♭
dim7, o7, °7diminished 7thC E♭ G♭ A
add9added 9thC E G D
madd9minor added 9thC E♭ G D
9dominant 9thC E G B♭ D
maj9, M9, Δ9major 9thC E G B D
m9minor 9thC E♭ G B♭ D
m11minor 11thC E♭ G B♭ D F

Roots are case-insensitive (am7 is A minor 7). A slash chord names its bass note after a slash: F/A is F major over A, C/E is C major over E. Inside a pattern string, °, + and ♭ are not allowed by the tokenizer: write dim or o, aug, and b; a slash followed by a letter stays in the word, so chord("<Am F/A C G>") works. An unknown symbol (Cmaj13, Xyz) is an error when the track is made: cannot read 'Xyz' as a chord (names like Am7, Fmaj7, Bb, numerals like ii7, bVII, V7/V, or prog).

The slash bass does not change the voicing (the chord’s own notes are voiced as usual). It is what .root() plays, what generated basslines play on that chord, and what the critic expects the bass to play.

Roman numerals

A Roman numeral names a chord by its place in the key, so a progression in numerals follows every key change. chord() reads any word that is not a chord symbol as a numeral, and prog() stores progressions as numerals.

  • Degree: I II III IV V VI VII, counted in the key’s own mode. VI in A minor is F; IV in A dorian is D; II in E phrygian is F.
  • Case picks major or minor when there is no suffix: IV is major, iv is minor. Case never moves the root.
  • Accidentals before the numeral move the root a semitone: bVII, bVI, bIII, #iv. These are the borrowed chords.
  • Suffixes: 7 is a dominant 7th on an upper-case numeral and a minor 7th on a lower-case one; 9 and 6 work the same way; add9 gives add9 or madd9 by case. °, o, dim make a diminished triad; ø, ø7, m7b5 a half-diminished 7th; °7, o7, dim7 a diminished 7th; +, aug augmented; 11 always a minor 11th. Any other chord-symbol suffix (maj7, maj9, sus4, m7) sets the quality outright, whatever the case.
  • Applied chords: V/V, V7/ii, viio7/V read the part before the slash in the key of the chord after it (major or minor, by that chord’s quality). In C major, V/V is D major. They work in prog() and in pattern strings.
  • A note after the slash (I/E, VI/A) is a slash chord: the chord, with that note in the bass.
numeral in A minorchordnumeral in C majorchord
iAmIC
iiø7Bm7♭5ii7Dm7
IIICiiiEm
iv7Dm7IVmaj7Fmaj7
v7Em7V7G7
V7E7V/VD
VImaj7Fmaj7vi9Am9
VIIGbVIIB♭
blank("house");
key("A minor");
track("keys", chord("<i VImaj7 iv7 V7>").s("epiano"));   // Am, Fmaj7, Dm7, E7: a harmonic-minor turn

A chord pattern with .scale() reads its numerals in that scale instead of the song’s key: chord("<i VI III VII>").scale("C:minor") plays Cm, A♭, E♭, B♭ in any song.

The song’s progression: prog and prog:NAME

In a chord pattern, the word prog means “the chord the song’s progression has here”. The progression is the one the section plays (A unless the section says otherwise; breaks play B, or A when there is none), with bars_per_chord() bars per chord, starting from its first chord at the start of each section and looping. prog:B always reads progression B, whatever the section.

blank("house");
key("A minor");
prog("A", "Am7 Fmaj7 Dm7 Em7");
prog("B", "Fmaj7 G Em7 Am7");
bars_per_chord(1);
track("keys", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano"));
track("pad",  chord("prog").s("pad").role("pad"));
form([sec("groove", 8, "*"), sec("break", 8, "pad")]);

The keys and the pad play A in the groove and switch to B in the break, without being told. A name with no progression behind it (prog:C when there is no C) plays progression A, as the generated parts do. A section cannot ask for a progression the song does not have: form() and section() refuse it, except that a break with no B plays A.

Writing harmony this way has a second benefit: the arranger’s chord track, the generated parts and the critic’s harmony checks all read the song’s progressions. A chord pattern with explicit names plays what it says, but the critic still checks the melody and bass against prog("A") (on a blank() song, the tonic chord alone), so set it to the same chords.

Roots: bass lines from the chords

.root() makes a chord pattern play only each chord’s root, or its slash bass when it has one, as a single note in octave 2 (.octave(n) moves it). On chord("prog"), that is a bass line that follows the song’s progression, and changes when you change the progression:

blank("house");
key("A minor");
prog("A", "Am F/A C G");
bars_per_chord(1);
track("keys", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano"));
track("bass", chord("prog").root().struct("x ~ ~ x ~ x ~ ~").s("organ_bass"));

The bass plays A2, A2 (the slash bass of F/A), C2 and G2, a bar each. Because every chord’s root lands in the same octave, the line jumps where a bassist would step (G2 up to A2 is fine, A2 down to C2 is a sixth); write the notes out with note() when the shape of the line matters.

Voicing

Every chord event is voiced, whether or not you call .voicing():

  1. How many voices: the number of different notes in the chord, but at least 3 and at most 4. A triad gets three voices, a 7th chord four, a 9th or 11th chord four.
  2. Which notes go when there are more notes than voices: the fifth first, then the root (the bass covers it). A 9th chord keeps the third, seventh and ninth plus the root.
  3. Doubling when there are fewer notes than voices (a power chord): the root first, then the fifth.
  4. Where: every arrangement of those notes inside the range is scored. Close voicings (3 to 14 semitones from bottom to top) are preferred; intervals under a fourth below E3 and semitone clusters below E4 are penalised; and the distance each voice moves from the previous chord counts most. The first chord of a section is placed near the middle of the range.

The range is .voicing(lo, hi) in MIDI numbers, by default 52 to 74 (E3 to D5). .voicing() without arguments uses the default. .add(n) shifts the range by n semitones.

blank("house");
key("A minor"); prog("A", "Am7 Fmaj7 Dm7 Em7"); bars_per_chord(1);
track("keys", chord("prog").voicing(55, 74).s("epiano"));    // Am7 as C4 E4 G4 A4
track("pad",  chord("prog").voicing(45, 64).s("pad").role("pad"));

The keys hold common tones and move the other voices by step: from Am7 (C4 E4 G4 A4) to Fmaj7 only the G moves, down to F; to Dm7 the E moves down to D (C4 D4 F4 A4); to Em7 the C, F and A each step down (B3 D4 E4 G4). A range narrower than an octave can leave no valid voicing, in which case the chord tones are stacked upwards from lo.

Arpeggios

chord(...).arp(mode)    // "up", "down", "updown"

.arp() plays each chord event’s voiced notes one after another, evenly across the event:

modeorder, for a four-note chord
up1 2 3 4
down4 3 2 1
updown1 2 3 4 3 2

Each note lasts its share × legato (0.9 by default). Any other mode plays up. The speed comes from the events: one chord per bar arpeggiated over a triad gives three notes per bar; give the pattern more events with .struct() or * for faster arpeggios.

blank("synthwave");
key("A minor"); prog("A", "Am F C G"); bars_per_chord(1);
track("arp", chord("prog").struct("x*4").arp("updown").voicing(57, 76).s("pluck"));   // triads: 16th notes

A triad in updown has four steps (1 2 3 2), so four events per bar give straight sixteenths; up would give triplets.

Velocity and length

Pitch patterns use the same controls as every pattern: gain()/velocity() for how hard, legato() for how long. A note lasts its whole slot unless legato says otherwise, so note("a1 ~ ~ ~") is a quarter note and note("a1 _ _ _") a whole bar.

Sounds

Every sound in claudius is real audio: synthesized in code (drum voices, the synth engine) or recorded (sampled instruments and drum machines from the sample packs, Apple Loops, your own files). There is no General MIDI and no neural audio. A sound name appears in two places:

  • the words of an s() pattern: s("bd*4, [~ cp]*2");
  • .s(name) on a note(), n(), chord() or seq() pattern: note("a1 c2").s("upright_bass").

claudius sounds renders every drum voice, synth preset and transition effect into out/sounds/ so you can hear them; claudius-packs aliases lists every sampled-instrument name your installed packs answer to.

How a name is resolved

A number after the last colon is a variation (bd:3, tr808:sd:2); the rest is the name, colons included (tr808:sd, vsco2:violins). When a track is made, each name is looked up in this order, and the first match wins:

  1. With .bank() set, the name is looked up in that bank only.
  2. Drum names play the synthesized drum voices.
  3. Synth presets play the synth engine.
  4. The sample packs: sampled instruments (rhodes, vsco2:violins) and kit sounds (tr808:sd).
  5. Files: a name containing / or ending in .wav, .mp3, .aif, .aiff, .flac, .caf, .m4a, .aac, .ogg or .opus.

Anything else is an error that lists what exists:

blank("house");
track("x", s("bdd*4"));
Error: Runtime error: track 'x': unknown sound 'bdd' (drums: bd kick sd snare cp clap hh ch hat oh ohat rd ride cr crash lt mt ht tom rim rs sh shaker cb cowbell snap perc; synths: sub_bass 808 reese acid saw_bass pluck_bass organ_bass wobble log_drum pluck supersaw pad warm_pad stab epiano keys bell organ strings square_lead chip fm_bass rubber_bass moog_bass dist_bass deep_bass saw_lead pwm_lead whistle soft_lead glide_lead brass_lead fm_lead vox_lead solina glass_pad pwm_pad air_pad vowel_pad swell_pad tine_piano clav house_piano brass_stab rock_organ fm_marimba fm_kalimba harp_pluck mallet cowbell_lead; sampled: piano upright rhodes wurlitzer hammond string_ensemble violins cellos pizzicato brass trumpet flute harp marimba vibes kalimba upright_bass guitar choir sax ... (claudius-packs aliases)) (line 2, position 1)

Because drum names and synth presets come first, a few names play synthesis even when a recording by that name exists. Ask for the recording by another name, or exactly as pack:instrument (claudius-packs instruments lists them):

nameplaysfor the recording, write
epianothe FM electric piano synthrhodes, wurlitzer
keysthe FM keys synthpiano, upright
organthe drawbar organ synthhammond, church_organ
stringsthe string-machine synthstring_ensemble, violins
pad, warm_padthe synth padssynth_pad, new_age_pad, bowed_pad
shaker, cowbellthe synthesized drum voicesvcsl:shaker, tr808:sh, tr808:cb

lead is not a synth preset: it plays the sampled FreePats square lead. The synth leads are square_lead, supersaw and the other synth presets.

Drum names

These names play the synthesized drum voices. Each one also decides the mixing role of its track, wherever it appears in the name: bd:3 and tr909:bd are kicks, tr808:sd is a snare, vcsl:shaker a shaker.

namesvoicerole
bd, kickkickkick
sd, snaresnaresnare
cp, clapclapclap
hh, ch, hatclosed hi-hathat
oh, ohatopen hi-hatohat
rd, riderideride
cr, crashcrashcrash
lt, mt, ht, tomtom (low 90 Hz, mid 130 Hz, high 180 Hz; tom is the default tuning)tom
rim, rsrim shotperc
sh, shakershakershaker
cb, cowbellcowbellperc
snapfinger snapperc
perca tuned percussion hitperc

Synth presets

The synth engine has polyBLEP oscillators with unison and analog drift, state-variable and ladder filters, FM, glide and drive. These are its factory presets; the role is what role_of assumes for a pattern track.

presetsoundmonoassumed role
sub_bassa sine sub with a little driveyes, tied notesbass
808a sine with a pitch drop, long decay and heavy drive; glidesyesbass
reesetwo detuned saws and a saw an octave down, a slowly moving ladder filter; glidesyesbass
acidone saw into a resonant ladder filter with a snappy envelope; velocity opens it; glidesyesbass
saw_bassdetuned saws and a square an octave down, filter envelopeyesbass
pluck_basssquare and saw with a short filter pluckyesbass
organ_bassthree sine drawbars (fundamental, octave, two octaves)yesbass
wobbledetuned saws and a square, ladder filter swept by a tempo-synced LFOyes, tied notesbass
log_druma sine knocked into its note, a pitch drop and a woody FM click, dying away; glides a littleyesbass, when named (amapiano’s)
pluckthree detuned saws and a square an octave up, fast filter decaynoby pitch
supersawseven detuned saws plus three an octave down, delayed vibratonoby pitch
padfive saws and a triangle, slow attack, long release, slow filter driftnoby pitch
warm_padtriangles and a pulse, slower and darker than padnoby pitch
stabdetuned saws and a square, short with a filter snapnoby pitch
epianoFM tine electric pianonoby pitch
keysbrighter FM keys with a shorter decaynoby pitch
bellFM bell, long decaynoby pitch
organfive sine drawbars, sustainednoby pitch
stringsfive detuned saws, slow attack, delayed vibratonoby pitch
square_leadsquare and saw an octave up, vibrato; glidesyesby pitch
chipa 25 % pulse, shortnoby pitch
fm_bassa sine whose FM brightness falls away fast, over a subyesbass
rubber_bassa square and a sub through a resonant low-pass; glidesyes, tied notesbass
moog_basstwo saws and a square an octave down into a ladder filter; glidesyes, tied notesbass
dist_bassdetuned saws and a square, driven hardyesbass
deep_bassa triangle with a quiet octave and a sub, soft and roundyes, tied notesbass
saw_leadthree detuned saws and one an octave down, delayed vibrato; glidesyes, tied notesby pitch
pwm_leadtwo pulses of different widths, beating; glidesyes, tied notesby pitch
whistlea sine with a breath of noise and a wide vibrato; glidesyes, tied notesby pitch
soft_leada sine and a quiet triangle an octave up through a soft low-pass, slow to speak, a late vibrato; glidesyes, tied notesby pitch
glide_leadthe whine of G-funk: a sine and a quiet saw through a ladder filter, gliding a long way from note to note, a slow vibratoyes, tied notesby pitch
brass_leadsaws whose filter swells open, as brass doesnoby pitch
fm_leadan FM lead that keeps some brightness as it holds; glidesyes, tied notesby pitch
vox_leadsaws through a drifting band-pass, like a vowel; glidesyes, tied notesby pitch
solinaa string machine: six saws and three an octave up, slow attacknoby pitch
glass_padFM with a slow attack and a long release, bright and glassynoby pitch
pwm_paddetuned pulses with a slow filter driftnoby pitch
air_padtriangles and noise, very slow, breathynoby pitch
vowel_padsoft waves through a resonant low-pass, an “ah”noby pitch
swell_padsaws under a filter that sweeps slowly up and downnoby pitch
tine_pianothe bright FM electric piano of the 80snoby pitch
clava narrow pulse through a band-pass, short and funkynoby pitch
house_pianoa bright FM piano with a short decaynoby pitch
brass_stabdetuned saws with a quick filter snap, shortnoby pitch
rock_organdrawbars through an overdriven amp, with a speaker’s wobblenoby pitch
fm_marimbaan FM bar, quick decaynoby pitch
fm_kalimbaan FM tine, pluckednoby pitch
harp_plucka triangle and a little saw, plucked with a filter decaynoby pitch
malletsoft sines, a struck bar ringing outnoby pitch
cowbell_leadthe 808’s cowbell made to play a tune: two squares a little under a fifth apart through a band-pass, struck and dying fastnoby pitch

“By pitch” means a pattern track gets the role chords when it is a chord() pattern, bass when its median note is below E3, and lead otherwise. Mono presets play one note at a time; with glide, overlapping notes slide (see legato()).

Sampled instruments

With the default packs installed (claudius-packs install --defaults), these names play multi-sampled recordings with velocity layers and round robins. Most have several aliases; claudius-packs aliases prints them all.

familynames
pianos and keyspiano (Salamander grand), upright, rhodes, wurlitzer, cp80, pianet, fm_piano
organshammond, church_organ
stringsstring_ensemble, violins, violas, cellos, contrabass, pizzicato, spiccato, solo_cello, solo_cello_pizz, erhu, erhu_short, erhu_sul_tasto, bowed_psaltery
brass and windsbrass, brass_stabs, trumpet, horn, trombone, tuba, woodwinds, flute, oboe, clarinet, bassoon, piccolo, sax, harmonica, ocarina
mallets and bellsharp, marimba, vibes, bowed_vibraphone, xylophone, glock, bells, hand_chimes, kalimba, balafon, steel_pan, hang, water_glasses, wine_glasses, timpani
bass and guitarupright_bass, bass (electric), pick_bass, synth_bass, guitar (nylon), electric_guitar, jazz_guitar, dan_tranh, dan_tranh_tremolo
voiceschoir, voice
synths, recordedsynth_pad, new_age_pad, bowed_pad, choir_pad, synth_strings, synth_brass, lead, clavisynth (Yamaha TX81Z)
percussionbongo, conga, cajon, darbuka, frame_drum, slit_drum, tambourine, cabasa, claves, woodblock, agogo, guiro, triangle, sleigh_bells, vibraslap, mark_tree, claps, gong, suspended_cymbal, anvil, brake_drum, finger_cymbals, bell_tree, didgeridoo, tabla, stomp, chest, belly, heel
electronic one-shotselec, glitch, mehackit, glitch_kit, glitch_kit_2, Sonic Pi’s names (elec_blip, bd_haus, hat_snap)
effects and texturesambi (drones), vinyl, loop, tbd (pads), ocean_drum, flexatone, ratchet, siren, aliens, zaps, sirens, metal_hits, glass_breaks, cymbal_gongs, chains, bubbles, vibra_rings, nepalese_bells, glock_gliss

pack:instrument names one exactly, in .s() or in an s() pattern: note("c4 e4").s("vsco2:violins"), s("vcsl:shaker*8"). A name that is also a drum name plays the synthesized drum; name the pack for the recording: s("snap clap").bank("body"), or s("body:snap").

The groups of one-shots (elec, zaps, glitch_kit …) hold their sounds as variations: s("zaps:3"), s("glitch_kit").n("<0 5 12>"). Sonic Pi’s sounds also answer to their own names, s("vinyl_scratch") being s("vinyl:3"). The hang plays only its own notes (A3 C4 D4 E4 F4 G4 A4 Bb4 C5 D5): the others ring along with each one, so pitching it would put them in another scale.

Every recorded instrument has a playable range; notes outside it are pitched from the nearest sample, which sounds stretched far from home. Songs that play instruments from packs whose licences ask for credit get a credits.txt in their folder.

A sampled instrument name used without its pack installed is an unknown sound, and the error ends with sampled instruments need packs: claudius-packs install --defaults. A session started with --synth-only (make, evolve, serve, studio and mcp take it) plays no recordings at all: a sampled name ends its error with sampled instruments are off in this session (--synth-only), and .bank("tr909") raises bank 'tr909' plays sample packs, which are off in this session (--synth-only).

blank("lofi");
key("D minor");
track("keys", chord("<Dm9 Gm9>").voicing(50, 72).s("rhodes"));
track("bass", note("<d2 g1>").struct("x ~ ~ x ~ x ~ ~").s("upright_bass"));
track("bongos", s("~ bongo [~ bongo] bongo:2").gain(0.6));

Sampled percussion from the packs gets the perc role by itself.

Drum machines and kits

.bank(name) plays the drum names of an s() pattern on a recorded drum machine or kit from the sample packs:

bankaliaseswhat
tr909909Roland TR-909
tr808808Roland TR-808
tr707707Roland TR-707
muldjordacoustic, acoustic_kit, rock_kita recorded acoustic kit
uzuthe uzu drum kit
synthdrumssynth_drumsdrums made on synthesizers after vintage analog kits
sonicpisonic_piSonic Pi’s kicks (bd), snares (sn), hats (hat) and rides, and its other groups
bodybody_percussionbody percussion: stomp, clap, snap, chest, belly, heel, cheek …

Each kit has a subset of bd sd cp hh oh rd cr lt mt ht rim cb sh (the 909 has no shaker, the acoustic kit no clap); names like kick and snare map to them. A name the bank does not have is an error:

blank("house");
track("drums", s("bd*4, bongo*2").bank("tr909"));
Error: Runtime error: track 'drums': no 'bongo' in bank 'tr909' (installed packs: salamander epianos jrhodes vsco2 vcsl tr808 tr909 tr707 uzu muldjord freepats doublebass growlybass voice sonicpi solocello erhu steelpan synthdrums body zamenhof miscellania; kits: tr909 tr808 tr707 acoustic uzu synthdrums sonicpi body) (line 2, position 1)

The bank applies to every word of the pattern. To mix kits, or a kit and a sampled instrument, in one pattern, name each kit sound with its bank instead: s("tr909:bd*4, tr808:cp*2, bongo*2"). Strudel bank names (RolandTR909) work as aliases, and Strudel sample maps added with claudius-packs add-map become banks too.

.bank("apple") cuts drum one-shots from installed Apple Loops (GarageBand or Logic content) instead. On a machine without Apple Loops it falls back to the synthesized voices, without an error.

blank("house");
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4").bank("tr909"));

Variations

A number after the last colon (bd:3, tr808:sd:2) or .n(n) picks variation n of a sound (0 is the default):

  • on a kit, the recording numbered n: the 909 has 126 kicks, the 808 has 25;
  • on a synthesized drum, the same voice moved a few steps through its parameters (tuning, decay, tone …), the same way every time;
  • a variation a recording does not have is an error (no 'bd:200' in bank 'tr909').
blank("techno");
track("kick", s("bd*4").bank("tr909").n("<0 0 0 7>"));

Your own files

.s(path) plays an audio file as a sampler, on any note(), n() or chord() pattern:

track("vox", note("c4 ~ c4 [c4 c4]").s("/Users/me/Samples/vox.wav"));
  • c4 plays the file as recorded; other notes play it faster or slower, like a sampler without time-stretch.
  • On a track whose role is not a drum role, each note is cut at its length plus 50 ms, so legato() shapes it.
  • Paths cannot go inside a pattern string, so a file is set with .s(), or with drum_sound() for a drum lane of a generated song.
  • A missing file is an error: track 'vox': /Users/me/Samples/vox.wav does not exist.
  • When claudius is shared beyond your computer (a server reached by others), it reads files only from its own folders (saved songs, its caches, the sample packs, Apple Loops) and refuses others with ... is outside the folders this claudius may read.

To use a song or a loop as material, claudius chop cuts bar loops and drum one-shots from it into the user library, and claudius make --sample <file> flips a recording into a new song. See Remaking a song from audio.

Layered sounds

A bass in a modern track is rarely one sound. It is a rack of several playing the same notes, each doing one job: a clean sine underneath for the weight, a distorted mid on top for the growl you hear on a phone, and a bright top for the edge. Each is filtered to its own band of frequencies so they do not fight, compressed and distorted on its own, and often only the sub ducks under the kick while the rest holds. rack() builds a track that way:

rack("bass", [
  #{ sound: "sub_bass", band: [0, 100], duck: 0.8 },
  #{ sound: "reese", band: [100, 1000], level: -2, fx: [#{ fx: "saturate", kind: "hard", drive_db: 12 }] },
  #{ sound: "saw_lead", band: [1000, 0], level: -9, transpose: 12, fx: [#{ fx: "tremolo", beats: 0.25, depth: 0.7 }] },
]);
  • Each layer plays the track’s notes with its sound: a synth preset, a drum sound, a sampled instrument or a file, as drum_sound() and a part’s preset name one (with bank for a kit).
  • band: [low, high] keeps only those frequencies, in Hz, 0 for no edge on that side. The edges are crossovers that let bands meeting at an edge add up to the whole again, without a bump or a dip there.
  • level is in dB against the other layers. Each is first made as loud as the rest over its band, so a sound’s own loudness does not set the balance: -9 is a top nine decibels under the sub, as you hear it.
  • pan (-1 to 1) and transpose (semitones: 12 is an octave up) are the layer’s own.
  • fold: [lowest, highest] (MIDI notes, an octave apart at least) plays each of the track’s notes moved by whole octaves into them: fold: [28, 40] keeps a sub between E1 and E2, 41 to 82 Hz, wherever the line above it goes.
  • duck (0 to 1) ducks that layer alone under the kick: the sub makes room for it while the growl holds.
  • fx is the layer’s own chain, after its band. A tremolo or a gate there pulses that band alone, as a bass whose top flutters in sixteenths over a steady sub.

The bass-heavy genres stack their bass this way themselves. A trap, UK drill, phonk or hip hop song plays its 808 twice: once clean, and once through tape saturation kept to 300 Hz to 4.5 kHz, under a chorus that spreads it wide. That grit is what headphones and a phone hear of a bass, and the clean 808 under it keeps its weight on a subwoofer. Jungle, UK garage and grime give their bass the same grit from a tube saturator, and drum and bass a quieter one, since its reese is gritty already. Future bass puts a clean sine sub under its bass, an octave down because that bass sits high, ducking under the kick. Any other genre’s synth bass that has nothing under its note (an organ bass, a pluck bass, a distorted bass, a wobble) and plays above E2 gets a sine sub under it, folded into the sub octave (fold: [28, 40]) below 90 Hz and the bass above, the sub ducking half again as much as the bass: so the bass is felt on a subwoofer and heard on a phone. A sine bass played that high is folded down itself. A bass with a sub of its own (a deep bass, an FM, rubber or Moog bass, a reese), a recorded one and an 808 in the sub octave already play as they are. The song’s script shows the rack, to change like any other.

The rack sums its layers before the track’s own effects (fx()) and its mix, so the track is still one track: one row in the arrangement, one fader. It works on a part, a drum lane (a snare made of a snare, a clap and a noise burst) or a pattern track’s sound, named by its label when the pattern plays several:

drum("snare", "....x.......x...");
rack("snare", [
  #{ sound: "sd", band: [150, 6000] },
  #{ sound: "cp", level: -4, pan: 0.2 },
  #{ sound: "hh", band: [5000, 0], level: -10, fx: [#{ fx: "reverb", decay: 0.8, mix: 0.4 }] },
]);

One sound treated band by band works too, without layers: the band effect in a parallel effect’s chains splits a track into bands to process each on its own:

fx("bass", [#{ fx: "parallel", dry: 0, chains: [
  #{ amount: 1, fx: [#{ fx: "band", low_hz: 0, high_hz: 120 }] },
  #{ amount: 1, fx: [#{ fx: "band", low_hz: 120, high_hz: 0 }, #{ fx: "saturate", kind: "fold", drive_db: 15 }] },
] }]);

Sounds you cannot set from a script

A script names sounds; it does not edit them. The synth presets’ parameters and the tuning and decay of a generated song’s drum voices are set by the generator and changed by evolution. A script can swap them for other sounds: drum_sound() for a drum lane, part() for a generated part’s preset. Pattern tracks can add filters, a bitcrusher and saturation (see Track settings).

Song functions

Song functions edit the current song. Each one changes only what it names, in the order the script calls them. Sections and arrangement are on Form and sections; mix(), master() and the other mixer edits are on Mixing functions.

Starting a song

song()

song(genre)               // a new song, seeded from the clock
song(genre, seed)         // seed: integer
song(genre, options)      // options: map

Replaces the current song with one the generator writes: tempo, key, swing, two progressions, a form, drum lanes, theory-written parts, sounds and a mix, all from the genre’s profile. The same genre and seed give the same song on any machine. The recordings installed (sample packs, Apple Loops) change only which recordings it plays.

optiontypedefaulteffect
seednumber1which song
bpmnumberfrom the genre’s rangetempo
keystringrandom tonic in one of the genre’s modeskey, e.g. "F minor"
shortboolfalsehalve every section (at least 4 bars), for sketches
loopsboolfalsebuild the song around a family of Apple Loops (GarageBand style), when they are installed
samplesnumber0.75chance that each drum lane uses a recorded one-shot from your library instead of synthesis
sampledboolas the genre isbuild it on samples gathered from free libraries: a phrase it takes its key, tempo and chords from, a break, a texture (Songs built on samples); trip-hop, boom bap, lo-fi, jungle, big beat and filter house are by default
sample_searchstringnoneplay the phrases gathered for these words (“70s soul”); implies sampled
complexitynumber, 0 to 1the genre’s own (0.5 for most)how layered it is: 0 the genre’s core, 1 its harmony and lead doubled, a counter-melody, a pad, more percussion

A script downloads nothing: sampled and sample_search play what new_song, claudius make or claudius samples gather gathered before, and a song with none at hand plays the genre’s own sounds in their place.

The genre is one of the sixty-six that The genres lists (claudius genres prints them, from house and trap to hardstyle, jersey_club and afro_house), or another name of one’s ("gabber", "funk carioca", "melodic house"), any number of them fused (trip_hop+idm, trip_hop+neo_soul+idm: the first leads, the last plays the drums; see Fusing genres), or one of your own (see Genres); case, spaces and hyphens do not matter ("deep house"). A negative seed acts as 0. bpm and key change only the tempo and the key: the title, the form, progression A and the drum patterns are the ones the seed gives without them. A key in another mode than the seed’s moves the chords into that mode, as key() does. The options are checked like tempo() and key() check their arguments, and an option the map should not have is an error rather than ignored (so is a misspelt one).

Errors: unknown genre 'polka' (try: afro_house, afrobeats, alt_hip_hop, …), which names every genre; 'edm' is what big_room and electro_house and future_bass and trance are called: say which; tempo between 40 and 240 BPM; cannot read key 'H minor' (try "A minor", "F#m", "Eb", "D dorian"); complexity from 0 (sparse) to 1 (layered); song() has no option 'tempo' (options: seed bpm key loops short samples sampled sample_search complexity).

song("techno", #{ seed: 3, bpm: 130, key: "F minor", short: true });

blank()

blank(genre)

Replaces the current song with an empty one: a single 8-bar section called loop (kind groove, energy 0.8), no tracks, and one progression, A, which is the key’s tonic chord alone (i in a minor key, I in a major one) at bars_per_chord(1). The rest comes from the genre: the mix (bus effects, master chain, loudness target, reverb and delay), the critic’s genre, and a tempo, key, swing and humanize from the generator. Set the ones you care about; in particular, set prog("A", ...) to the chords you play, since the critic checks the bass and melody against it.

blank("lofi");
tempo(84); key("D minor"); swing(0.58);
track("drums", s("bd ~ ~ bd, ~ sd, hh*8?0.15"));

A script that calls neither song() nor blank() edits the song that is open (the studio’s, or the one passed with claudius script --on), and with no song open it starts from blank("house"). So a script for another genre that should run on its own starts with blank().

Errors: as for song().

Global settings

title()

title(name)    // string

The song’s title, used in the song folder’s name (out/house-night-drive-1/).

tempo()

tempo(bpm)     // number, 40..240
bpm(bpm)       // the same function

Errors: tempo between 40 and 240 BPM; tempo needs a number (also from bpm()).

key()

key(name)      // "A minor", "Am", "F#m", "Eb", "D dorian", "C# phrygian" ...

Sets the key. Roman-numeral progressions and n() patterns follow it; note names in note() patterns do not, since they name absolute pitches. When the mode changes (minor to dorian, major to minor), every diatonic chord in every progression moves to the same degree in the new mode: Imaj7 in a major key becomes i7 in minor, IV7 in dorian becomes iv7 in minor. A borrowed chord keeps its sound and is spelled in the new mode: bIII in F major (A flat) becomes III in F minor, where it is diatonic. Applied chords (V/V) stay as written. Because a borrowed chord can become diatonic, going to minor and back does not always restore the original: bVII becomes VII in minor, and VII becomes vii° back in major. Tonal Apple Loops in the song are repitched the shortest way (at most six semitones).

Errors: cannot read key 'H minor' (try "A minor", "F#m", "Eb", "D dorian").

// G dorian to A minor: progression B, "i7 ii7 i7 VIImaj7", becomes "i7 iiø7 i7 VII7"
key("A minor");

The accepted names and modes are in Pitch.

swing()

swing(amount)  // number, clamped to 0..0.8

Sixteenth-note swing for the whole song. Each off-beat sixteenth (the second of each pair) is moved to amount of the way through its eighth note: 0.5 is straight, 0.58 is a lazy hip-hop feel, 0.66 is close to triplets. Values up to 0.501 play straight. Only notes exactly on the sixteenth grid move; eighth notes and triplets stay where they are. Swing applies when the song renders, to drums, parts and pattern tracks alike.

humanize()

humanize(amount)   // number, clamped to 0..1

How loosely the song is played, applied at render: each hit drifts off the grid as a player’s does, and its velocity varies by 5 % × amount. A player’s hits are not off at random: they leave the grid by 10 to 20 ms, drifting with the hits around them, ahead for a while and behind for a while, over tens of seconds (a 1/f noise, as Hennig et al. found in “The nature and perception of fluctuations in human musical rhythms”, PLOS ONE, 2011, where listeners preferred it to a humaniser’s independent jitter). So a hit drifts by about 15 ms × amount (one standard deviation, three at most): the kick by half of that, the snare and clap by 80 %, the hats by all of it, the rest of the percussion by 120 %, and a part by 60 %. The drum lanes share part of their drift, as one drummer’s limbs, and each part has its own. The drift is drawn from the song’s seed, so it is the same on every render. For a lane or part that plays behind or ahead of the beat on purpose, every hit alike, see late in lane() and part().

Harmony

prog()

prog(name, chords)   // name: string; chords: string, separated by spaces

Sets a progression. Chords are Roman numerals ("i7 VImaj7 iv7 v7") or chord names ("Am7 Fmaj7 Dm7 Em7"); names are converted to numerals in the current key when prog() runs, so call key() first. Each chord lasts bars_per_chord() bars, and the progression loops.

Sections play A unless they say otherwise (sec().prog()), and breaks play B, or A when the song has no B. Any name works: prog("verse", ...) is used by sections that ask for "verse". The progressions drive chord("prog"), the generated parts, the chord track the critic checks melodies and basslines against, and the harmony tab of the studio. Pitch has the numeral rules.

A chord name outside the key gets an accidental (Bb in A minor is bII). A slash chord keeps its bass note, as a name or as a numeral: F/A in A minor is stored as VI/A, and key() moves the bass note with the chord.

Errors: cannot read chord 'Q7' (Roman numerals like i7 VImaj7 bVII, or names like Am7).

blank("house");
key("A minor");
prog("A", "Am7 Fmaj7 Dm7 Em7");     // stored as i7 VImaj7 iv7 v7
prog("B", "Fmaj7/A G Em7 Am7");     // stored as VImaj7/A VII v7 i7
bars_per_chord(1);
track("keys", chord("prog").s("epiano"));

bars_per_chord()

bars_per_chord(bars)   // integer, clamped to 1..8

How many bars each chord lasts: bars_per_chord(2) holds each chord for two bars. It applies to every progression. blank() starts at 1; a generated song has the generator’s value, often 2.

Drums

drum()

drum(lane, steps)                     // the "main" variant, 16 steps per bar
drum(lane, variant, steps)
drum(lane, variant, steps, per_bar)   // per_bar: integer, clamped to 1..96

Writes a drum lane’s pattern as a step string, the way a step sequencer shows it:

characterhit
Xaccent, velocity 1.0
xhit, 0.8
oghost note, 0.45
1 to 9velocity 0.1 to 0.9
|, spacesignored, for readability
anything else (., -, 0 …)rest

There are 16 steps per bar unless per_bar says otherwise: 32 for thirty-second notes, 12 or 48 for triplet grids. The length of the string decides the length of the pattern, rounded up to whole bars (at most 16): 16 steps are one bar, 20 steps are two bars with the last 12 steps empty. All the variants of a lane have the same length; a shorter one is repeated to fit.

On an existing lane, drum() replaces that variant. On a song without the lane, it creates one, if the name is a drum name (or hats): the lane uses the synthesized voice at its default settings, and joins every section with energy 0.6 or more. drum_sound() changes what it plays.

Sections choose a variant by name with .variant(); intros and outros use sparse, the others main, and a lane without the requested variant plays main.

A lane’s mixing role comes from its name when the name is a drum name (bd and kick are kicks, sd and snare snares), else from the sound it plays. The arranger finds lanes by role: a build’s snare roll goes on the snare lane, else the clap; the kick drops out at the end of a build, and the other tracks duck against it. In a section with fills, the genre’s drummer ends the phrases on the lanes that play what each turn or fill names (a snare fill on the clap or the rim when there is no snare, toms on the congas or the percussion, or pitched on the snare); the drummer is the genre’s the backbeat lane plays as (its lane() genre), else the song’s.

Errors: no drum lane 'bongo', and drum() makes lanes only for drum names (bd kick sd ...); the song's lanes: kick clap hat ohat shaker perc. drum_sound("bongo", "tr909:lt") makes a lane of any name with its sound, and track("bongo", s("...")) a pattern track.

drum("kick", "X...x...X...x..x");                     // a pickup into the next bar
drum("hat", "sparse", "..x...x...x...x.");
drum("hat", "main", "x.x.x.x.x.x.x.x.x.x.x.x.x.x.xxxx", 32);

trig()

trig(lane, step, settings)            // the "main" variant
trig(lane, variant, step, settings)   // step: sixteenths from the pattern's start, from 0; settings: a map

Sets what a step does beyond striking, as a drum machine’s trig does: when it plays, how it strikes, where, and what it changes in the sound for that stroke. step counts sixteenths from the start of the lane’s pattern: 0 is the downbeat, 4 beat 2, 8 beat 3, 12 beat 4, 16 the next bar’s downbeat. A fraction reaches a 32nd or a triplet step. A step without a hit gets one, and an empty map clears the step’s trig.

settingrangewhat it does
v0.05 to 1the hit’s velocity
prob0 to 1the chance it plays, drawn afresh each time round the pattern, the same in every render of the song
cond"always", "1:2" … "16:16", "first", "last", "!first", "!last"when it plays, counting times round from each section’s start: "1:2" the first of every two, "4:4" the fourth of every four, "last" only the last time round in the section
ratchet1 to 8strokes within its sixteenth: 2 are 32nds, 3 a triplet, 4 64ths
ramp-1 to 1how a ratchet’s velocity moves: 1 swells to the last stroke, -1 fades from the first
flam0 to 60a grace stroke that many ms before it, at half its velocity
nudge-0.5 to 0.5where it lands off the grid, in sixteenths: below 0 early, above late (after swing)
pitch-24 to 24semitones, for that stroke
decay0.1 to 4its decay, times the lane’s: a synthesized drum rings for that long, a sample is cut shorter (it cannot ring longer than it is)
tone-1 to 1darker below 0, brighter above
pan-1 to 1a balance for that stroke: -1 all left
song("trap", 2);
trig("hat", 6, #{ ratchet: 4, ramp: 1 });                     // a roll that swells into beat 3
trig("hat", 14, #{ ratchet: 3, ramp: -1, cond: "1:2" });      // a fading triplet, every other bar
trig("snare", 12, #{ flam: 18 });
trig("kick", 10, #{ v: 0.7, prob: 0.5, cond: "last", pitch: -2 });

drum() writing a lane’s pattern again keeps the trigs of the steps that still strike. The printed script writes each trig after its pattern, with only the settings it changes. Errors: trig() has no option 'ratchets' (options: v prob cond ...), trig()'s ratchet is 1 to 8, not 12, trig(): hat's steps go from 0 to 15 (sixteenths), not 64, trig(): hat has no variant 'fill' (variants: main sparse), and a condition that does not read: a step plays always, a:b (1:2, 3:4 ...: the a-th time round of every b, b up to 16), first, last, !first or !last, not 'often'.

lane()

lane(lane, settings)   // settings: a map

Gives a drum lane a time and feel of its own, apart from the song’s, and the genre it is played as:

settingrangewhat it does
length0, or up to its pattern’s sixteenthshow many sixteenths it plays before it starts again; 0 is its pattern’s length. 12 against the bar’s 16 is a polymeter: the lane comes round every three beats while the others take four. For a lane longer than a bar, write its pattern that long first with drum()
speed0.125 to 4how fast it runs through its steps: 2 plays them as 32nds, 0.5 as eighths, 0.75 stretches a bar of steps over a bar and a third
swing0.5 to 0.8, or 0its own swing, as swing() sets the song’s; 0 gives it the song’s again
groovea groove’s name, or ""the groove it plays in: one of claudius’ own (below) or one of the song’s from groove(); "" none
groove_amount0 to 1how much of the groove: 0.5 moves each stroke half as far and accents it half as much
late-80 to 80 mshow far behind the beat every hit plays, alike, as a drum machine’s shift timing moves a pad; below zero, ahead. A snare 20 late lays the backbeat back, a kick 5 early pushes it: the drunk feel J Dilla made on an MPC has the kick early and the snare late, the hats on the grid. Unlike a groove it is in milliseconds, the same at any tempo
genrea genre’s name, or ""the genre whose drummer it plays as, which another take of it is written from (the studio’s Another take, vary_track); a lane generated from another genre’s drums has it. "" is the song’s

A groove moves each sixteenth of the bar by its own amount and accents it by its own factor, as a drum machine’s groove template does. Only strokes exactly on the song’s sixteenths take it: a 32nd, a triplet or a ratchet’s inner strokes stay where they are. A lane in a groove takes its timing from the groove rather than from the song’s swing, unless it has a swing of its own.

groovefeel
straighton the grid
swing54, swing58, swing62, swing66, swing71each second sixteenth of an eighth that far into the eighth, as a drum machine’s swing setting; 66 is a triplet
shufflethe off-beat eighths and sixteenths on triplets, a little softer than the beats
dillathe off-beats and the backbeat dragged, each by its own amount, and the downbeats leaned on
pusheverything but the beats a little early
lazyeverything but the beats a little late
song("house", 3);
lane("hat", #{ length: 12 });                            // round every three beats, against the kick's four
lane("shaker", #{ speed: 1.5, swing: 0.6 });
lane("perc", #{ groove: "dilla", groove_amount: 0.7 });

The printed script writes a lane’s settings after its pattern, with only those that differ from the song’s. Errors: lane(): no drum lane 'bongo' (lanes: kick clap hat ohat shaker perc), lane(): hat's length is up to its pattern's 16 steps (a longer pattern first, with drum()), not 24, lane()'s speed is 0.125 to 4, not 8, lane()'s swing is 0.5 (straight) to 0.8, or 0 for the song's, not 0.3, lane(): no groove 'jazz' (grooves: straight swing54 ...), lane() has no option 'steps' (options: length speed ...).

groove()

groove(name, file)        // file: a recording with drums in it
groove(name, file, bpm)   // bpm: its tempo, when known
groove(name, table)       // table: #{ timing: [16 numbers], accent: [16 numbers] }

Keeps a groove with the song as name, for lane() to put lanes in. From a recording, claudius finds the tempo and beat grid of its drums, sets every hit against the sixteenth nearest it, and measures where each of the sixteen sixteenths of the bar lands (the median of its hits’ distances from the grid) and how hard (their mean loudness against the recording’s). The beats themselves are put back on the grid, so a downbeat found a little early or late doesn’t move the whole groove. The log says what it heard: groove funk, heard in loops/funk.wav at 96 BPM: the off-beat sixteenths at 58% swing, the backbeat 9% of a sixteenth behind, the accents on 1, 2, 3e.

The recording’s tempo is bpm when given, else one written in the file’s name (Funk Break 92bpm.wav, loop_85_BPM.aif), else heard. Heard, a loop’s tempo can come out twice or half what it is, as its drums sit on sixteenths at either, and then the groove is measured on the wrong sixteenths: give the tempo when you know it.

A table writes a groove out: timing in beats for each sixteenth (below 0 early, -0.25 to 0.25), accent a factor on each one’s velocity (0 to 2). Either can be left out: on the grid, all 1. The printed script writes the song’s grooves as tables before its drums, so it reads back without the recording.

song("lofi", 2);
groove("lean", #{
    timing: [0, 0.04, 0, 0.05, 0.02, 0.04, 0, 0.05, 0, 0.04, 0, 0.05, 0.02, 0.04, 0, 0.05],
    accent: [1, 0.7, 0.9, 0.75, 1.1, 0.7, 0.9, 0.75, 1, 0.7, 0.9, 0.75, 1.1, 0.7, 0.9, 0.75]
});
lane("hat", #{ groove: "lean" });
lane("snare", #{ groove: "lean", groove_amount: 0.5 });

Errors: groove()'s timing is a list of 16 numbers, one a sixteenth, not 2, groove()'s accent holds 0 to 2, not 3, groove()'s tempo is 40 to 250 BPM, not 400, a file that can’t be read, and one without enough drums in it: too few drum hits to hear a groove in (3): it wants a beat, a few bars of it.

drums_from()

drums_from(file)             // file: a recording of a beat, played or beatboxed
drums_from(file, settings)   // settings: #{ bars, variant, bpm }

Writes the beat in a recording into the song’s drum lanes. claudius hears each hit and names it a kick, a snare or a hat, sets the hits on the recording’s own grid (its tempo bpm, else one in the file’s name such as 92bpm, else heard; its own downbeat), and folds every time round into a pattern of bars bars: 1, 2 or 4, the recording’s length up to 4 when not given. Each kind goes into the song’s lane of that role, the snares into its snare lane, else its clap’s, as their variant patterns (main), and a song without such a lane gets one. A step hit in only some of the times round plays with that chance, as a trig() prob. The log says what went where: beat.wav into drums, 2 bars as their main patterns: kick 6 steps into kick, snare 4 steps into clap, hat 16 steps into hat (2 by chance).

Takes turn into drums the same way, from the studio or over MCP, on the song’s grid from the take’s first beat. The printed script writes the lanes as patterns, so it reads back without the recording.

Errors: a beat's pattern is 1, 2 or 4 bars, not 3, drums_from() has no option 'beats' (options: bars variant bpm), drums_from()'s bpm is 40 to 250, not 400, a file that can’t be read, one too short or too quiet to hear a beat in (too few drum hits to hear a groove in (0)), and one without drums: beat.wav has no drums claudius can hear: it wants a beat, kicks, snares and hats, played or beatboxed.

drum_sound()

drum_sound(lane, sound)         // sound: string
drum_sound(lane, sound, bank)   // bank: string, a drum machine or kit

Sets what a drum lane plays, keeping its patterns:

  • a drum name, for the synthesized voice: drum_sound("snare", "cp");
  • a kit sound from the sample packs: drum_sound("kick", "tr909:bd"), or the same as drum_sound("kick", "bd", "tr909"), with any bank; a variation number picks another recording ("tr909:bd:12");
  • another recording from the packs, such as "conga";
  • an audio file: drum_sound("perc", "/Users/me/Samples/rim.wav").

Naming the sound the lane already plays keeps it as it is, including the tuning evolution gave a synthesized voice. The lane keeps its name, so a lane named with a drum name keeps its role; a lane named otherwise takes the role of its new sound.

On a lane the song does not have, drum_sound() adds it, playing the sound and silent until drum() writes its steps, under any name: drum_sound("bongo", "tr909:lt"); drum("bongo", "..x...x...x.x..."); (drum() alone makes lanes only for drum names). It joins the sections the way a new track does. A song printed as a script writes such a lane’s sound before its steps.

Errors: 'lead' is a track of the song that is not a drum lane; 'pad' is not a drum sound (a drum name, a kit sound, or a sample) for a synth preset; the sound errors for a name that does not resolve.

song("house", 9);
drum_sound("kick", "tr909:bd");
drum_sound("clap", "cp", "tr808");

Parts

part()

part(name, options)   // options: map with any of the fields below

Edits a part the theory engine writes: the bass, chords, pad, lead, arp or keys of a generated song. On a song without that part (a blank() song has none), part() first adds the genre’s part, written by the theory engine over the song’s progressions and joining the sections the way a new track does; the options then edit it. part("bass", #{}) adds the genre’s bass as it comes.

With a role, part() adds a part of your own under any name: part("lead2", #{ role: "lead" }) is a second lead, written the way the genre writes its lead (its styles, register and mix, and a sound of its own), and part("keys", #{ role: "keys" }) on a techno song, which has no keys, gets the role’s styles and synth presets. A role the part already has changes nothing; another is an error. A song printed as a script writes the role of every part the genre does not have, so it builds again.

fieldtypeeffect
rolestringbass, chords, pad, keys, lead or arp: a part of your own, when the song has no part of that name
stylestringhow the part is written (below)
presetstringa synth preset or a sampled instrument; naming the current preset keeps its patch
register[low, high]MIDI range the part is written in
densitynumber, clamped to 0..1how busy a lead is
seedintegera new seed rewrites this part, and only this part
ratenumber, clamped to 1/32..4arpeggio step in beats (0.25 is sixteenths)
doublesstringanother part whose notes this one plays, on its own sound: a double; "" makes it play its own again
harmonizesstringanother part whose melody this one plays chords under (a chords, pad or keys part): a harmony; "" makes it play chords of its own again
octaveinteger, -2 to 2how many octaves from that part’s notes a double plays them
latenumber, -80 to 80how far behind the beat it plays, in milliseconds (ahead, below zero): a bass pulled 15 behind the drums, as a neo-soul bassist plays
rolestyles
bassthe motifs sustain, pulse, root8, offbeat, octave, rolling, syncopated, acid, reese; the 808s that follow the kick, kick_follow, glide (trap’s, sliding up into its phrase ends) and drill (sliding from note to note); and the genres’ bass idioms: one_drop, steppers, slap, funk, disco, garage, dembow, afro, log_drum, walking, neo_soul, soul, rnb, gfunk, boom_bap, lofi, two_step, jungle_dub, halftime, dub, house_organ, deep, tech, new_jack, grime, trip_hop, big_beat, rock, drive
chords, pad, keysthe rhythms sustain, half, stabs, offbeat, pump, syncopated, charleston; and the genres’ comping idioms: house_piano, gospel, lofi_comp, trap_keys, rnb_keys, ballad, bubble, skank, scratch, strum, palm, chug, highlife, arpeggio, and for strings and horns legato, ostinato, pizzicato, disco_strings, tremolo, brass_stabs
a part that harmonizesblock (a chord under each of the melody’s notes), and the chord rhythms and comping idioms above, played on the harmony’s chords
arpup, down, updown, random, pinky
leadmotif, a motif with A A′ A B phrasing that density and seed change; and the genres’ lead idioms: gfunk_whine, trap_bells, drill_melody, afro_flute, dembow_hook, synth_lead, trance_lead, organ_riff, disco_hook, horn_riff, reggae_horns, riff, garage_chop, lofi_melody, rnb_runs, rock_lead, ambient_line, techno_stab, phonk_cowbell, piano_riff

A style the part’s role does not have is an error. A decimal seed is ignored.

A double plays the notes of the part it doubles, as they are written or as the theory engine writes them, moved by its octaves: a producer’s layer of the same line on a second instrument. It plays in the sections that name it, and follows its part through edits, mutations and a new seed. Notes written out on the double itself, with notes() or in the piano roll, take its place, and a double whose part is gone plays notes of its own, as any part of its role. A part another doubles cannot double one itself. A layered song’s generator makes doubles this way (chords_double, lead_double, bass_double).

song("house", 3);
part("chords_double", #{ role: "chords", doubles: "chords", octave: 1, preset: "bell" });

A harmony plays chords under the melody of the part it harmonizes: chords that fit its notes and the song’s own. The song’s chord stays wherever the melody’s notes are its chord tones or pleasant extensions of it (a 9th, a 6th, a 7th); over a held note it clashes with, the key’s chord that holds that note and shares most with the song’s chord takes its place for that half bar, as a player would reharmonize it. In style block a chord sits under each of the melody’s notes that is long enough or on a beat, voiced below it within its register, a whole step at least under the melody and with no two voices a semitone apart, voice-led from chord to chord; the short notes between ring over it. The chord styles play the chosen chords in their rhythms instead (sustain holds a pad under the melody). A harmony plays only where its melody does, follows it through edits, mutations and a new seed, and with notes of its own written out plays those; with its melody gone it plays chords of its own, as any chord part. A part that harmonizes cannot also double one, and a harmony cannot be harmonized.

song("house", 3);
part("lead_chords", #{ role: "keys", harmonizes: "lead", style: "block", preset: "pluck" });

Errors: no part 'keys' (the song has: bass chords pad lead arp; house parts: bass chords pad lead arp); a role makes one of your own (part("keys", #{ role: "keys" })), and track() writes your own notes; part 'lead' is a lead part; remove("lead") first to make it another; part(): a role is bass, chords, pad, keys, lead or arp, not 'drums'; 'kick' is a track of the song that is not a part: give the part another name; a bass part has no style 'wobbly' (styles: sustain pulse root8 ...); unknown preset 'nope' (synths: ...; or an installed instrument such as piano, rhodes, string_ensemble); part 'lead' doubles 'keys', which is not a part of the song; part 'keys_double' doubles 'keys', which doubles another part: double that one; part 'keys' is doubled by 'keys_double', so it cannot double another; part(): an octave is a whole number from -2 to 2, not 3; part 'lead_chords' harmonizes 'lead_chords2', which harmonizes another part: harmonize the melody itself; part 'low' is a bass part: a part that harmonizes plays chords, as a chords, pad or keys part; part 'lead_chords' doubles another's notes or harmonizes them, not both; part() has no option 'styles' (options: role style preset register density seed rate doubles harmonizes octave late).

part("bass", #{ style: "rolling", preset: "reese" });
part("lead", #{ seed: 42, density: 0.4 });
part("chords", #{ style: "stabs", register: [55, 72] });

On a blank song, part() gives you the generator’s parts over your own progression:

blank("house");
key("A minor"); prog("A", "Am F C G");
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4"));
part("bass", #{ style: "offbeat" });
part("chords", #{ style: "stabs", preset: "stab" });

notes()

notes(part, prog, [[start, length, pitch, velocity], ...])
clear_notes(part, prog)

Writes out what a part plays over a progression: the notes replace what the theory engine writes there, every time round, and the part keeps its sound, its mix and its sections. Each note is [start, length, pitch] or [start, length, pitch, velocity]: beats from the start of the progression’s cycle, beats long, a MIDI pitch from 0 to 127 (60 is middle C), and a velocity from 0 to 1 (0.8 when left out). Notes that run past one cycle make it longer: the part comes round after the last note it reaches. An empty list rests over that progression. clear_notes() lets the theory engine write the progression again.

The studio’s piano roll, its Notes tab, writes these. A song printed as a script writes a notes() line for every progression a part has written out, by hand, from a take or from a keyboard, so the script plays the same notes.

Errors: notes(): no part 'nope' (parts: bass chords pad lead arp); notes(): no progression 'Z' (progressions: A B); notes(): note 2 is [start, length, pitch] or [start, length, pitch, velocity]: ... for a note it cannot read (a length of 0, a pitch outside 0 to 127); notes(): 5000 notes in one progression; the limit is 4096.

notes("lead", "A", [[0, 0.5, 69], [0.5, 0.5, 72], [1, 1, 76, 1], [3, 0.5, 74, 0.6]]);
notes("bass", "B", []);
clear_notes("bass", "B");

Tracks

track()

track(name, pattern)

Makes a pattern track, or replaces the track of that name: a drum lane, a generated part, a loop or another pattern track (track("bass", ...) on a generated song replaces its bass part). The pattern’s sounds and words are read here, so an unknown sound, a word the pattern cannot read (note("h3")) or a pattern that is too dense fails at this line.

Where it plays:

  • A replaced track keeps the replaced track’s place in every section.
  • A new track joins every section with energy 0.6 or more, or every section when no section has any track yet (the first track of a blank() song).
  • form() and layer() decide it exactly.

Its mix comes from the pattern’s own settings (.level(), .pan(), .room() …); a mix() on the old track does not carry over. Its role comes from .role(), else from its sound (see Roles). A sound pattern with several sounds becomes one track per sound when arranged: drums.bd, drums.cp, drums.hh.

Each track() writes a log line with the sounds it found:

blank("house");
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4"));
track drums: bd, cp, hh

Errors: track 'x': unknown sound 'bdd' (...); track 'x': cannot read 'h3' as a note (...); track 'x': this pattern is too dense to play: it makes more than 262144 events (or it needs more than 4000000 steps of work); track 'x' plays 2048 notes per bar; the limit is 1024. See Errors and limits.

rack()

rack(track, [#{ sound, bank, band, level, pan, transpose, duck, fx }, ...])

Has several sounds play a track at once, each a layer of its notes with the band of frequencies it keeps, its level against the others, its pan, transpose, duck under the kick and its own effects, summed before the track’s own chain: a bass of a sub, a growl and a top. It takes the place of the track’s sound, on a part, a drum lane or a pattern track’s sound ("beat.kick" when the pattern plays several); 1 to 8 layers. A layer naming a sound the track plays already keeps it as it is, as naming a part’s current preset keeps its patch. See Layered sounds.

Errors: rack("bass") has 1 to 8 layers, not 0; rack("bass")'s layer 1 names its sound; rack("bass")'s layer 1's band is [low, high] in Hz, ...; rack("bass")'s layer 1's transpose is whole semitones from -24 to 24, ...; no track 'nope'.

rack("bass", [#{ sound: "sub_bass", band: [0, 90], duck: 0.7 }, #{ sound: "moog_bass", band: [90, 0], level: -3 }]);

mute(), unmute(), solo(), unsolo(), remove()

mute(track)    unmute(track)
solo(track)    unsolo(track)
remove(track)

mute() silences a track; while any track is soloed, only soloed tracks play, and only they are judged. remove() deletes the track and takes it out of every section. They work on drum lanes, parts, loops and pattern tracks.

Errors: no track 'nope'.

mute("hat");
remove("arp");

Form and sections

The form is the song’s list of sections: an intro, a groove, a break, a build, a drop. Each section has a kind, a length in bars, an energy, a progression, a drum variant, the tracks (layers) that play in it, and flags that ask the arranger for builds, gaps, impacts, fills and filter sweeps. This page says exactly what each one does.

form()

form([sec(...), sec(...), ...])

Replaces the whole form. Sections play in the order given. Two sections with the same name are renamed in order: the second drop becomes drop2, the third drop3.

Every layer must be a track of the song, or one of the genre’s optional parts and loops (which may be absent from a song, and are silent then). "*" and a missing layer list mean every track that exists when form() runs; tracks added later join by the track() rule. Every section’s progression must exist, except B, which a section plays as A on a song without one, and a bridge’s: a bridge that names a progression the song does not have gets one of its own, written as form() runs (see sec()).

Errors: form() takes sec(...) items; section 'drop' uses 'snare', which is not a track (tracks: kick clap hat ohat shaker perc bass chords pad lead arp); section 'drop' plays progression 'C', which the song does not have (progressions: A B; prog() adds one).

form([
  sec("intro", 8, "kick hat perc pad").filter_in(),
  sec("groove", 16, "kick clap hat ohat perc bass chords"),
  sec("break", 8, "pad chords lead"),
  sec("build", 8, "clap hat pad lead").gap(),
  sec("drop", 16, "*").impact(),
  sec("outro", 8, "kick hat perc bass"),
]);

sec()

sec(kind, bars)            // every track
sec(kind, bars, layers)    // layers: "kick hat", ["kick", "hat"] or "*"

bars is an integer, clamped to 1..256. The kind is one of the words below; breakdown, chorus, loop and middle_eight are accepted for break, hook, groove and bridge, and the section keeps the word you wrote as its name.

Each kind comes with defaults:

kindenergyprogressiondrum variantflags on
intro0.4Asparse
verse0.65Amain
groove0.65Amainfills
build0.6Amainbuild
drop0.95Amainfills
hook0.95Amainfills
break0.35B (A when there is no B)main
bridge0.5bridge, its ownsparse
outro0.4Asparse

A bridge is somewhere the song has not been before it comes back. When the song has no progression of the name it plays (bridge unless .prog() names another), form() writes one: it sets out away from the tonic (on the fourth or the sixth of a major key, a minor key’s sixth, fourth or third), never plays the same chord twice in a row, and ends on the dominant seventh of the chord the next section starts on, so that it leads into it; as many chords as its bars take at the song’s bars_per_chord, two to eight. Every part plays it with notes of its own, as each does every progression.

The kind also matters to the arranger (drops and hooks get crashes every 8 bars, a final outro closes a filter) and to the critic, which compares the loudness of drops and hooks with breaks.

Errors: unknown section kind 'party' (intro verse build drop break hook groove outro bridge); layers are a string ("kick hats") or an array of names.

Section methods

Each method returns a new section, so they chain: sec("drop", 16, "*").energy(1.0).impact().

methodsetsvalues
.name(s)the section’s name, used by section(), layer() and the studiostring
.energy(x)the section’s energynumber, clamped to 0..1
.prog(name)which progression it playsany progression name
.variant(name)which drum-lane variant it playsmain, sparse, alt, half …
.build()a build into the next sectionalso .build(true), .build(false); .build(style) and .build(style, amount) choose how it builds, and styles stack: .build("roll+riser")
.build_bars(n)the bars at the section’s end the build-up takesa whole number; 0 for each part’s own length
.gap()a beat of silence at the endalso takes true / false, or a number of beats: .gap(2)
.impact()a crash and an impact on the first beatalso takes true / false
.fills()drum fills at 8-bar phrase endsalso takes true / false
.filter_in()a lowpass opening across the sectionalso takes true / false

.energy() raises energy needs a number for anything else. A variant that does not exist plays main. A progression that does not exist is an error when form() gets the section, unless it is B (see above).

What the flags do

These are the exact rules of the arranger (compose::arrange). Several act on drum lanes only (the lanes written by the generator or by drum()); pattern tracks are never rewritten, so a song made only of patterns gets the risers, sweeps and crashes but no automatic rolls or fills.

The arranger finds lanes by their role. The fill lane is the first lane whose role is snare (a lane named snare or sd, or one that plays a snare sound), or clap when there is none; the kick lane is the first lane whose role is kick.

build

A build-up leads into the next section. How it builds is its style, .build(style), and how hard is its amount, .build(style, amount), from 0 (gently) to 1 (as hard as it goes). .build() is classic at half, as every build was before builds had styles. Styles stack with +: .build("roll+riser") plays the roll, the kick out and the riser, all that each plays, and no sweep.

styleplays
classicthe roll, the kick out, the riser and the sweep below
rollthe roll and the kick out: a drummer’s build
sweepthe riser and the sweep, the drums playing on: a house or techno build
riserthe riser alone
drop_outthe riser, and every drum lane silent for the last bars: a pop or EDM song holding its breath
  • The roll. The fill lane stops its pattern for the last part of the section and plays a snare roll instead: quarter notes, then eighths, sixteenths and thirty-seconds, with velocity rising from 0.4 to 1.0. At half, the roll lasts half of the section’s first 8 bars, between 1 and 4 bars: 4 bars in an 8-bar build, 2 in a 4-bar one. The amount makes it 0.5 to 1.5 times that long (half a bar at least, the section at most), and its hits 0.7 to 1.3 times as loud (full at most). It is added even when the fill lane is not a layer of the section. A build that rolls has no fill at its end; one of another style keeps its fills.
  • The kick out. The kick lane stops for the last bar; for none below an amount of 0.25, for two bars from 0.75.
  • The riser. A riser plays over the last bars of the section: the genre’s riser length (8 bars in house, techno, dnb and future bass; 4 in deep house and synthwave), or the whole section if it is shorter, 0.5 to 1.5 times that by the amount, at a velocity from 0.6 (none) to 1.0 (half and more). Trap and lofi have no riser.
  • The sweep. A highpass filter on the music and bass buses sweeps from 10 Hz across the section and snaps back at the next one: to 900 Hz at half, 300 Hz at none, 2.7 kHz at the most.
  • The drums out. Every drum lane stops for the last bar at none, the last two at half, the last three at the most.
  • Its bars. .build_bars(n) gives the build-up the section’s last n bars (the section at most): the roll, the riser and the sweep all take exactly those bars, whatever the amount, and the kick and the drums leave no earlier than they start. Without it, each part is as long as the style and the amount make it.
form([
  sec("groove", 16, "*"),
  sec("build", 8, "kick hat chords").build("sweep", 0.8),   // a house build: the lows swept away, the drums on
  sec("drop", 16, "*").impact(),
  sec("verse", 16, "*").build("roll+riser").build_bars(4),  // a roll and a riser over the verse's last 4 bars
  sec("hook", 16, "*"),
]);

gap

In the section’s last beat, every track except the riser and the reverse crash is silent: notes that start there are removed and notes that ring into it are cut. Audio loops keep playing. A gap before a drop makes the downbeat land harder. .gap(beats) makes it that many beats long instead, from a sixteenth (0.25) to the whole section: .gap(2) holds two beats of silence, .gap(0.5) an eighth note. A drummer’s fill ends where the gap starts.

impact

  • A crash on the first beat, at full velocity.
  • An impact hit and a downlifter, in genres that use them: house, techno, dnb and future bass have both; deep house has only the downlifter, trap only the impact, synthwave and lofi neither.
  • A reverse crash over the last 2 beats of the section before, in genres that use it (all but techno and lofi).

fills

At the end of every 8-bar phrase, counted from the section’s start, the fill lane’s last 1 or 2 beats are replaced by a fill: a sixteenth-note roll, triplets, or a broken groove, at 85 % velocity. At about a third of those phrase ends, the kick drops out for the last half beat. A section shorter than 8 bars gets no fills, and a 12-bar section gets one, at bar 8.

filter_in

A lowpass filter on the music and bass buses opens from 350 Hz to 20 kHz across the section: the classic intro that comes into focus. The drums are not filtered.

Without a flag

  • Drops and hooks get a crash every 8 bars after their first bar, at velocity 0.7.
  • A final outro (the last section, of kind outro) closes a lowpass on the music and bass buses from 20 kHz, starting 40 % of the way in, down to 500 Hz at the end.
  • Every section starts its patterns from their first cycle and its progression from its first chord (see Patterns and time).

Energy

Energy is a number from 0 to 1 that says how intense a section is meant to be. It does not change the sound by itself; what plays decides that. It is used in three places:

  • the critic checks that sections get louder where energy rises (the correlation between energy and measured loudness) and that the loudest drop or hook is at least 3 LU louder than the quietest break;
  • new tracks made by track() or drum() join the sections with energy 0.6 or more;
  • the generator, when it builds a song around Apple Loops, layers the loops into sections by energy.

So set energies that match the layers: a break with three quiet tracks at 0.35, a full drop at 0.95.

section()

section(which, options)   // which: a section name or a 0-based index

Edits one section. A name picks the first section with that name.

fieldtypeeffect
barsnumberlength, clamped to 1..256
energynumberclamped to 0..1
prog, variant, namestringas the methods above
layersstring, array or "*"replaces the layers
build, gap, impact, fills, filter_inboolthe flags; gap also takes a number of beats, which turns it on
build_style, build_amount, build_barsstring, number, numberhow the build-up builds (styles stack with +), how hard, 0 to 1, and the bars at the end it takes (0: each part its own length); a style or bars named turn the build-up on, unless build: false
gap_beatsnumberhow long the gap lasts, in beats; turns the gap on, unless gap: false

The section is checked as form() checks it: its layers must be tracks (or the genre’s optional parts and loops) and its progression must exist. The map takes only the fields above.

Errors: no section 'nope'; no section 12; section() takes a name or an index; section 'drop' uses 'leed', which is not a track (tracks: ...); section 'break' plays progression 'Z', which the song does not have (progressions: A B; prog() adds one); no build-up 'swirl' (build-ups: classic, roll, sweep, riser, drop_out, or several with +, as roll+riser); a gap lasts some beats, more than none (0); section() has no option 'bar' (options: bars energy prog variant name layers build build_style build_amount build_bars gap gap_beats impact fills filter_in).

section("drop", #{ energy: 1.0, layers: "kick clap hat bass chords lead" });
section(0, #{ bars: 16, filter_in: true });

layer()

layer(section, track, on)   // section: name or 0-based index; on: bool

Switches one track on or off in one section, without touching the others. The track must exist, or be one of the genre’s optional parts or loops.

Errors: no section 'nope'; layer() takes a section name or index; no track 'leed' (tracks: ...).

layer("break", "lead", false);
layer("intro", "shaker", true);

Mixing functions

claudius mixes the way an engineer starts a mix: every track has a role, every role has a target loudness, and each track is brought to its target while it plays. Your settings are offsets from that starting point. This page covers roles, levels, panning, sends, sidechain, buses, effect chains and the master, and the functions that set them. Mixing and mastering explains how to use them.

Roles

A role says what a track is in the mix. Each role has a target loudness, measured in LUFS while the track plays (silence does not count), before the master stage:

roletargetroletarget
kick−12.5bass−14.5
snare−13.5keys−17.0
clap−14.5chords−18.0
hat−17.5lead−18.0
ohat−18.5synth−18.0
tom−18.0sample−18.0
perc−19.5arp−20.5
crash−20.0pad−21.5
ride−20.5vocal−15.0
shaker−21.5top−20.0
drums−14.5texture−27.0

Any other role name gets −19. The transition effects have their own: riser −19, impact −16, downlifter −22, reverse −21. The drum roles (kick snare clap hat ohat shaker perc ride tom crash) also get the full amount of humanize, and an audio file on a drum role rings out instead of stopping at its note length.

How a track gets its role:

  • a drum lane: the role of its name when the name is a drum name (kick and bd are kicks), otherwise the role of the sound it plays;
  • a generated part: its role (bass, chords, pad, lead, arp, keys);
  • a pattern track: .role(name) when the pattern sets it; otherwise, for each sound in it, in this order: the role of a drum name anywhere in the sound’s name (tr808:sd is a snare), perc for percussion from the sample packs (conga, bongo), bass for the bass synth presets (808 is a preset first, so it stays bass), chords for a chord() pattern, bass when the track’s median note is below E3 (MIDI 52), and lead for everything else.

The last rule is the one to watch. A pad written with note() or chord(), an arpeggio, a sampled string section: all become lead or chords unless you say otherwise, and a lead is mixed 3.5 dB louder than a pad and checked by the critic as the melody. Set the role:

blank("house");
track("pad",   chord("<Am F>").s("pad").role("pad"));
track("arp",   n("0 2 4 7").scale("A:minor").octave(4).fast(2).s("pluck").role("arp"));
track("conga", s("~ conga ~ [conga conga]"));   // perc without being told

Genres shift some targets: techno’s kick +1 dB; trap’s bass +4, kick −1, hat +2.5; lofi’s kick −1.5, snare −0.5, keys +2. A bass or a kick that would fill more of the mix’s sub or low band than its genre’s masters do comes down until it does not (the low end), so a genre that lifts its bass gets it deep, not loud.

Level

The gain a track receives is target of its role + genre offset + its level, minus its own measured loudness, limited to −40..+30 dB. level is therefore relative: level: -4 on a pad puts it 4 dB under where a pad normally sits, whatever its sound or velocity. Two tracks with the same role and level play equally loud.

Pan

pan runs from −1 (left) through 0 to 1 (right) and works as a balance control: the far side is turned down and the near side stays at full level. At ±0.5 the far side is about 5 dB down; at ±1 it is silent.

Sends

Every track has two sends, reverb and delay, from 0 to 1. They feed two returns shared by the whole song, whose settings come from the genre:

genrereverbdelay
house2.2 s, 20 ms predelay, low cut 300 Hz0.75 beats (dotted eighth), feedback 0.35, ping-pong
deep_house2.6 s, 25 ms, 280 Hz0.75 beats, 0.3
techno3.0 s, 30 ms, 350 Hz0.5 beats (eighth), 0.45
trap1.8 s, 15 ms, 300 Hz0.75 beats, 0.3
lofi1.6 s, 10 ms, 250 Hz, dark0.75 beats, 0.3, dark
dnb2.8 s, 20 ms, 350 Hz0.75 beats, 0.35
future_bass2.4 s, 20 ms, 300 Hz, bright0.75 beats, 0.35
synthwave3.2 s, 30 ms, 250 Hz, wide0.75 beats, 0.4
trip_hop3.2 s, 30 ms, 250 Hz, dark0.75 beats, 0.32, rising to 0.58 across each break, ping-pong
big_beat1.8 s, 15 ms, 350 Hz0.75 beats, 0.35, ping-pong
electro_house2.0 s, 20 ms, 350 Hz0.75 beats, 0.35, ping-pong
nu_disco2.0 s, 20 ms, 300 Hz0.75 beats, 0.3, ping-pong
filter_house1.6 s, 15 ms, 300 Hz0.75 beats, 0.3, ping-pong
dance_pop1.8 s, 20 ms, 350 Hz, wide0.75 beats, 0.3, ping-pong
neo_psychedelia3.4 s, 30 ms, 250 Hz, wide0.75 beats, 0.4, ping-pong
art_rock2.8 s, 25 ms, 250 Hz0.75 beats, 0.35, ping-pong
idm2.6 s, 25 ms, 300 Hz, bright and wide0.375 beats, 0.35, rising to 0.7 across each break, ping-pong
dub_techno3.5 s, 35 ms, 300 Hz, dark and wide0.75 beats, 0.45, rising to 0.7 across each break, ping-pong
boom_bap1.2 s, 10 ms, 300 Hz, a short room0.5 beats, 0.25
uk_drill2.2 s, 15 ms, 300 Hz0.75 beats, 0.3, ping-pong
dubstep2.4 s, 20 ms, 350 Hz0.75 beats, 0.35, ping-pong
uk_garage1.6 s, 12 ms, 300 Hz0.75 beats, 0.3, ping-pong
jungle2.4 s, 20 ms, 350 Hz0.75 beats, 0.4, ping-pong
afrobeats1.8 s, 15 ms, 300 Hz0.75 beats, 0.3, ping-pong
amapiano2.2 s, 20 ms, 300 Hz, wide0.75 beats, 0.35, ping-pong
reggaeton1.8 s, 15 ms, 300 Hz0.75 beats, 0.3, ping-pong
trance3.0 s, 25 ms, 350 Hz, wide0.75 beats, 0.4, ping-pong
neo_soul1.8 s, 15 ms, 250 Hz0.75 beats, 0.3, ping-pong
hip_hop1.4 s, 15 ms, 300 Hz0.75 beats, 0.3, ping-pong
rnb1.8 s, 20 ms, 250 Hz, wide0.75 beats, 0.35, ping-pong
funk0.9 s, 8 ms, 300 Hz, a short room0.5 beats, 0.2
tech_house1.2 s, 15 ms, 350 Hz0.75 beats, 0.3, ping-pong
ambient4.5 s, 40 ms, 200 Hz, wide0.75 beats, 0.5, ping-pong
grime0.9 s, 10 ms, 350 Hz0.75 beats, 0.25, ping-pong
phonk1.0 s, 10 ms, 350 Hz0.75 beats, 0.25, ping-pong
reggae1.6 s, 10 ms, 300 Hz, bright0.75 beats, 0.45, a dub echo

The sends are taken after the track’s level, sidechain and pan. The returns are ducked by the kick too, by 30 % of the full depth, so tails breathe with the groove.

Sidechain

duck (0..1) is the depth of sidechain ducking from the kick. At each kick, the track’s gain falls to 1 − duck 3 ms before the hit and recovers over the genre’s release time (0.25 beats in trap and dnb, 0.45 in future bass, 0.3 to 0.35 elsewhere), along a curve that comes back quickly at first. At duck: 0.85 a chord nearly vanishes on each kick and swells back: the future-bass pump.

The kick is the first track whose role is kick; a song without one ducks nothing. Pattern tracks start with duck 0.3, except drum sounds and the kick itself, which start at 0. Generated parts take the genre’s values (in house: bass 0.55, chords 0.45, pad 0.5, lead 0.2).

Drive

drive (0..36 dB) overloads a track: after its own effects it goes through a tanh saturator, driven that hard, before it is brought to its level. The track stays as loud as its level makes it, and gets denser and rougher: the drive squashes its peaks and adds harmonics, which is what lets an 808 or a sub be heard on small speakers. Around 6 dB thickens, 12 dB growls, and 24 dB and up is a speaker going to pieces. For a bass that is louder as well, raise its level too:

song("trap", 594000);
mix("bass", #{ drive: 18, level: 4 });

Buses

Each track plays into a bus, and the buses are summed with the reverb and delay returns into the master:

busgetsalways has
drumsdrum lanes, and pattern tracks that play only drum sounds (drum names, kit sounds, percussion from the packs)a tanh saturator (2.5 dB, half wet) after the genre’s chain, unless the genre already saturates
bassgenerated bass parts, and pattern tracks whose role is bassmono below 140 Hz
musiceverything elsewidth 1.25 with mono below 160 Hz
fxcrashes, risers, impacts, downlifters, reverse crashes

On top, each genre has its own chain per bus (house: a glue compressor on the drums and a 110 Hz highpass on the music bus; lofi: a bitcrusher, a lowpass and a compressor on the drums). The arranger adds filter automation to the music and bass buses: the lowpass of filter_in(), the highpass sweep of a build, the lowpass closing in a final outro. The drums bus is never filtered. A script moves a track to another bus and sets any bus’s chain (Effect chains): the arranger’s filters go in front of the music and bass chains whatever they are, and its width and saturator only where the chain has none. A bus of a new name gets nothing from the arranger.

Inserts on pattern tracks

A pattern track can carry its own effects, set with track settings. They run in this order, before the level stage:

  1. .hpf(hz): a highpass filter (resonance 0.1);
  2. .lpf(hz) / .cutoff(hz): a lowpass filter (resonance 0.15);
  3. .crush(bits): a bitcrusher, 1 to 24 bits;
  4. .distort(db): tanh saturation with that much drive.

Because the level stage comes after, saturation and filtering change the tone, not the loudness.

Effect chains

Every track has a chain of insert effects, and so do the buses and the master; the two sends feed a reverb and a delay. A script sets any of them, effect by effect, with the settings the engine keeps (the same map is what blueprint.json stores):

fx("lead", [
  #{ fx: "saturate", kind: "tape", drive_db: 6 },
  #{ fx: "delay", beats: 0.75, feedback: 0.4, pingpong: true, mix: 0.25 },
]);
  • fx(track, chain) replaces a track’s whole chain, and fx("lead", []) empties it. The chain runs in order, before the level stage, so it changes the tone, not the loudness. A pattern track’s .hpf(), .lpf(), .crush() and .distort() are the first effects of its chain, and the next track() for that name sets them again.
  • bus(name, chain) does the same for a bus, master(#{ fx: chain }) for the master, and send_fx(#{ reverb: effect, delay: effect }) replaces what the sends feed.
  • mix(track, #{ bus: name }) sends a track to another bus. A bus of a new name, with a chain of its own, groups tracks to process them together.
mix("chords", #{ bus: "keys" });
mix("pad", #{ bus: "keys" });
bus("keys", [
  #{ fx: "compressor", threshold_db: -20, ratio: 3, attack_ms: 10, release_ms: 120, makeup_db: 2 },
  #{ fx: "width", width: 1.4, mono_below_hz: 200 },
]);

The printed song lists every chain there is (Printing a song), so get_song shows what a track goes through before you change it.

Parallel chains

parallel runs the signal through several chains side by side. Each comes out as loud as its amount, over the signal itself as loud as dry. Both are gains: 1 is as loud as it comes, 0.5 is 6 dB down, 0 is gone. A chain can hold any effects, another parallel too.

fx("bass", [#{ fx: "parallel", dry: 1, chains: [
  #{ amount: 0.5, fx: [#{ fx: "compressor", threshold_db: -30, ratio: 10, attack_ms: 1, release_ms: 60 }] },
  #{ amount: 0.3, fx: [#{ fx: "saturate", kind: "fold", drive_db: 18 }, #{ fx: "filter", mode: "hp", cutoff: 700 }] },
] }]);

That is parallel compression under the bass, and a folded copy above its fundamental for grit, which the bass keeps its weight under.

Settings that move

A setting the table below marks as moving is a number, a curve, or a value for each section:

  • A curve is a list of [beat, value] points, in beats from the song’s start. Between two points it moves in a straight line (a cutoff in equal musical steps); before the first point and after the last it holds.
  • sections(rest, #{ section: value }) holds a value through each section it names, or moves through several across it: [0, 1] rises across the section, [0, 1, 0] rises and falls back. Every other section holds rest. A key is a section’s name (drop2) or a kind (build, drop, hook …); a section’s own name counts before its kind. Moving to the next section’s value takes a 32nd of a beat, so that a step does not click.

Values by section follow the form when the song renders: moving, adding or removing a section moves them with it, where a curve stays on its beats.

fx("pad", [
  #{ fx: "filter", mode: "lp", cutoff: sections(1200, #{ build: [1200, 9000], drop: 9000 }), res: 0.3 },
  #{ fx: "reverb", decay: 4.5, mix: sections(0.15, #{ "break": 0.5 }) },
]);
send_fx(#{ delay: #{ fx: "delay", beats: 0.75, feedback: sections(0.3, #{ outro: [0.3, 0.8] }), pingpong: true, mix: 1 } });

break is a word Rhai keeps for loops, so as a key it is quoted, or written breakdown. chorus names the hook kind too.

The effects

Each effect is a map with its name in fx and its settings; a setting with a default may be left out. mix is the share of the effect in what comes out, from 0 (the signal as it was) to 1 (the effect alone), except in delay, where it is how loud the repeats are on top of the signal.

fxsettings (default)moves
gaindbdb
eqbands: a list of #{ kind, freq, gain_db (0), q (0.707) }, kind lowpass highpass bandpass notch peak lowshelf highshelf allpass
filtermode (lp hp bp notch ladder), cutoff in Hz, res (0), drive (1, the ladder’s), mix (1)cutoff res mix
compressorthreshold_db, ratio, attack_ms, release_ms, knee_db (0), makeup_db (0), mix (1)mix
limiterceiling_db, release_ms
saturatekind (tanh tube tape hard fold), drive_db, mix (1)drive_db mix
bitcrushbits (1 to 24), downsample (1: none), mix (1)bits mix
reverbdecay in seconds, damping (0), predelay_ms (0), width (1), mix, lowcut (250 Hz)mix
delaybeats, feedback (0 to 0.95), damping (0), pingpong (false), mixfeedback mix
chorusrate_hz, depth_ms, delay_ms, mixmix
flangerrate_hz, depth_ms, delay_ms, feedback, mixmix
phaserrate_hz, stages, depth, feedback, mixmix
widthwidth (0 mono, 1 as it is, more is wider), mono_below_hz (0)width
tremolo, auto_panbeats (one cycle), depth
gatesteps (a level for each step), step_beats (0.25), depth, smooth_ms (0)
transientattack_db, sustain_db
tapewow, flutter, drive_db, lowpass_hz
vinylcrackle, hiss_db
tape_stop, reversestart (a beat), len (beats)
stutterstart, len, slice (beats)
parallelchains: a list of #{ fx: chain, amount (1) }; dry (1)amount dry
tunestrength (1), speed_ms (40), humanize (10 cents), vibrato (1), scale ("chords", "key", "chromatic" or #{ notes: ["C", "E", "G"] }), voice (learnt from the track when not given); see Your voicestrength
offeffect: an effect switched off, kept in its place with all its settings and not heard; switched on again, it is effect as it was: #{ fx: "off", effect: #{ fx: "gain", db: 3 } }

Errors say which effect of which chain is wrong, and how: fx("lead")'s effect 2: unknown variant revrb, expected one of gain, eq ...; ... is a map such as #{ fx: "reverb", ... }; missing field decay``; a setting that cannot be read as a number, a curve or values by section; sections(): no section or kind 'chorus2'.

Functions

mix()

mix(track, options)   // options: map with any of the fields below
fieldtyperange (clamped)
levelnumber, dB relative to the role’s target−40..12
pannumber−1..1
reverb (or room)number, send0..1
delaynumber, send0..1
ducknumber, sidechain depth0..1
drivenumber, dB of saturation after the track’s effects (Drive)0..36
mutebool
solobool
busstring, the bus the track plays intoletters, digits, - and _

mix() works on drum lanes, parts, loops and pattern tracks. On a pattern track it overrides what the pattern set (.level(), .pan() …), until the next track() for that name resets the mix to the pattern’s settings. The names fx and transitions address the transition effects (crashes, risers, impacts).

Errors: no track 'nope'; mix() has no option 'volume' (options: level pan reverb room delay duck drive mute solo bus).

mix("pad", #{ level: -4, reverb: 0.45 });
mix("lead", #{ pan: 0.2, delay: 0.25, duck: 0.2 });
mix("fx", #{ level: -3 });

master()

master(options)   // options: map
fieldmeaningrange (clamped)default
lufsintegrated loudness of the finished master−24..−5the genre’s
ceilingtrue-peak ceiling, dBTP−3..−0.1−1
fxthe master’s chain, as for fx()the genre’s

The master stage runs the genre’s master chain (EQ, a glue compressor, saturation; tape and vinyl in lofi), then searches for the input gain that lands the song within 0.15 LU of lufs, through a soft clipper 0.1 dB under the ceiling and a limiter 0.5 dB below it, and trims the result if the true peak still pokes over. The genre targets are house −10, deep_house −11, techno −9, trap −9, lofi −12.5, dnb −8.5, future_bass −9, synthwave −10.5, trip_hop −11, big_beat −8.5, electro_house −8, nu_disco −10, filter_house −9, dance_pop −8.5, neo_psychedelia −10, art_rock −10.5, idm −10, dub_techno −10.5, boom_bap −10, uk_drill −9, dubstep −9, uk_garage −9.5, jungle −9.5, afrobeats −9.5, amapiano −10, reggaeton −9, trance −9, neo_soul −11, hip_hop −9.5, rnb −10, funk −10, tech_house −8.5, ambient −14, grime −9, phonk −8 and reggae −11 LUFS.

Every printed song has a master() line with these two values (see Printing a song).

Errors: master() has no option 'loudness' (options: lufs ceiling fx).

master(#{ lufs: -9, ceiling: -1 });

mute(), solo() and the others

mute(), unmute(), solo(), unsolo() and remove() are on the song functions page. When any track is soloed, everything else is left out of the arrangement, including the transition effects (unless fx is soloed), and the critic judges only what is left.

Songs as scripts

Every song can be printed as a script, whether it was generated, written by hand, edited in the studio, mutated or remade from audio. The printed script is the readable form of the song: its tempo and key, its progressions, every drum lane as step strings, every generated part with its settings, every pattern track’s code, the form and the mix settings that differ from the defaults.

The guarantee

Running a song’s printed script on that same song changes nothing. The test suite checks this for generated songs in several genres and for songs built from patterns. It is what makes the printed script useful: copy it, change one line, run it, and only that line changes.

The guarantee is about running the script on the song it came from. Run anywhere else, a printed script is a recipe for the song only as far as the header and What is not printed allow.

Where to get it

wherehow
command lineclaudius script song.rhai --print prints the song a script makes, instead of rendering it
any song folderecho "" | claudius script - --on out/house-crimson-tide-9 --print prints a saved song (an empty script changes nothing)
song foldersfolders written by claudius script and by saving in the studio (save) have song.rhai
studiothe script tab shows the open song as a script
assistantsthe MCP tool get_song includes it
HTTPGET /api/script

What a printed script looks like

This script:

blank("house");
title("Night Drive"); tempo(122); key("A minor"); swing(0.54);
prog("A", "Am7 Fmaj7 Dm7 Em7");
bars_per_chord(1);
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4"));
track("keys", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").room(0.25));
drum("snare", "....x.......x...");
form([sec("intro", 8, "drums").filter_in(), sec("drop", 16, "*").impact()]);
mix("keys", #{ level: -2 });

prints as:

// Night Drive — house (seed 1)
// blank("house");   // uncomment to build this song from nothing (as it is, the script edits the song open)
title("Night Drive"); tempo(122); key("A minor"); swing(0.54);
humanize(0.25);
prog("A", "i7 VImaj7 iv7 v7");
bars_per_chord(1);
master(#{ lufs: -10, ceiling: -1 });

// drums: X accent, x hit, o ghost, . rest, | bar line; 16 steps per bar unless a number follows
drum("snare", "main", "....x.......x...");

// pattern tracks (mini-notation, Strudel style)
track("drums", s("bd*4, [~ cp]*2, [~ hh]*4"));
track("keys", chord("prog").struct("x ~ ~ x ~ ~ x ~").s("epiano").room(0.25));

form([
  sec("intro", 8, "drums").filter_in(),
  sec("drop", 16, "*").impact(),
]);

mix("keys", #{ level: -2 });
mix("fx", #{ reverb: 0.25 });

Things to notice:

  • Chord names are printed as the Roman numerals they were stored as.
  • bars_per_chord() and master() always print. Other settings print only when they differ from what the song would have without them: humanize() when it is not 0, a section method when it differs from the kind’s default, a mix() field when it differs from the track’s starting mix.
  • A pattern track’s mix line compares against the pattern’s own settings, so .room(0.25) stays in the code and is not repeated in mix().
  • The drum lane prints every variant, with the variant name, so a step string from the studio’s sequencer reads back exactly. A lane that plays something other than what its name gives (a kit sound, a sample, another drum voice, a variation such as bd:3) also prints a drum_sound() line. A one-shot cut from Apple Loops or your library prints as a comment with its label, such as // shaker: shaker cut from 'Cosmic Harmony Shaker' (Apple Loops): the cut file lives in claudius’s cache, so a path would mean nothing on another computer.
  • A generated part prints its style, preset, register, density and seed, and an arp part its rate.
  • mix("fx", ...) is the transition effects’ mix (crashes and risers), which comes from the genre.
  • The effect chains print last: an fx() line for each track with a chain (and an empty one where the genre or the generator would have given one), a bus() line for each bus with a chain, the master’s chain as master(#{ fx: [...] }), and send_fx() when the sends’ reverb or delay is not the genre’s. A chain of several effects prints an effect a line, and values by section as the sections() that makes them.
  • A track on another bus than its genre gives it prints bus in its mix() line.

How values print

  • Numbers print as the shortest text that reads back as the same value: swing(0.54), density: 0.42195085. Nothing is rounded.
  • Drum steps print at 16 steps per bar when every hit sits on a sixteenth, else 32, else 48 (with the number after the string). A hit prints as X at velocity 0.85 or more, x from 0.5, o below. Reading the string back keeps the exact velocities as long as the string is unchanged, so drum("hat", "main", "x...") on a lane whose hits print that way leaves them alone. A lane whose bars are all the same prints one bar.
  • Seeds print as signed 64-bit integers, so a large seed can print negative (seed: -8861390911444144378); it reads back as the same seed.
  • Closures print with the values they used: .every(2, |x| x.add(7)), even if the script wrote x.add(up).

What is not printed

These are part of the song but not of its script. Running the printed script on the same song keeps them; running it anywhere else does not recreate them.

  • the settings the generator or evolution gave a synthesized drum voice (its tuning, decay and the rest): no drum word plays them, so there is nothing to print. A voice that a drum word plays exactly, such as the variation bd:3, prints as that word;
  • one-shots cut from Apple Loops or your library, which print as a comment naming them;
  • the patch of a generated part beyond its preset name (the generator’s variation and evolution’s tweaks), its voice count and voicing style;
  • Apple Loops layered into the song as loops, the samples a genre built on samples plays (break, sample, sample2, texture), and flipped samples;
  • the transition sounds and settings;
  • the song’s history (the lineage shown in the studio’s log).

The header

The first two lines say what the song is and how it began: // song("house", 9); for a generated song, // blank("house"); for one that began empty. The second line is a comment, so the script edits whatever song is open: running it on its own song changes nothing. With no song open (claudius script without --on), a script starts from a blank house song, so a printed script run on its own needs that line. Uncomment it to start over:

  • A song that began with blank() and was made by scripts is rebuilt exactly, unless it has something from the list above.
  • A generated song is generated again from its seed, and the lines after the header re-apply the edits. song() picks the Apple Loops one-shots again from your library. What was changed after generation and is in the list above (evolution’s tweaks, a flipped sample) is not recreated.

Errors and limits

When a script fails, nothing it did is kept: the song stays as it was before the script ran. This page shows what errors look like, lists the mistakes that do not raise an error, and gives the limits a script runs under.

What an error looks like

claudius script prints the error and exits with status 1:

song("house", 9);
tempo(300);
Error: Runtime error: tempo between 40 and 240 BPM (line 2, position 1)

The line and position point at the call that failed. In a chain, that is the innermost call that raised the error, so a bad pattern string points at s( rather than at track(. The studio and the MCP tools report the same message.

Errors come in four kinds:

begins withmeaningexample
Syntax error:the script is not valid RhaiExpecting ')' to close the arguments list of this function call 'track'
Function not found:no function by that name takes these argument typesFunction not found: octave (Pattern, f64)
Variable not found:a name without quotess(bd) instead of s("bd")
Runtime error:a claudius function refused its argumentsunknown sound 'bdd', no track 'x'

“Function not found” covers typos (trak, gian), a decimal where an integer is needed (octave(4.5), bars_per_chord(1.5)), a missing or extra argument, and a method called on the wrong thing. The last one is common: track("x", s("bd")).gain(0.5) calls .gain() on what track() returns, which is nothing, and fails with Function not found: gain ((), f64). Put the method inside the parentheses.

Errors by function

The messages, as printed after Runtime error:.

functionmessage
song(), blank()unknown genre 'polka' (try: afrobeats, amapiano, ambient, art_rock, big_beat, boom_bap, dance_pop, deep_house, dnb, dub_techno, dubstep, electro_house, filter_house, funk, future_bass, grime, hip_hop, house, idm, jungle, lofi, neo_psychedelia, neo_soul, nu_disco, phonk, reggae, reggaeton, rnb, synthwave, tech_house, techno, trance, trap, trip_hop, uk_drill, uk_garage)
song() optionstempo between 40 and 240 BPM; cannot read key 'H' (try "A minor", "F#m", "Eb", "D dorian"); song() has no option 'tempo' (options: seed bpm key loops short samples)
tempo(), bpm()tempo between 40 and 240 BPM; tempo needs a number
key()cannot read key 'H minor' (try "A minor", "F#m", "Eb", "D dorian")
swing(), humanize()swing needs a number, humanize needs a number
prog()cannot read chord 'Q7' (Roman numerals like i7 VImaj7 bVII, or names like Am7)
drum()no drum lane 'bongo', and drum() makes lanes only for drum names (bd kick sd ...); the song's lanes: none yet. drum_sound("bongo", "tr909:lt") makes a lane of any name with its sound, and track("bongo", s("...")) a pattern track
drum_sound()'lead' is a track of the song that is not a drum lane; 'pad' is not a drum sound (a drum name, a kit sound, or a sample); the track() sound errors below
notes(), clear_notes()notes(): no part 'nope' (parts: ...); notes(): no progression 'Z' (progressions: A B); notes(): note 2 is [start, length, pitch] or [start, length, pitch, velocity]: ...; notes(): 5000 notes in one progression; the limit is 4096
part()no part 'keys' (the song has: ...; house parts: bass chords pad lead arp); a role makes one of your own (...), and track() writes your own notes; part 'lead' is a lead part; remove("lead") first to make it another; part(): a role is bass, chords, pad, keys, lead or arp, not 'drums'; 'kick' is a track of the song that is not a part: give the part another name; a bass part has no style 'funky' (styles: ...); unknown preset 'nope' (synths: ...; or an installed instrument such as piano, rhodes, string_ensemble); part() has no option 'styles' (options: role style preset register density seed rate)
mix(), mute(), solo(), remove() …no track 'nope'; mix() has no option 'volume' (options: level pan reverb room delay duck drive mute solo bus)
master()master() has no option 'loudness' (options: lufs ceiling)
track()track 'x': unknown sound 'bdd' (drums: ...; synths: ...; sampled: ...)
track(), unreadable wordstrack 'x': cannot read 'h3' as a note (...); track 'x': cannot read 'Xyz' as a chord (...); track 'x': n() takes scale degrees (0 1 2 -1 ...), not 'e'
track() with .bank()track 'x': no 'bongo' in bank 'tr909' (installed packs: ...; kits: tr909 tr808 tr707 acoustic uzu synthdrums sonicpi body)
track() without packstrack 'x': no sample packs are installed for bank 'tr909' (install them with: claudius-packs install --defaults); a sampled name: unknown sound 'rhodes' (...; sampled instruments need packs: claudius-packs install --defaults)
track() under --synth-onlytrack 'x': bank 'tr909' plays sample packs, which are off in this session (--synth-only); a sampled name: unknown sound 'rhodes' (...; sampled instruments are off in this session (--synth-only))
track() with a filetrack 'x': /path/vox.wav does not exist; track 'x': /path/vox.wav is outside the folders this claudius may read
track(), dense patternstrack 'x': this pattern is too dense to play: it makes more than 262144 events; track 'x': this pattern is too dense to play: it needs more than 4000000 steps of work; track 'x' plays 2048 notes per bar; the limit is 1024
form()form() takes sec(...) items; section 'drop' uses 'snare', which is not a track (tracks: ...); section 'drop' plays progression 'C', which the song does not have (progressions: A B; prog() adds one)
sec()unknown section kind 'party' (intro verse build drop break hook groove outro bridge); layers are a string ("kick hats") or an array of names
.energy()energy needs a number
section()no section 'nope'; no section 12; section() takes a name or an index; the two form() checks; section() has no option 'bar' (options: ...)
layer()no section 'nope'; layer() takes a section name or index; no track 'leed' (tracks: ...)
stack(), cat()stack() takes patterns; stack() needs at least one pattern
.fast(), .slow(), .ply()fast takes a number above 0 and up to 256, not 1000; fast needs a number; ply takes a whole number from 1 to 256, not 1.5
.late(), .early(), .off() …late needs a number
.gain(), .struct() …expected a number, a pattern string or a pattern
.scale()unknown scale 'Q:minor' (try "A:minor", "C:major", "D:dorian", "E:minor:pentatonic")
.arp()unknown arp 'sideways' ("up", "down" or "updown")
mini-notationsee Mini-notation errors
the whole songthe song is 768 bars long; the limit is 512; the song is 36 minutes long; the limit is 20; the song has 70 tracks; the limit is 64 (checked when the script ends, and printed as Error: the song is ..., without Runtime error: or a line number)

Errors about the words of a pattern (cannot read ... as a note) are raised by track(), when the pattern is first played, so they point at the track( line.

Silent mistakes

These run without an error and do something you may not expect.

you writewhat happens
key("D minor") after prog("A", "Am F C G")the progression moves to D minor (prog() stored numerals)
a chord() pattern with chord names, no matching prog()the critic checks the melody and bass against progression A, which on a blank() song is the tonic chord alone
note(...).s("pad"), chord(...).s("pad") with no .role()mixed and judged as a lead or chords, not a pad (see Roles)
<a b c@3>weights inside < > are ignored: each item still takes one cycle; write <a b c!3> (see Alternation)
.every(4, |x| x.s("piano"))track settings inside a closure are ignored
s("bd").s("piano").s() on a sound pattern is ignored
.bank("apple") without GarageBand or Logic contentthe synthesized drums play
sec("drop", 8).variant("alt") on a lane without altthe lane plays main

Limits

A script runs under these limits, so a mistake cannot hang claudius or fill its memory:

limitvalueerror
running time10 secondsthe script ran for more than 10 seconds
operations5,000,000Too many operations
function call depth64Stack overflow
expression nesting128 (64 inside functions)Syntax error: Expression exceeds maximum complexity
string length200,000 charactersLength of string too large
array length10,000 itemsSize of array/BLOB too large
speed*, /, fast(), slow() and ply() above 0 and up to 256'*' takes a number above 0 and up to 256, not 1000
events per pattern query262,144this pattern is too dense to play: it makes more than 262144 events
work per pattern query4,000,000 stepsthis pattern is too dense to play: it needs more than 4000000 steps of work
notes per bar, per track1,024 (averaged over 64 bars)track 'x' plays N notes per bar; the limit is 1024
song length512 bars and 20 minutesthe song is N bars long; the limit is 512
tracks64, and 12,000 track-seconds (20 tracks of 10 minutes, 40 of 5)the song has N tracks; the limit is 64
a pattern string4096 characters, brackets 64 deep, 1024 steps per sequence, ! 256 times, 256 euclid slotssee Mini-notation errors
modules and evalnot availableModule not found, reserved keyword 'eval' is disabled

A script reads no files except the audio files named in .s(), and writes none. When claudius is shared beyond your computer, .s() reads only inside claudius’s own folders (see Your own files).

What the language does not do

  • Time: every bar has four beats; there are no other time signatures, no tempo changes within a song, and no key changes within a song.
  • Automation: there is no general automation lane. Filter sweeps come from section flags (build, filter_in, the final outro), and level changes come from layers and energy.
  • Sound design: scripts choose presets and instruments and add simple inserts; they do not edit synth patches or drum voices (see Sounds).
  • Arrangement edits per bar: a track plays the same pattern in every section it is in, from the section’s start. For a variation in one section, make a second track and put it in that section only.

Quick reference

Everything on one page. Each name links to its full entry.

Starting

song("house", 7)a generated song; options #{ seed, bpm, key, short, loops, samples }
blank("house")an empty song: one 8-bar section, no tracks, progression A = the tonic chord, the genre’s mix
(neither)edit the open song, or a blank house song when none is open

Song edits

title("Night Drive")
tempo(124), bpm(124)40..240
key("A minor")"F#m", "Eb", "D dorian", "E harmonic minor"
swing(0.56)0.5 straight .. 0.8; sixteenth-note swing
humanize(0.3)0..1
prog("A", "i7 VImaj7 iv7 v7")numerals, chord names, slash chords; sections play A, breaks B (or A)
bars_per_chord(2)bars each chord lasts, 1..8
drum("kick", "X...x...")X 1.0, x 0.8, o 0.45, 1-9, . rest; drum(lane, variant, steps, per_bar)
trig("hat", 14, #{ ratchet: 3, cond: "1:2" })a step’s chance, condition, ratchet, flam, nudge and locks (pitch, decay, tone, pan)
lane("hat", #{ length: 12, groove: "dilla" })a lane’s own length (a polymeter), speed, swing and groove
groove("funk", "loops/funk.wav")a groove heard in a recording’s drums (or written as a table), for lanes to play in
drums_from("beat.wav", #{ bars: 2 })a beat in a recording, played or beatboxed, into the kick, snare and hat lanes
drum_sound("kick", "tr909:bd")a drum name, a kit sound (or a name and a bank), a file
part("bass", #{ ... })role style preset register density seed rate; adds the genre’s part when the song has none, and with role one of your own
notes("lead", "A", [[0, 0.5, 69], ...]), clear_notes("lead", "A")a part’s notes over a progression written out, [start, length, pitch, velocity] in beats; cleared, the theory engine’s again
track("hats", pattern)a pattern track; new ones join sections with energy ≥ 0.6
rack("bass", [#{ sound: "sub_bass", band: [0, 100] }, ...])several sounds playing a track at once, each in its band, with its level, duck and effects
mix("pad", #{ ... })level −40..12, pan −1..1, reverb/room, delay, duck 0..1, mute, solo
master(#{ lufs: -9, ceiling: -1 })−24..−5 LUFS, −3..−0.1 dBTP
mute() unmute() solo() unsolo() remove()by track name

Form

form([sec(...), ...])the whole form; repeated names become drop2, drop3
sec(kind, bars, layers)kinds intro verse build drop break hook groove outro bridge; layers "kick hat", [...], "*"
.name() .energy() .prog() .variant()
.build() .gap() .impact() .fills() .filter_in()each also takes true / false; .build("roll+riser") stacks styles, .build_bars(4) builds over the last 4 bars, .gap(2) holds 2 beats
section("drop", #{ ... })bars energy prog variant name layers build gap impact fills filter_in; by name or 0-based index
layer("break", "lead", true)one track on or off in one section

Patterns

constructorvalues
s("bd sd"), sound()sound names
note("c3 e3 g3")note names (octave 3 by default) or MIDI numbers
n("0 2 4")scale degrees (.scale(), else the song’s key)
chord("<Am7 F/A>")chord symbols, slash chords, numerals, prog, prog:B
seq("1 0 1 1")plain values
stack([...]), cat([...]), silence()together / one per bar / nothing

Mini-notation

a b csequence over one bar
~, -rest
[a b], {a b}group in one step
a, btogether
<a b c>one per bar
a | brandom pick per bar
a*2, a/2faster, slower; above 0, up to 256
a@3, a _ _weight
a!3, a !repeat
a?, a?0.3drop at random
a(3,8), a(3,8,2)euclidean
bd:3, tr808:sd:2variation: a number after the last colon
F/A, V7/Va slash before a letter stays in the word

Pattern methods

.fast(2) .slow(2)speed; above 0, up to 256
.late(0.25) .early(0.125)shift (cycles = bars)
.rev() .ply(2)reverse each bar, repeat each event (1 to 256 times)
.every(4, f) .lastOf(4, f)first / last bar of every n, from the section start
.sometimes(f) .often(f) .rarely(f) .almostNever(f) .almostAlways(f) .sometimesBy(p, f)per event, seeded
.off(0.125, f) .superimpose(f)shifted copy, copy on top
.degrade() .degradeBy(0.3)drop events, seeded
.struct("x ~ x x") .mask("1 0 1 1")rhythm from another pattern
.euclid(3, 8) .euclidRot(3, 8, 2)euclidean rhythm
.gain() .velocity() .legato()per event; numbers or patterns
.add(2) .transpose(12)add to the value (degrees on n()) / semitones always
.n("0 1 2")variation, on sound patterns

Track settings

.s(name), .sound(name)instrument for note / degree / chord patterns
.bank("tr909")tr909 tr808 tr707 acoustic uzu synthdrums sonicpi body apple
.scale("A:minor")also dorian phrygian lydian mixolydian harmonic_minor minor_pentatonic pentatonic blues chromatic
.octave(4)octave of degree 0 and of note names without one
.voicing(), .voicing(48, 72)chord range, default 52..74
.arp("up")up down updown
.root()a chord pattern’s roots (or slash basses), octave 2
.role("pad")mixing role
.level(-3) .pan(-0.4) .room(0.3) .delay(0.2) .duck(0.5)mix
.lpf(1200) .hpf(200) .crush(8) .distort(6)inserts

Sounds

drumsbd sd cp hh oh rd cr lt mt ht rim sh cb snap perc (and kick snare clap hat ohat ride crash tom rs shaker cowbell ch)
synthssub_bass 808 reese acid saw_bass pluck_bass organ_bass wobble log_drum pluck supersaw pad warm_pad stab epiano keys bell organ strings square_lead chip fm_bass rubber_bass moog_bass dist_bass deep_bass saw_lead pwm_lead whistle soft_lead glide_lead brass_lead fm_lead vox_lead solina glass_pad pwm_pad air_pad vowel_pad swell_pad tine_piano clav house_piano brass_stab rock_organ fm_marimba fm_kalimba harp_pluck mallet cowbell_lead
sampledpiano upright rhodes wurlitzer hammond string_ensemble violins cellos pizzicato brass trumpet flute harp marimba vibes kalimba upright_bass bass guitar choir sax bongo conga ...
exactvsco2:violins, tr808:sd, in .s() or in s() patterns
files.s("/path/sound.wav"): c4 plays it as recorded

Roles and targets (LUFS while playing)

kick −12.5 · snare −13.5 · clap −14.5 · hat −17.5 · ohat −18.5 · perc −19.5 · shaker −21.5 · ride −20.5 · tom −18 · crash −20 · bass −14.5 · keys −17 · chords −18 · lead −18 · arp −20.5 · pad −21.5 · vocal −15 · anything else −19.

Command line

claudius is one program with a subcommand per task. claudius --help lists them and claudius <command> --help shows the flags of one. The sample packs have a second program, claudius-packs, described in Sample packs.

Every command that fails prints Error: and the reason on stderr and exits with status 1.

Make a song

claudius make

Composes, arranges, mixes, masters and judges a new song, and writes it into a folder.

claudius make --genre deep_house --seed 7 --short
ears loaded in 3.4 s
Glass Garden — deep_house at 118 BPM in D minor, 64 bars (2:10)
  progression A: i7 iv7 v7 i7
  progression B: iv9 v7 i7 VImaj7
  form: intro 4 | groove 8 | break 8 | build 4 | drop 16 | drop2 16 | outro 8
  tracks: kick (synth kick), clap (sampled cp (tr707:cp)), hat (hat cut from 'Silver Hi-Hat 04' (Apple Loops)), shaker (shaker cut from 'Ride With Me Shaker' (Apple Loops)), perc (perc cut from 'Latin Day Bongo 05' (Apple Loops)), bass (synth patch 'pluck_bass'), chords (synth patch 'keys'), pad (sampled violins (vsco2:violins)), lead (sampled pianet (epianos:pianet)), crash (crash cut from 'Beautiful Memories Percussion 02' (Apple Loops)), riser (synth riser)
  master: -11.1 LUFS, true peak -1.1 dBTP (pre-master -9.5 LUFS); done in 6.5 s
  ears: 'house music' z +3.7 (closest confusion 'techno music' +3.7); production z +1.6 vs 'a low quality recording with hiss' +1.0; p_real 0.69
        sounds like: house music, tech house music, techno music, drum and bass music
  verdict: 88/100 (arc 0.90, genre 0.77, mix 0.95, production 0.66, theory 1.00). Fix first: dull 4-8 kHz: hats, claps and snare lack bite (presence -27.9 dB, healthy from -26); not enough sub: the kick and bass lack weight (sub -14.3 dB, healthy from -14)
  wrote out/deep_house-glass-garden-7/song.mp3

The result depends on what is installed: the same genre and seed give the same song on any machine with the same packs and Apple Loops, and a different one, in its sounds and possibly its drum patterns, on a machine without them.

flagdefaultwhat it does
-g, --genrehousea genre from claudius genres
-s, --seedthe clockthe same genre, seed and options give the same song
--bpmfrom the genre’s rangetempo
--keyfrom the genre"Am", "F# minor", "Eb", "D dorian"
--shortoffhalves every section (at least 4 bars), for a quick sketch
--stemsoffalso writes every track to stems/<track>.wav (32-bit float)
--samples0.75the chance that a drum lane uses a one-shot cut from Apple Loops or your library instead of a synthesized voice
--synth-onlyoffsynthesizes every sound: no sample packs, Apple Loops or user library
--no-libraryoffleaves out Apple Loops and your user library; the sample packs, and the samples a song built on samples gathered, still play
--offlineoffdownloads no samples: a song built on samples plays what was gathered before, or the layers it plays without them
--sample <file>noneflips a recording into the song, warped to its tempo and key; repeatable
--loopsoffbuilds the song around a family of Apple Loops (their chords, bass and beat), GarageBand style
--sampledas the genre isbuilds it on samples from free libraries, as the genre’s producers sample: a phrase it takes its key, tempo and chords from, a break, a texture (Songs built on samples); trip-hop, boom bap, lo-fi, jungle, big beat and filter house are by default
--unsampledoffmakes it of the genre’s own sounds, without samples from free libraries
--sample-search <words>nonesearches the libraries for its phrase with your words, a kind of record ("70s soul", "bossa nova guitar"); implies --sampled
--complexity <0..1>the genre’s ownhow layered it is: 0 the genre’s core, 0.5 the genre as written, 1 its harmony and lead doubled on second instruments, a counter-melody, a pad, more percussion, samples on samples
--no-earsoffjudges with meters and theory only, without loading earshot’s models
--refs <path>nonereference tracks or folders; with two or more, the verdict scores how typical the song is of them
--tagsoffalso runs the AudioSet tagger and prints its labels as held-out evidence
-o, --outoutthe folder the song folder goes into, relative to where you run the command

A seed from the clock is a number below one million, printed in the folder name, so you can make the same song again.

The song folder is <out>/<genre>-<title>-<seed>, for example out/deep_house-glass-garden-7, and holds:

filewhat it is
song.wavthe master, 48 kHz, 24-bit
song.mp3a 256 kbps copy; claudius export writes other formats
blueprint.jsonthe song’s genome: open it, edit it, render it again
song.rhaithe song as a script, for claudius script or the studio’s script editor
project.jsonthe arranged session the blueprint expanded into
report.jsontempo, key, form, loudness and every track’s level and gain
verdict.jsonthe critic’s scores, measures and issues
credits.txtattributions, when the song plays sample-pack instruments
stems/with --stems

Files and settings compares this with the folders claudius script and the studio write.

claudius script

Runs a script and renders the song it makes or edits.

claudius script song.rhai                       # a script that starts its own song
claudius script edit.rhai --on out/house-glass-haze-9
echo 'tempo(120); mute("lead");' | claudius script - --on out/house-glass-haze-9 --print
flagdefaultwhat it does
<file>the script, or - to read it from stdin
--on <path>noneedits this song (a blueprint.json or a song folder) instead of starting with none
--printoffprints the resulting song as a script and renders nothing
--no-ears, --refs, --tagsas for make
-o, --outoutwhere the song folder goes

The folder has the same files as make writes. The script’s log goes to stderr: the song it started, the sounds each track resolved to (track hats: hh), and anything it printed with print() or debug(). A script that ends without a song fails:

Error: the script made no song (start it with song("house") or blank("house"))

Script errors come back with the line and position; Errors and limits lists them.

Error: Runtime error: tempo between 40 and 240 BPM (line 1, position 1)

claudius render

Renders a blueprint.json again, for example after you edited it by hand.

flagdefaultwhat it does
<blueprint>the blueprint file
--stemsoffstems too
--no-ears, --refs, --tagsas for make
-o, --outthe blueprint’s folderwhere to write; without it the song files next to the blueprint are replaced

claudius mutate

Writes variations of a blueprint, each rendered in full, with what changed.

claudius mutate out/house-glass-haze-9/blueprint.json -n 4

Each variation goes into <blueprint folder>/mutations/<n>/ (or -o), and one line per variation reports the change and its verdict: 1: <what changed> -> <score> (<folder>). Unlike mutation in the studio, these mutations are not steered by the critic’s issues.

flagdefaultwhat it does
<blueprint>the blueprint to vary
-n4how many variations
-s, --seedthe clockthe random choices
--no-ears, --refs, --tagsas for make
-o, --out<blueprint folder>/mutationswhere they go

claudius change-genre

Writes the song in another genre, rendered and judged: its form, chords and key, the recordings it plays, the notes written on its parts, its lead’s melody and its pattern tracks kept, the genre’s drums, bass, parts, sounds, swing and mix playing it (Changing the genre).

claudius change-genre out/house-glass-haze-9/blueprint.json --genre lofi

It says what it kept, then -> <score> (<folder>), as make does.

flagdefaultwhat it does
<blueprint>the song to play in another genre
-g, --genrethe genre, or any number fused (trip_hop+idm, trip_hop+neo_soul+idm)
-s, --seedthe clockanother take of it in that genre
--no-ears, --refs, --tagsas for make
-o, --outbeside the song’s folder, named after it and the genrewhere it goes

claudius evolve

Runs an evolutionary search: mutation and crossover over generations, each candidate judged on a preview of its build-up and first drop. Evolution and analysis explains the search.

claudius evolve --genre techno --seed 4 --start 2 --generations 2 --children 3 --preview-bars 16 --keep 0 --no-ears
evolving techno (2 start, 2 generations x 3 children, 16-bar previews, without ears)
  g0-0  90.5  Velvet Orbit
  g0-1  97.1  Hollow Harbor
  g1-0  97.1  from g0-1: tempo 128 -> 126 BPM
  g1-1  90.4  from g0-0: mix: bass -1.3 dB (now -1.3); form: outro now 12 bars
  g1-2  90.5  from g0-0: ride: synth voice parameter 0 -> 0.931
generation 1: best 97.1
  g2-0  97.1  from g0-1: form: peak drums main -> sparse; tempo 128 -> 130 BPM
  g2-1  97.1  from g0-1: form: groove drums main -> sparse; drums (main): nudged a hat hit by +0.25 beats
  g2-2  91.4  from g1-0: crossover: drums and form of one parent, harmony and parts of the other; form: break drums main -> sparse; form: build loses gap
generation 2: best 97.1
searched 8 candidates in 7 s; rendering the best 0 in full

A child that beats the best parent so far is marked with +. Every candidate goes into <out>/evolve-<genre>-<seed>/evolution.json (id, generation, parent, change, score, summary), and the best --keep are rendered in full into numbered folders next to it, with their history printed.

flagdefaultwhat it does
-g, --genrehousethe genre
--from <blueprint>nonestarts from this song instead of fresh ones
-s, --seedthe clockthe fresh songs use seeds seed, seed + 1, …; the search uses it too
--start4how many fresh songs start the search
--generations5generations
--population4parents kept per generation
--children8children per generation
--preview-bars32bars auditioned per candidate
--keep3best songs rendered in full at the end
--samples, --synth-only, --no-library, --loopsas for make
--no-ears, --refs, --tagsas for make
-o, --outoutwhere the run folder goes

claudius remake

Analyses an audio file and reworks it in a genre, so that it stays the song it is: all of it plays through, its voice and its chords as they are, without its drums and its bass (taken apart from the rest with earshot’s models; without them, its low end), in its own sections and on its chords, with the genre’s drums, bass and mix under it (Remaking a song from audio). With --flip it makes a new song of the genre on the recording’s sound instead: its hook without its drums in the hooks, another passage of it in the other sections, its drums as the break where the genre plays one, a flip of it cut from all over it, and its sung phrases. With --rebuild it makes the song itself again on claudius’s sounds, every note of it editable: its drums, its bass and the rest as the hits and notes it plays (heard with earshot’s models), in its own sections and on its chords, its voice kept on a track of its own. The recording, its pieces or its voice, go into takes/ in --out. It prints the analysis (as analyze does) and the new song.

flagdefaultwhat it does
<file>any audio file claudius can decode
-g, --genrehousethe genre of the new song. A rework plays at the recording’s own tempo, or double or half it when that is nearer the genre’s range (half only where the recording holds its chords two bars); --bpm stretches it. A flip plays it at its own tempo when the genre does, else at a multiple of it, faster or slower by whole semitones as a sampler plays a record, or chopped onto the song’s grid at two thirds to three halves of it
-s, --seedthe clockthe new song’s own choices
--bpmas abovethe new song’s tempo
--flipoffa new song of the genre on the recording’s hook and pieces of it, rather than a rework of all of it
--rebuildoffthe song itself, every part of it played on claudius’s sounds: its drums struck as it strikes them, its bass and the rest as the notes the ears hear them play, its voice kept on a track of its own and its melody written out (Rebuild it)
--skeletonoffa new song on the recording’s skeleton only (tempo, key, swing, form, progressions, drum habits, bass style), none of its sound; a skeleton remake out of the genre’s range plays at half or double the tempo when that falls in it, else at its nearest end
--no-ears, --refs, --tagsas for make
-o, --outoutthe folder is remake-<genre>-<title>-<seed>

Listen and judge

claudius export

Writes a song’s master in other formats: WAV, AIFF, FLAC, Apple Lossless, MP3, AAC, Opus and Ogg Vorbis. Exporting has every format and what each is for. -f project writes a song folder as a project file instead, a .claudius to open in claudius anywhere: the song, the recordings it plays, and its release (the release.json and the cover) when it has one. It needs no render. Apple loops and a pack’s sounds stay out of it, as their licences ask, and claudius says so: a computer that has them plays them.

claudius export out/deep_house-liquid-avenue-21 -f mp3,flac,wav:16
claudius export ~/Music/mix.wav -f opus:96 -o ~/Desktop/mix.opus
claudius export ~/Music/claudius/house-glass-garden-12 -f project -o ~/Desktop
flagdefaultwhat it does
<song>a song folder (its song.wav) or any audio file
-f, --formatformat[:quality][@rate], repeated or comma-separated: mp3, mp3:v0, wav:16, flac, aac, opus:96; or project
-o, --outthe song’s folderthe file to write for one format, or the folder for several
--title, --artist, --albumthe song’s titlethe tags the files carry; the files are named after the title
--listlists the formats, and any this machine cannot write

claudius publish

Checks a rendered song as stores and distributors check a release (its artwork, its audio, the licences of its sounds and its details), and writes a release kit: the WAVs and the cover a distributor takes, and release.txt with every answer its form asks for. What you give is kept in the song’s release.json. Publishing has the checks and the kit.

claudius publish out/lofi-hollow-harbor-5 --artwork cover.jpg --artist "Ana Lima" --writer "Ana Lima" --made written
claudius publish out/lofi-hollow-harbor-5 --check --json
flagdefaultwhat it does
<song>a rendered song’s folder
--artworkthe cover: a square JPEG or PNG, 3000 × 3000
--artist, --title, --version, --featuring, --albumthe song’s titlethe release’s names; --featuring repeats
--genre, --subgenrethe song’s genre as stores list it
--date, --label, --ownerthe label and owner are the artistthe release date (YYYY-MM-DD), the record label, and who the ℗ and © lines name
--writer, --producersongwriters by full legal name, and producers; each repeats
--isrc, --upcassigned by the distributorthe codes, if you have them
--explicitnothe lyrics are explicit
--madewritten, assisted or generated: how the song was made, which distributors ask
--checkcheck, and write no kit
-o, --outrelease/ in the song’s folderthe kit’s folder
--jsonprints the checks as JSON

It fails while a check finds a problem, so a script can tell.

claudius thumbnail

Writes a project file’s cover as a PNG, at most SIZE pixels on a side (256 when not given), for a file manager to show the file by. The cover is the one you gave in Publish, which a project file carries. The .deb and the .rpm install a thumbnailer (/usr/share/thumbnailers/claudius.thumbnailer) that runs it, so GNOME’s Files, KDE’s Dolphin and the other file managers that read thumbnailers show a project by its cover. A project without a cover writes nothing and fails, and the file manager shows the usual icon.

claudius thumbnail "Glass Garden.claudius" cover.png 512
argumentdefaultwhat it is
<project>the project file, as a path or a file:// address
<out>the PNG to write
[size]256its largest side, in pixels

claudius judge

Gives the critic’s verdict on any audio file. When the file has a project.json next to it (as make writes), the arrangement and theory checks run too; without one, only the meters on the master and the ears do.

claudius judge out/deep_house-glass-garden-7/song.wav --no-ears
out/deep_house-glass-garden-7/song.wav: 95/100 (arc 0.94, mix 0.93, theory 1.00). Fix first: dull 4-8 kHz: hats, claps and snare lack bite (presence -28.6 dB, healthy from -26); fizzy top end (air -16.2 dB, healthy up to -17)
  arc_correlation: 0.89
  band_air_db: -16.2
  band_low_db: -2.6
  band_lowmid_db: -5.5
  band_mid_db: -12.2
  band_presence_db: -28.6
  band_sub_db: -11.4
  bass_roots_on_changes: 1
  drop_minus_break_lu: 3.5
  lead_chord_tones_on_strong_beats: 1
  lead_in_key: 1
  lead_range_semitones: 12
  lead_stepwise: 0.63
  length_s: 106
  low_end_correlation: 1
  lra_lu: 3.73
  lufs: -10.98
  stereo_correlation: 0.86
  true_peak_db: -1.05
  voice_leading_chords: 1
  voice_leading_pad: 1.1
  - [0.44] dull 4-8 kHz: hats, claps and snare lack bite (presence -28.6 dB, healthy from -26) (band:presence-)
  - [0.13] fizzy top end (air -16.2 dB, healthy up to -17) (band:air+)
flagdefaultwhat it does
<file>the audio file
-g, --genrethe project’s, or nonethe genre the ears compare against; without one they report the closest genre in earshot’s vocabulary
--no-ears, --refs, --tagsas for make
--jsonoffprints the whole verdict as JSON

The critic and the ears explains every measure and score.

claudius analyze

Reads a song the way a producer does before remaking it.

claudius analyze out/deep_house-glass-garden-7/song.wav --genre deep_house
118.0 BPM (pulse clarity 0.48), D minor (confidence 0.81), swing 0.54, 64 bars from 1.52 s
  progression A: i VImaj7 v i7  |  B: v7 i7  (1 bar(s) per chord)
  bars 1-4  intro (A)  energy 0.73, kick hats
  bars 5-12  drop (B)  energy 0.95, kick bass hats
  bars 13-19  break (C)  energy 0.30, hats
  bars 20-23  break (D)  energy 0.45, hats
  bars 24-56  drop (E)  energy 1.00, kick bass hats
  bars 57-64  drop (B)  energy 0.83, kick bass hats
  kick  X..-X.-xX.--X..-
  snare X.x.x.xxX.x-x.x.
  hats  XxXXx.XXXxX-xxXX
  bass style: syncopated

This is claudius reading its own D minor song, whose sections are an intro of 4 bars, a groove of 8, a break of 8, a build of 4, two drops of 16 and an outro of 8, on i7 iv7 v7 i7 (iv9 v7 i7 VImaj7 in the break and the build). The tempo, the key and the swing are right. It hears each section where it starts, but three beats late, as it took the song’s fourth beat for its first (its bars start at 1.52 s), and the two drops, the same music twice, as one of 33 bars. It names the groove and the outro drops (each the music of one, and nearly as loud) and the quiet build a second break; the outro plays the groove’s music, and both have its letter. Progression A has two of the song’s chords where they are (i and v), and B the break’s middle two. A section’s line says what it is, the letter of the music it plays (sections with one letter play the same), its energy, how much of it is sung, how many of its last bars build into the next and what plays in it; a song with a voice adds the phrases sung, to the beat (27.2-31.4, bar 27’s second beat to bar 31’s fourth). Analysis of full mixes is approximate; the engineering page says where it goes wrong. In the step grids, X is a hit in almost every bar, x a common one, . a rare one and - none.

flagdefaultwhat it does
<file>the audio file
-g, --genrenonea genre whose tempo range guides the beat tracker (else 70 to 180 BPM, centred on 120)
--jsonoffthe whole analysis as JSON, including the chord of every bar

claudius voice

Hears how a recording of one voice is sung: the notes it means, how near each came, and the singer (see Your voice).

claudius voice vocal.wav --key "A minor" --notes
flagdefaultwhat it does
<file>the audio file
-k, --keynonethe key it is sung in, which settles doubtful notes (else any note is as likely as another)
--notesoffevery note too: where it starts, the note meant, how far off it was sung, how long, how sure
--jsonoffthe whole assessment as JSON, the singer and every note

claudius tune

Tunes a recording of one voice to the notes it means and writes the tuned recording (see Your voice).

claudius tune vocal.wav --key "A minor" --speed 20
flagdefaultwhat it does
<file>the audio file
-o, --out<file>-tuned.wav beside itwhere to write it
-k, --keynonethe key it is sung in (else any note)
--notesnoneonly these notes, in any octave: "C D E G A"
--strength1how much of the way to the notes, 0 to 1
--speed40how fast a note is brought onto its pitch after it starts, ms; 0 at once
--humanize10the cents of the singer’s own wandering around a note that stay
--vibrato1how much of the vibrato stays, 0 to 1

Make material

claudius chop

Cuts a recording into material: one bar loop per section it finds and a kick, clap and hat one-shot, saved as WAV files and added to the user library, where make and scripts find them.

claudius chop out/deep_house-glass-garden-7/song.wav --bars 2
chopped 3 loops and 3 one-shots (added to the user library):
  out/chops/song/01-intro-2bars.wav (118 BPM, 8 beats, key A#)
  out/chops/song/02-break-2bars.wav (118 BPM, 8 beats, key A#)
  out/chops/song/03-drop-2bars.wav (118 BPM, 8 beats, key A#)
  kick: out/chops/song/kick.wav
  clap: out/chops/song/clap.wav
  hat: out/chops/song/hat.wav

The analysis is printed first, as analyze prints it.

flagdefaultwhat it does
<file>the recording
--bars2bars per loop
-g, --genrenonea tempo range for the beat tracker
--find <description>nonealso cuts out the moments that best match a description (“a vocal chop”, “a snare hit”); repeatable; needs earshot’s models
--top3cuts per --find
-o, --outout/chopsthe files go into <out>/<file name>/

Apple Loops and your own samples shows how to use the chops.

claudius sample

Samples a recording’s vocals into a song: its best sung phrases, cut on the bars it plays from its vocals apart (with earshot’s models; else cleaned of its drums), fitted to the song’s tempo and key, placed where they agree with its chords and mixed as vocals (Sampling a song’s vocals). The song is written to a new folder, with the phrases in its takes/, and rendered and judged.

claudius sample ~/Music/a-cappella.wav --on out/deep_house-velvet-orbit-4 --count 2
flagdefaultwhat it does
<file>the recording
--onthe song: a blueprint.json or a song folder
--count2how many phrases, 1 to 4
--bars1 or 2how long each phrase is, in bars: 1, 2 or 4
--find <description>“a person singing”what earshot’s models listen for
--in <section>the sections that suit each phrasea section to put them in, by name or kind; repeatable
--every <how often>as the song suitshow often each phrase comes round: once (from the start of each section), 2, 4, 8 or 16 (once every so many bars) or through (how the song decides)
--no-earsfind the phrases by pitch and stereo picture alone
-o, --outoutthe song goes into <out>/<genre>-<title>-<seed>/

claudius samples

Finds sounds in free online libraries and downloads them, keeping only what their licences let you publish music made with (Samples from free online libraries).

claudius samples search "drum break" --limit 4
claudius samples get freesound:629052
claudius samples list
freesound:51247  "Silly Drum Break 1.wav" by RutgerMuller, CC0 1.0, 3 s
commons:Bauchamp - 130 old drum break.ogg  "Bauchamp - 130 old drum break" by Bauchamp, CC0
ccmixter:37792  "Drops of H2O ( The Filtered Water Treatment )" by J.Lang, CC BY 3.0, 315 s
freesound:629052  "Crunchy Drum Break 2 [128bpm]" by deadrobotmusic, CC0 1.0, 15 s
`claudius samples get <id>` downloads one

get prints where the sound went and the credit a song that plays it gives.

subcommand and flagdefaultwhat it does
search <description>asks the libraries
search --source <library>allopenverse, commons or ccmixter; repeatable
search --limit12how many sounds at most
search --jsonprints the results as JSON
get <id>downloads a sound a search found, with its credit beside it
listlists the downloaded sounds and their credits
gather <genre>gathers what the genre’s songs built on samples play, until it has as many as it keeps: searches, downloads, cuts, and with the ears keeps the best
gather <genre> --search <words>gathers phrases for your words instead, for the songs that ask for them
--us-public-domainsearch and get also keep recordings in the public domain by age
--share-alikesearch and get also keep CC BY-SA sounds

claudius sounds

Renders every built-in synthesized sound to WAV files, so you can hear them: the 13 drum voices in drums/, the 20 synth presets playing a phrase in synth/, and five transition effects in fx/.

flagdefaultwhat it does
-o, --outout/soundswhere they go

Information

commandprints
claudius genresevery genre by family, with its tempo range and description, including your own genre files (under “your own” when they name no family)
claudius genres WORDSthe genres that answer a search, best first: a name or another name, an era, a scene, an artist or a sound (claudius genres west coast, claudius genres 90s)
claudius examplesthe example songs by decade, then the classics remade, the songs built of layered sounds and the studies of famous records: each one’s name, title, style and the artists the style is heard on (of a classic, the piece; of a study, the record)
claudius examples NAMEthat example’s script, with the notes on how its style is made: claudius examples flashbulb > flashbulb.rhai, then claudius script flashbulb.rhai renders it
claudius referencethe script language reference, the same text /api/reference and the MCP tool script_reference return
claudius --versionthe version
$ claudius genres
afro and latin
  afrobeats        100-115 BPM  Afrobeats: 100 to 115 BPM, a rolling West African groove ...
...
hip hop
  alt_hip_hop       76-98  BPM  Alternative hip hop: 76 to 98 BPM, lush ninth and eleventh chords ...
  boom_bap          86-96  BPM  Boom bap: 90s hip hop at 86 to 96 BPM, built on samples: ...
...
$ claudius genres golden age
boom_bap          86-96  BPM  Boom bap: 90s hip hop at 86 to 96 BPM, built on samples: ...

Run the studio and the server

These three commands run a session: one song with undo, renders and verdicts, which the studio window, browsers, assistants and the HTTP API share. They take the same session flags:

flagdefaultwhat it does
--port7878 (CLAUDIUS_PORT)the port the HTTP server listens on
--no-earsoffno earshot models; verdicts use meters and theory
--synth-onlyoffsynthesizes every sound: no sample packs, Apple Loops or user library
--no-libraryoffno Apple Loops or user library; the sample packs, and the samples a genre built on them gathered, still play
--offlineoffgathers no samples: a song built on samples plays what was gathered before, or what stands in for it
--no-auto-renderoffrenders only when asked, instead of after every change
--web <dir>found automatically (CLAUDIUS_WEB)the built web studio; see Files and settings

claudius studio

Opens the studio window. It first asks http://127.0.0.1:<port> what answers there:

  • a claudius: the window opens on that session, says a claudius is already running on port 7878: opening the studio on it, and ignores the session flags;
  • a claudius older than this one, such as one an assistant set up with an earlier version starts: the window runs beside it, since this version’s studio would drive it wrong. It says the claudius on port 7878 is 0.2.0, older than this one (an assistant set up before this version may have started it): the studio runs beside it, opens on a claudius as new as itself on one of the twenty ports after it if there is one, or else starts a session on the first free one of them, and shows a banner that says how to connect the assistant again;
  • a claudius that asks for a token: it stops, since the window cannot send one, and says to open http://127.0.0.1:<port>/?token=<token> in a browser or to start another studio with --port;
  • nothing: it starts a session and an HTTP server on 127.0.0.1 and --port (which also serves the web studio and MCP), then opens the window on it. A port taken by another program stops it with port 7878 is taken, by another claudius or another program (--port picks another).

claudius studio FILE opens a song in the window once it is open, as Open would: a project (a .claudius file, or the .zip an earlier demo saved), a blueprint.json or a .rhai script. A project double-clicked on Windows or on Linux starts the studio so; on a Mac the system hands the file to the app, starting it first if it is not running.

A claudius built without the studio feature prints the address to open in a browser and keeps serving.

claudius serve

Runs the session and the HTTP server without a window: the web studio at /, the HTTP API under /api, and MCP at /mcp.

$ claudius serve
claudius at http://127.0.0.1:7878: web UI at /, API at /api, MCP at /mcp

It prints the address once the port is bound; a taken port stops it with port 7878 is taken, by another claudius or another program (--port picks another).

flagdefaultwhat it does
--host127.0.0.1the address to listen on; 0.0.0.0 listens on every interface. Any address but loopback requires a token and limits file access, as --public does
--publicoffanswers requests addressed to any host name (a tunnel, your LAN), requires a token (one is made when --token is not given), and limits file access to claudius’ own folders
--token <secret>none (CLAUDIUS_TOKEN)requires this token on every request; a blank one counts as none
--files <dir>nonea folder commands and scripts may read and write, besides ~/Music/claudius, claudius’ caches and the sound libraries; repeatable

--public without --token makes a random token and prints how to use it:

$ claudius serve --public --port 7920
claudius at http://127.0.0.1:7920: web UI at /, API at /api, MCP at /mcp (token required)
shared with a new token: open http://127.0.0.1:7920/?token=<token> (through your tunnel, its address with ?token=<token>), or send Authorization: Bearer <token>. --token sets your own.

The token is new at every start; pass --token to keep one across restarts, as an assistant’s configuration needs. MCP tools shows the tunnel setup and the security model what each flag protects. --host with any address but loopback makes a token the same way, with or without --public: browsers on the network are refused by the host-name check, and the token keeps out programs that send Host: localhost.

--public, --host with an address other than loopback, or --files limits file access to ~/Music/claudius, claudius’ caches and the sound libraries, plus the --files folders; without any of them, commands read and write wherever you can. What a shared claudius may read and write has the details.

claudius mcp

Speaks MCP over stdin and stdout, for assistants that start claudius themselves (Claude Desktop, Claude Code, Cursor). It first asks the address in --url, or http://127.0.0.1:<port>, whether a claudius is running there:

  • if one answers, every tool works on that session: the song open in your studio;
  • if the one on the port is older than this one, and --url was not given, it runs beside it, as claudius studio does: it drives a claudius as new as itself on one of the twenty ports after it (the studio, which stepped round the same one), or else starts a session of its own on the first free one of them. With --url it drives the older one, and says so;
  • if one answers but asks for a token that --token did not give (or gave wrong), it fails with Error: the claudius at <url> asks for a token: pass --token or set CLAUDIUS_TOKEN (a wrong one is refused too);
  • if none answers and --url was given, it fails with Error: no claudius answers at <url>;
  • otherwise it starts a session of its own and serves the web studio on --port, so you can open it to listen.

What it decided goes to stderr, which MCP clients show in their logs:

claudius mcp: driving the claudius app at http://127.0.0.1:7878
flagdefaultwhat it does
--urlhttp://127.0.0.1:<port>a claudius elsewhere
--tokennone (CLAUDIUS_TOKEN)the token of that claudius
session flagsused only when it runs a session of its own

Set up and check

claudius setup

Downloads what does not ship with the program: the default sample packs and earshot’s listening models. On a terminal it asks before each download; elsewhere (and with --yes) it does not ask.

flagwhat it does
-y, --yesdoes not ask
--no-packsskips the sample packs
--no-modelsskips the models
--tagsalso downloads the AudioSet tagger, 347 MB more, used by --tags

The prompt shows what is missing and how much it downloads: about 3.1 GB for the default packs, which take 1.5 GB on disk because several arrive as WAV and are converted to FLAC, and 1.1 GB for the models: 918 MB of listening models (CLAP, and the 133 MB of Audiobox Aesthetics) and 157 MB of Spleeter’s nets, which separate a recording’s vocals, drums and bass (the prompt says about 1.1 GB, or 1.4 GB with --tags). An interrupted pack download resumes where it stopped; a model file that was cut off downloads again from its start, and the files that finished are kept. After the models arrive, the first load spends about 30 s embedding earshot’s vocabulary once.

claudius doctor

Checks the installation and says what is missing.

$ claudius doctor
claudius 0.1.0 (macos aarch64)
  ok  web studio      ~/.local/share/claudius/web
  ok  sample packs    22 default packs (1.5 GB) in ~/Library/Application Support/claudius/packs
  ok  ears            models in ~/.cache/earshot-rs
  ok  Apple Loops     14096 loops and samples
  ok  ffmpeg          9.0.2 (reads the formats claudius cannot)
  ok  port 7878       free
  ..  Claude Desktop  not connected: `claudius connect claude-desktop`
  ..  Cursor          not connected: `claudius connect cursor`
  ..  statistics      off (`claudius telemetry` explains them)

Everything claudius needs is here.

ok is fine, -- counts as a problem, .. is optional. The port line says whether --port (or CLAUDIUS_PORT) is free, already serving claudius (claudius is running here, also for one that asks for a token), or taken by another program.

claudius connect

Adds claudius to an assistant, or removes it: its MCP configuration, and the skills that teach it claudius. MCP tools covers each client.

argument or flagwhat it does
claude-desktopedits claude_desktop_config.json, and writes the skills as zips into ~/Music/claudius/skills/ to upload in Claude’s settings
claude-coderuns claude mcp add --scope user ..., and installs the skills in ~/.claude/skills/
cursoredits ~/.cursor/mcp.json, and installs the skills in ~/.cursor/skills/
codexedits [mcp_servers.claudius] in ~/.codex/config.toml, and installs the skills in ~/.codex/skills/
printprints each assistant’s own command for setting it up by hand (claude mcp add, codex mcp add, Cursor’s install link), and the configuration for any other client, with the full path of this claudius
--httpconnects over HTTP to a running studio instead of starting claudius mcp (not for Claude Desktop or Codex)
--no-skillsconnects the MCP server only
--removetakes claudius, and its skills, out again
--portthe port the --http URL uses (CLAUDIUS_PORT)

Every configuration file it edits keeps a .bak copy of the old one. Installing the skills replaces only claudius’ own skill folders (claudius-songs, claudius-remix, claudius-setup). An assistant reads its configuration when it starts, so connect ends by saying how to restart it: quit and reopen Claude Desktop, restart Cursor or reload its window, start a new Codex or Claude Code session.

claude-code runs the claude command, found on PATH or where its installers put it (~/.local/bin, ~/.claude/local, ~/.npm-global/bin, /opt/homebrew/bin, /usr/local/bin), and replaces a claudius Claude Code already has. The studio’s Connect an assistant does what connect does, and claudius doctor lists the assistants that are connected.

claudius update

claudius update             # downloads the latest release, and installs it after asking
claudius update --check     # only says whether there is a newer release
claudius update --auto off  # the studio stops looking for updates (on turns it back on)

It installs the latest release the way this claudius was installed: the Mac app, an AppImage, the install script’s programs, or the Windows installer, from the release’s file for this computer, checked against its SHA256SUMS. Installed with Homebrew, cargo, a .deb or .rpm, or built from source, it says how to update instead. --yes does not ask. Updates has the details.

claudius telemetry

claudius telemetry        # whether anonymous usage statistics are on, and an event exactly as it is sent
claudius telemetry on
claudius telemetry off

Anonymous usage statistics are off until you turn them on, here or when the studio’s tour asks. When they are on, claudius sends each kind of event at most once a day: which command started it, the version and the system, and where a setup or a panic failed. DO_NOT_TRACK=1, CLAUDIUS_TELEMETRY=0 and CI keep them off whatever the answer. Privacy and usage statistics lists every field and where they go.

claudius skills

claudius skills --out ~/my-project/.claude/skills

Writes the skills that teach an assistant claudius into a folder (claudius-skills by default): a folder with a SKILL.md for each, and a zip of each for the Claude apps. They are built into the binary, so they match it.

MCP tools

claudius is an MCP server: an assistant connected to it makes, edits, renders and judges songs with the tools below, on the same session the studio shows. Working with an assistant is the short version of this page.

There are two ways to reach it:

  • stdio: the client starts claudius mcp and talks to it over stdin and stdout. This is what desktop clients do.
  • Streamable HTTP: the client connects to http://127.0.0.1:7878/mcp while claudius studio or claudius serve runs.

Setting up a client

Claude Desktop

claudius connect claude-desktop

This adds an entry to Claude Desktop’s configuration, keeps the old file as claude_desktop_config.json.bak, and asks you to quit and reopen Claude Desktop. claudius connect claude-desktop --remove takes it out again. On a Mac, the release’s claudius-<version>.mcpb does it as an extension instead: open it, and Claude Desktop installs it, starting the app’s program (its Claudius program setting).

By hand, add this to the configuration file (in Claude Desktop’s Settings, Developer, Edit Config opens it), with the absolute path of your claudius (which claudius prints it; Claude Desktop does not see your shell’s PATH):

{ "mcpServers": { "claudius": { "command": "/Users/you/.local/bin/claudius", "args": ["mcp"] } } }
systemconfiguration file
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Windows%APPDATA%\Claude\claude_desktop_config.json
Linux~/.config/Claude/claude_desktop_config.json

Claude Desktop starts its local servers itself, so --http is refused for it.

Claude Code

claudius connect claude-code          # runs: claude mcp add --scope user claudius -- /path/to/claudius mcp
claudius connect claude-code --http   # runs: claude mcp add --scope user --transport http claudius http://127.0.0.1:7878/mcp

The plugin brings the skills along: claude plugin marketplace add devlato/claudius, then claude plugin install claudius@claudius. When the claude command is not on your PATH, connect prints the command for you to run where it is. Claude Code’s own command does the same, with the claudius on your PATH: claude mcp add --scope user claudius -- claudius mcp. Without --scope user, Claude Code adds it to the folder you run that in only.

Cursor

claudius connect cursor               # "claudius": { "command": "/path/to/claudius", "args": ["mcp"] }
claudius connect cursor --http        # "claudius": { "url": "http://127.0.0.1:7878/mcp" }

Both edit mcpServers in ~/.cursor/mcp.json and keep a .bak copy. A project’s .cursor/mcp.json takes the same entry. Cursor’s install link adds it as well, after asking: Add claudius to Cursor starts the claudius on your PATH; claudius connect print prints a link with its full path.

Codex

claudius connect codex

This adds [mcp_servers.claudius] to ~/.codex/config.toml, with the absolute path of claudius and args = ["mcp"], and leaves the rest of the file as it was (comments included), with a config.toml.bak copy. Codex starts local servers itself, so --http is refused for it. Codex’s own codex mcp add claudius -- claudius mcp writes the same table, with the claudius on your PATH.

Skills

claudius connect also installs claudius’ skills for the clients that read them from a folder (Claude Code, Cursor, Codex), and writes them as zips for the Claude apps. --no-skills leaves them out.

Any other client

claudius connect print prints each assistant’s own command (claude mcp add, codex mcp add, Cursor’s install link) with the full path of this claudius, the stdio configuration as JSON for Claude Desktop and any other client, and the HTTP address. --port (or CLAUDIUS_PORT) changes the port in the HTTP address.

ChatGPT and other assistants in the cloud

An assistant that runs on someone else’s computer cannot start claudius mcp or reach 127.0.0.1. It needs a public HTTPS address, so put claudius behind a tunnel and require a token:

TOKEN=$(openssl rand -hex 16); echo "$TOKEN"
claudius serve --public --token "$TOKEN"
cloudflared tunnel --url http://127.0.0.1:7878

--public makes claudius answer requests addressed to the tunnel’s host name; it still listens on 127.0.0.1. In ChatGPT’s developer mode, add a custom connector with the URL https://<tunnel>/mcp?token=<token>. Clients that can send headers can use Authorization: Bearer <token> instead of the query string. Open https://<tunnel>/?token=<token> in a browser to use the studio through the same tunnel.

--public always runs with a token. Without --token it makes a new random one at every start and prints it, which is enough for a browser but means updating the connector after each restart; a token of your own, as above, stays the same. A shared claudius reads and writes files only in its own folders; the security model explains what the token, --public and those folders protect.

The studio and the assistant on one song

claudius mcp first asks http://127.0.0.1:<port>/api/hello (or --url) whether a claudius is running:

                     claudius studio (or serve) on :7878
                      session: song, undo, renders
                     /             |              \
         studio window      browser tab        claudius mcp  <-- stdio --  Claude Desktop
                                                (HTTP client)
  • A studio is running: every tool call becomes a request to its HTTP API. The assistant edits the song you have open, you hear each render in the studio, and you can change things yourself between its calls. Undo in the studio takes back the assistant’s changes too.
  • A claudius that asks for a token is running (serve --token, or --public), and claudius mcp was not given that token: it stops with the claudius at http://127.0.0.1:7878 asks for a token: pass --token or set CLAUDIUS_TOKEN (a wrong one is refused too) rather than quietly working on a song of its own.
  • Nothing is running: claudius mcp starts a session of its own and serves the web studio on --port. Open http://127.0.0.1:7878 to see and hear what the assistant does. If the port is taken by another program, the session still works but has no web studio.

So open the studio before you start the assistant’s chat. With --url http://host:port and --token, claudius mcp drives a claudius elsewhere, and fails if none answers there.

A client connected over HTTP (/mcp) always works on that server’s session; there is nothing to decide.

The tools

A tool that edits the song waits until the change is rendered and judged, then answers with the song and the verdict, so the assistant hears the result of every change. An assistant’s link gives up on a call after a minute or so (the desktop app’s after about 80 s), so a tool whose work takes longer than 45 s (remaking or sampling a long recording, rendering a long song, a mutation, an evolution, a save) answers then that it is still going, and the work goes on. status says how it goes, and gives its answer once it is done: each one’s, in the order they were called, when the work of more than one call goes on.

toolparameterswhat it does
new_songgenre (required), seed, bpm, key, loops (false), sampled (as the genre is), sample_search, complexity (0 to 1; the genre’s own)composes a new song in a genre, renders and judges it; sampled builds it on samples from free libraries and sample_search names the kind of record its phrase is searched for (Songs built on samples); complexity says how layered it is, from 0 (the genre’s core) to 1 (instruments doubled on instruments, a counter-melody, more percussion)
arrangebrief (required), picka change asked for in the person’s words (“make the drop longer”, “the hats quieter in the intro”), read as the studio’s palette reads it (its rules, and its small model where they read nothing): makes the surest reading as one change that undo takes back whole, renders and judges it, and answers with what it read, what it did and the other readings, numbered, for pick after an undo; a brief read as no change says so
make_songbrief (required), seedmakes a song from what the person asked for in their words (“a chill lo-fi beat around 80 bpm in D minor, minimal”): reads the genre (two joined by “with”, “and” or “meets” are a fusion, the first leading), the tempo, the key, how full or sparse it is and whether it is built on samples, as new_song takes them, and answers with what it read, the song in plain words and the song; a brief that names no genre gets the nearest by what it describes, said so, or an error that says to ask the person
examplesnamethe example songs, by decade, then the classics remade, the songs built of layered sounds and the studies of famous records: each one’s name, title, style and the artists the style is heard on (of a classic, the piece; of a study, the record); with a name, how that one is made and its script; read only
open_examplename (required)opens an example song as the song, renders and judges it, and answers with it in plain words; undo brings back the song before
get_songthe open song in plain words for the person (what it is, how it goes, what plays, what the critic would fix first), then the song and its verdict, and the whole song as a script
run_scriptcode (required), listen (true)edits the song with a script
script_referencethe script language reference (markdown)
guidetopic (none: the list)the skills built into claudius, for an assistant that has none installed: songs, remix or setup (a skill), or script, verdict, genres or tools (the songs skill’s references); read only
listenstems (false)renders the song if it changed and returns the verdict
quick_fixtarget (an issue’s, as the verdict’s quick fix (<target>) lines name it; none: all)makes the verdict’s quick fixes, the issues one change fixes, as one edit
mutatecount (4, 1 to 32), keep_best (true)tries variations steered by the critic’s issues and keeps the best if it beats the song
evolvegenerations (3, 1 to 20), children (6, 2 to 32)runs an evolutionary search from the song and keeps the best candidate if it beats the song
statusa tool’s work that went on past its call: how long it has gone on, or its answer once it is done (given once); then idle or busy (with progress), the last 25 log lines, the latest verdict
versionwhich claudius the assistant talks to: these tools’ version, the claudius they drive and where it answers, and whether a studio follows it (one that asked for the song in the last minute); a claudius before 0.11 has no version tool
undo, redotakes back or brings back the last change, then renders
stopstops a mutation after the candidate in progress, an evolution after its generation, or a pack download after the pack in progress; a render always finishes
catalogthe genres by family, with their other names and tempo ranges, drum names, synth presets, installed instruments and every pack with its licence
find_genrequery (required)the genres that answer what the person asks for, best first: a genre’s name or another name for it, an era, a scene, an artist or a sound (90s, west coast, r&b, dusty), then those near what the words mean once the embedding model is there (“something to study to”), as the studio’s genre search finds them
savepath (optional), stems (optional, off)writes the song folder: blueprint.json and song.rhai at once, then, from a render of the song as it is then, the whole folder claudius make writes, and with stems each track on its own in stems/ (a gigabyte or more for a song); a save asked for during a job waits for it, and one the disk has no room for is refused before it writes the audio
exportformats (required, such as ["mp3", "flac:16"]), path (optional)writes the song in those formats into its folder or path, named after the song; renders first when the song changed since its last render. project writes the song itself as a project file instead, with the recordings it plays and its release, and needs no render
publishwhat the person said: artist, title, version, featuring, album, genre, subgenre, date, label, writers, producers, owner, isrc, upc, explicit, made, artwork (a file); write, pathchecks the song for release as stores do and, with write, writes the release kit; what is left out stays as it was, and the assistant is told never to choose made
openpath (required)opens a song folder, a blueprint.json, a .rhai script (which runs on the open song), or a project the online demo saved (a .claudius file, or the .zip an earlier demo saved, unpacked into a song folder of its own under ~/Music/claudius)
analyzepath (required)tempo, key, progressions, the song’s own sections (verse, pre-chorus, chorus, bridge … each with the letter of the music it plays and where it builds), the phrases sung to the beat, drum grid and bass style of an audio file
tunetrack (required), strength, speed_ms, humanize, vibrato, scale, offa tuner first in the track’s chain, or the one there changed, or taken out (Tuning a voice)
assess_voicetake, or path and keyhow a take or a recording is sung: how many notes land within 25 and 50 cents of the note meant, the furthest off, and the singer’s range, sharpness or flatness by register, scatter, settling and vibrato (Your voice); read only
remakepath (required), genre, seed, bpm, sampled (true), flip (false), rebuild (false)a rework of an audio file in a genre that stays recognizable: all of it plays through, its voice and chords as they are without its drums and its bass (separated from the rest with the ears), in its own sections and on its chords, with the genre’s drums, bass and mix under it (Remaking a song from audio); flip: true makes a new song of the genre on its hook and passage after passage of it, each section on as many of its bars on end as it has, its voice in them, its drums and a flip of it; rebuild: true the song itself, every part of it played on claudius’s sounds as the notes and hits it plays, its voice kept; sampled: false a new song on its skeleton only
song_likegenre, seeda new song like the recording analyze heard last, in the genre (the open song’s by default): its tempo, halved or doubled into the genre’s range when it is outside, its key, progressions, form and swing, and none of its sound; quicker than remake with sampled: false, which listens to the file again
change_genregenre (required; any number fused with +), seedthe open song in another genre, as one change undo takes back: its form, chords and key, the recordings it plays, the notes written on its parts, its lead’s melody and its pattern tracks kept; the genre’s drums, bass, parts, sounds, swing and mix playing it, each section by the genre’s tracks of the kinds that played there; its tempo kept when recordings play in it, else the nearest the genre plays; says what it kept
harmonizepart (required), style, sound, nameadds chords under a part’s melody, a new part that harmonizes it: a chord under each of its notes (block, on its own sound), in a chord style’s rhythm or as a genre’s comping idiom, fitting its notes and the song’s chords, in the sections it plays in; then listens
generate_trackwhat (required: drums, percussion, bass, chords, keys, pad, strings, lead, arp), genre, replace, name, listen (true)writes a track the way a genre plays it, into the open song: a part in that genre’s idiom, on its sounds, in its register and mix (a new track, or in place of replace), its drums in place of the song’s lanes of their names, or its percussion beside them; the genre can be any, so a song gets a reggae bass or trap hats. Each call is another take
vary_tracktrack (required), take, listen (true)a variation of a part’s or a drum lane’s take (the same rhythm, other details; a lane’s strong hits kept), or with take another take
set_layerstrack, layers (1 to 8: sound, bank, band, level, pan, transpose, duck, fx), listen (true)plays a track with several sounds at once, each its own layer of the track’s notes: the band of frequencies it keeps, its level against the others, its pan, transpose, duck under the kick and effects, summed before the track’s own effects; a part, a drum lane or a pattern track’s sound. get_song shows a track’s layers as this takes them; undo brings the sound back
swap_soundtrack, to, only (drums or parts), listen (true)swaps a sound: a part or a drum lane onto the next sound that fits it (its genre’s own first, then what its genre draws for the role, then further afield, never one another part plays) or onto to; a part played by a rack swaps the sound it is heard by and keeps its other layers (the sub under a stacked bass); with no track, the whole song: the drums onto the next kit and each part onto its next sound. Says what else the track could play; undo swaps back
add_takepath, from (required), name, roleadds a recording as a take that plays once from the start of section from, and listens
search_recordingsquery (required), limitsearches the free online libraries and lists each recording as library:<id>, which add_take, sample_song, analyze and remake take as a path
trim_taketrack (required), start, end (seconds into its recording)trims a take to that much of its recording, and listens; undo brings it back whole
graphthe song as a graph of its signal, in words: each track through its effects into its bus (its sends, its ducking, its sections), the buses and returns into the master, the master’s chain out; read only
sample_piecespath (required), seed, count, bars, find, kindsoffers the auto-sampler’s pieces of a recording, its phrases and a loop of its hook and of another passage, its break and its bass line, and more of the kinds producers sample most where they differ (a sparse groove and a busy one), each as it was cut and treated, with what it scored for and where to hear it, before any goes into the song
redraw_piecesseeddraws the pieces of the same recording again: another take, of other pieces than the last where there are any
keep_pieceskeep (required: [{id, treated, chopped}]), sections, everysamples the pieces chosen into the song, each as it was cut or treated, whole or chopped onto pads, coming round as every says (as the song suits by default), then listens
sample_songpath (required), count, bars, find, sections, how, every, kindssamples a recording’s vocals into the song: finds its best phrases sung whole (those sample_pieces offers first), cleans them of its drums, fits them to the song’s tempo and key, places them where they agree with its chords and mixes them as vocals, then listens; or another way (how), or the best piece of each of kinds, kept as its kind plays
transcribe_drumstake or path, bars, variant, bpm, keep_taketurns a beat, played or beatboxed into the song’s kick, snare (or clap) and hat lanes, then listens: a take of the song (muted after, unless keep_take) or a recording (a drum loop, a break)
extract_groovepath (required), name, lanes, bpmtakes the groove of a recording’s drums: where each sixteenth of the bar lands against the grid and how hard. Keeps it with the song, puts the drum lanes in it (lanes, or all), then listens. Give bpm when the tempo is known; heard, a loop’s can come out twice or half what it is
request_pitch_checklow, high, noteasks the person for a pitch check: six phrases to sing back in the studio’s Record window; answers at once with the check’s id and a link that opens the studio
wait_for_pitch_checkid (required), secondswaits for the check to be sung, and says what claudius heard: how many notes, how near, in which octave, steps against leaps, and the voice, which tune then sings takes as; read only
wait_for_messageafter (the last message’s id seen), seconds (50, 1 to 300)what the person writes to you in the studio’s chat after message after (none: from now on), with the messages before it, as soon as they write; else, after seconds, that they have not: call it again to keep listening. While you wait, and for 20 s after, the studio says you listen (Talking to your assistant); read only
send_messagetext (required), reply_towrites to the person in the studio’s chat, as your client calls itself, in answer to their message reply_to; the studio notifies them when it is in the background. Returns the message’s id
request_takefrom (required), role, name, noteasks the person to record a take: the studio’s Record window opens for it, showing note; answers at once with the request’s id and a link that opens the studio
wait_for_takeid (required), seconds (50, 1 to 300)waits for the take asked for: what claudius made of it once the person sends it, or that they will not record it; after seconds, says they are still at it
transcribe_taketake, sounds (required), name, role, chromatic, keep_take, styleturns a take’s melody into the notes of a new part for each sound, as it was sung or in a style, and listens
add_notesfrom, notes ([{t, d, p, v}]), sounds (required), name, role, stylewrites notes, a melody, a bass line or chords, into a new part for each sound, and listens
install_packsnames (from catalog; none: the default packs that are missing, or lack instruments added since they were installed)downloads and installs sample packs in the background, as the studio’s Download the packs does; status follows it, and a claudius shared over a network does not download them
commandcommand (required, an object), listen (true), explain (false)sends one raw API command, checked first: one claudius has no name for, or with a field it does not take, is not sent, and the answer says what it takes and the name nearest the one written; explain only says what the command takes

Details that matter when you read an assistant’s transcript:

  • listen: false on run_script and command skips the wait, so an assistant can batch several edits and listen once. The studio still renders each change unless it runs with --no-auto-render.
  • request_take does not wait for the person. The assistant calls wait_for_take until the take arrives: it returns as soon as the person sends it or says Not now, and an assistant whose calls time out can ask for fewer seconds and call it more often.
  • Past 45 s, a call answers that its work is still going, and status gives the answer. Behind that, listen follows the render for up to 240 s, save 240 s, evolve 280 s and mutate 300 s. mutate and evolve answer with the log lines the job wrote (one per candidate and its score) and then the song.
  • A seed is optional everywhere. Without one, the session picks one from the clock; new_song names it in its message and get_song shows it in the script’s first line, so the song can be made again.
  • save without a path writes to the folder the song lives in under ~/Music/claudius (the one it was opened from or saved to), else to ~/Music/claudius/<genre>-<title>-<seed>. rename_song {title} (through command) renames a song, and the folder claudius named for it moves with its history. Paths are on the computer running claudius, and a shared claudius refuses paths outside its folders.
  • Everything the studio does, an assistant can do: each of the studio’s controls sends one command, and each command has a tool of its own or goes through command (a test keeps it so). command covers the edits the studio makes that have no tool: set_tempo, set_key, set_swing, set_progression, add_section, remove_section, move_section, split_section, toggle_layer, set_section (including prog), set_drum_step, set_drum_pattern, set_trig, set_lane, set_part (including reseed), add_track and remove_track (a drum lane or a part of any role, as the arrangement’s + Add a track adds), set_notes (a part’s notes over a progression written out, as the studio’s Notes tab does), set_mix (including solo), set_fx, open_text, add_hits (drums played on pads, folded into the lanes they strike), add_scratch (a scratch on a bar or a few of one of the song’s tracks, or of the whole mix, kept as a take), and cancel_take_request and cancel_pitch_check for a request no longer wanted. The songs skill’s tools pair each control with its tool and command.
  • A raw command is checked against its schema before it goes, because a field written wrong would otherwise be dropped and the command sent without it:
set_mix takes no "lvl_db" (did you mean "level_db"?), so nothing was sent.
set_mix takes:
  track (string, needed)
  level_db (number)
  pan (number)
  ...
  • A failed edit changes nothing and comes back as a tool error (isError: true) with claudius’ message, the same text the studio shows:
Runtime error: track 'x': unknown sound 'nope' (drums: bd kick sd snare cp clap hh ch hat oh ohat rd ride cr crash lt mt ht tom rim rs sh shaker cb cowbell snap perc; synths: sub_bass 808 reese acid saw_bass pluck_bass organ_bass wobble log_drum pluck supersaw pad warm_pad stab epiano keys bell organ strings square_lead chip fm_bass rubber_bass moog_bass dist_bass deep_bass saw_lead pwm_lead whistle soft_lead glide_lead brass_lead fm_lead vox_lead solina glass_pad pwm_pad air_pad vowel_pad swell_pad tine_piano clav house_piano brass_stab rock_organ fm_marimba fm_kalimba harp_pluck mallet cowbell_lead; sampled: piano upright rhodes wurlitzer hammond string_ensemble violins cellos pizzicato brass trumpet flute harp marimba vibes kalimba upright_bass guitar choir sax ... (claudius-packs aliases)) (line 1, position 1)

What the assistant reads back

This is listen after tempo(122); mix("lead", #{ level: -2 }); on a house song made with seed 9, in a session on port 7931:

Crimson Tide — house at 122 BPM in G dorian, swing 0.53, 72 bars (2:22)
progression A: i7 IV9 i7 VIImaj7 i7 IV9 i7 V7
progression B: i7 ii7 i7 VIImaj7
form:
  0. intro (intro) bar 0 +8, energy 0.36, drums 'sparse' [filter_in]: kick hat perc
  1. groove (groove) bar 8 +32, energy 0.66, drums 'main': kick clap hat ohat perc bass chords top
  2. break (break) bar 40 +8, energy 0.35, drums 'main' [build, gap]: pad lead chords
  3. drop (drop) bar 48 +16, energy 0.99, drums 'main' [impact]: kick clap hat ohat shaker perc bass chords lead arp top
  4. outro (outro) bar 64 +8, energy 0.20, drums 'sparse': hat perc
tracks:
  kick [drum kick] sampled bd (tr909:bd); level +0.0 dB, pan +0.00, reverb 0.00, delay 0.00, duck 0.00, -13.1 LUFS
  clap [drum clap] sampled cp (tr909:cp); level +0.0 dB, pan +0.00, reverb 0.18, delay 0.00, duck 0.00, -15.1 LUFS
  ...
  lead [part lead] synth patch 'brass_lead'; level -2.0 dB, pan +0.00, reverb 0.21, delay 0.34, duck 0.20, -20.6 LUFS
  arp [part arp] synth patch 'bell'; level +0.0 dB, pan +0.20, reverb 0.29, delay 0.18, duck 0.30, -21.1 LUFS
  fx [fx fx] risers, impacts, crashes; level +0.0 dB, pan +0.00, reverb 0.25, delay 0.00, duck 0.00
render: -10.1 LUFS, true peak -1.0 dBTP, 142 s
verdict 93.3/100: 93/100 (arc 0.88, mix 0.92, theory 1.00). Fix first: nearly mono (correlation 0.97): widen pads, chords and effects
  scores: arc 0.88, mix 0.92, theory 1.00
  loudness by section (LUFS): intro -11.8, groove -9.5, break -12.4, drop -9.0, outro -20.7
  issue (0.35): nearly mono (correlation 0.97): widen pads, chords and effects — fix: width+
audio: http://127.0.0.1:7931/api/audio/8.wav (the studio at http://127.0.0.1:7931 plays it)

get_song adds the song as a script in a js block. A verdict of a song with several sections also has a loudness by section (LUFS): line, each section’s median loudness in the order they play, which shows whether the drop is really the loudest part. With earshot’s models loaded, the verdict has a line that starts with ears:, and up to eight issues follow, each with where its fix lives (issue (0.24): dull 4-8 kHz: ... — fix: band:presence-). The critic and the ears explains them.

Prompts that work

The assistant does better with what you want to hear than with what to type. Some that work well:

  • “Make a deep house track at 122 BPM in F minor. Keep the intro sparse and make the drop hit hard. Listen to it and tell me the two biggest problems before you change anything.”
  • “Read the script reference, then replace the chords with a Rhodes playing i9 VImaj9 iv9 v7, two bars each.”
  • “The breakdown is too busy. Take the lead out of it and lower the pad by 3 dB. Undo if the verdict gets worse.”
  • “Try eight mutations and keep the best one. Then tell me what changed, in musical terms.”
  • “Remake ~/Music/reference.mp3 as lofi, keep its progression, and put the drums on the 808 kit.”
  • “Write the hats yourself as a pattern track: sixteenths, with an open hat on every offbeat and a roll before each drop.”
  • “Save it to ~/Music/claudius/night-drive.”

Two habits help: ask the assistant to get_song before it edits a song you made in the studio, so it starts from what is there, and ask it to say what it changed in musical words, since you hear the result and it reads numbers.

MCP over HTTP

The endpoint at /mcp is MCP’s Streamable HTTP transport. Every request is a POST with Content-Type: application/json and Accept: application/json, text/event-stream; replies come as server-sent events. The first request is initialize, whose reply carries an mcp-session-id header that later requests send back. The endpoint sits behind the same guards as the rest of the server: loopback host names only unless --public, and the token when one is set.

curl -si http://127.0.0.1:7878/mcp -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'
HTTP/1.1 200 OK
content-type: text/event-stream
mcp-session-id: 67068efb-d5e6-4618-84eb-326443bc774c
...

A request without the session id gets 422 Unexpected message, expect initialize request; one without both Accept types gets 406 Not Acceptable.

HTTP API

claudius studio, claudius serve and a claudius mcp that runs its own session answer HTTP on http://127.0.0.1:7878 (--port, CLAUDIUS_PORT). The studio, in its window and in the browser, uses nothing but this API, so anything it does you can do with curl. The types are plain serde structs in the claudius-api crate (crates/claudius-api/src/lib.rs), which also compiles to WebAssembly for the web studio.

Routes

routeanswer
GET /api/hello{"name":"claudius","version":"0.1.0","state":1,"ears":false,"studio":{"version":"0.1.0","seconds":3}}: is this claudius, which version, the state version, whether earshot’s models are loaded, and the studio that follows it (the last to ask for the state with ?studio=, in the last minute; null when none has)
GET /api/metricshow fast this claudius has run since it started, in Prometheus’ text format: for each of rendering, listening with the ears and decoding a recording, how many times (claudius_render_total), the seconds of audio (claudius_render_audio_seconds_total), the seconds they took (claudius_render_seconds_total) and the last one’s speed in seconds of audio a second (claudius_render_speed); its version (claudius_build_info), uptime and the song’s changes. A Prometheus server can scrape it; nothing leaves the computer unless something asks
GET /api/statethe state at once
GET /api/state?since=Nthe state as soon as its version is past N (long polling); a studio window adds &studio=<its version>, which /api/hello then reports
GET /api/state?settled=1the state once no job runs and the render is of the current song
POST /api/commandruns one command (JSON body) and answers with a reply
GET /api/scriptthe song as a script, text/plain (// no song yet: try song("house") before the first song)
GET /api/referencethe script language reference, text/markdown
GET /api/soundsevery sound name: drum voices, synth presets, installed instruments, and every pack; also the installed kits’ drums (kit), the roles each synth preset is made for (synth_roles), what each synth preset and drum voice is in a few words (about), and for each role the styles a part may be written in, each with what it plays (styles)
GET /api/genres?q=WORDSthe genres as the state lists them, or those that answer the search q, best first: a name or another name, an era, a scene, an artist or a sound (?q=west%20coast)
POST /api/hearwhat was said to the command palette, heard: the body is a WAV file of it (Content-Type: audio/wav), at most 30 s, any rate and channels; the answer is {"heard", "text"}, the words as the speech model heard them and as the palette reads them, words claudius knows put right (“undu” as undo, “base” as bass when the song has a bass), both empty when nothing was said. The speech model downloads the first time (17 MB). 415 for another content type, 422 for a file that is no WAV or is too long
GET /api/find?q=WORDSthe studio’s actions the command palette finds for WORDS (optional limit, 12 by default and 40 at most), best first: {"query", "found": [{"id", "name", "place", "keys", "score", "by"}], "done": [...], "proposed": [...], "told": [...], "reading", "by_meaning", "read_as"}, where by says whether an action was found by its name or by what the words mean (meaning), done holds the changes in the state’s history the words find that go_back can reach (at most 5: id, what undo calls it as name, what it changed as place), proposed holds what the words ask of the song, read as what claudius would do for it, for the person to confirm (at most 4, the likeliest first: said, what it does in words; detail, what it does to each track when it does more than one thing; commands, the commands that do it; reading, what was read: its kind, tracks, numbers, way, the change it goes back to before as about, and by_model when the request model read it; and score), told holds the answers to a question the words ask about the song, from the song as it is (said, and detail under it; none when they ask none), reading says the request model is still reading words the readings proposed nothing for (ask again in a moment; the first such words download it), by_meaning says whether the embedding model is there yet (the first request downloads it), and read_as, when a word was typed with a slip, the words as they were read (each such word as the word meant, which the rest was found for); all the actions, in order, for no words
GET /api/search?among=genres&q=WORDSwhat a search field’s words find among the genres (among=genres) or the sounds (among=sounds), best first (optional limit, 40 by default and 400 at most): {"query", "among", "names", "by_meaning"}, where names holds those the words find, as the studio’s own search finds them, then those near what the words mean, and by_meaning says whether the embedding model is there yet (the first search downloads it); 400 for anything else to search among
GET /api/audio/{version}.wavthe master of that render, 48 kHz 24-bit
GET /api/audio/{version}.mp3the same as MP3, encoded on the first request
GET /api/stems/{version}/{track}.wavone track of a render made with stems
GET /api/window?from=S&secs=Nthe live mix: N seconds (1 by default, 10 at most) of the song as it is now from S seconds, mixed from the tracks the last render made (below)
GET /api/export/{version}/{name}.{ext}?format=SPECthat render in another format, as a download named {name}.{ext}
POST /api/release/artworkthe release’s artwork, as the file itself with Content-Type: image/jpeg, image/png or application/octet-stream (40 MB at most); answers with a reply
GET /api/release/artworkthe artwork as it was given
GET /api/release/preview.pngthe artwork at most 512 pixels on a side, as PNG
POST /api/samplea recording whose vocals to sample into the song, as the file itself, as for /api/takes; optional name (whose extension says the format), count, bars, find, sections (comma-separated), how (phrases, passage, chops or stabs), every (how often each phrase comes round) and kinds (comma-separated, the kinds of piece) in the query, as for sample_song; answers with a reply
POST /api/groovea recording whose drums’ groove to take, as the file itself, as for /api/takes; optional name (whose extension says the format, and whose 92bpm says the tempo), groove (what to call it), lanes (comma-separated) and bpm in the query, as for extract_groove; answers with a reply
POST /api/pitch-check?id=IDthe answers to pitch check id, sung from its first beat, as the file itself, as for /api/takes; answers with a reply saying what claudius heard, and the voice it heard becomes the person’s (voice)
GET /api/library/search?q=WORDSthe recordings the free online libraries offer for WORDS (optional limit, 20 by default), as a JSON array of LibraryHit: id, title, creator, licence, seconds, page, audio (where to fetch it from this claudius) and credit; a command takes one’s id as library:<id> wherever it takes a recording’s path
GET /api/library/audio?id=IDa recording a search found, downloaded once into the samples folder with its credit, to hear
POST /api/sample/piecesa recording, as the file itself, whose pieces the auto-sampler offers; optional name, seed, count, bars, find and kinds (separated by commas) in the query, as for sample_pieces; answers with a reply, and the pieces go in the state’s pieces
GET /api/pieces/FILEa piece the auto-sampler offers, to hear (as pieces names it)
POST /api/takes?from=SECTIONa recording as a take, as the file itself (WAV, FLAC, Ogg, MP3 or AIFF) with Content-Type: audio/... or application/octet-stream (300 MB at most); optional name and role in the query, as for add_take, and request, the id of the take request it answers; answers with a reply
POST /api/analyze?name=FILEa recording to listen to, as the file itself with Content-Type: audio/... or application/octet-stream (300 MB at most), named in the query so that its extension says its format (WAV, FLAC, MP3, AAC, ALAC, Ogg, AIFF …); answers with a reply whose message is what analyze says, and heard: what was heard as the studio shows it (its bpm, steady, key, key_confidence, swing, lufs, secs; bars, each with its start in seconds and its chord and numeral; sections, each with its start_bar, bars, kind and energy and whether its kick, bass, hats and harmony play; phrases, where its voice sings each phrase, [from, to] in seconds; waveform, its peak envelope to draw it by, about
1000 points from 0 to 1, as a render’s; progression_a, progression_b, bars_per_chord; kick, snare and hats, a strength for each sixteenth of a bar; bass, in words), and audio, its id and the tracks claudius keeps of it until it analyzes another
GET /api/listened/{id}/{track}a track of the recording analyzed last as a WAV file, id its answer’s heard.audio.id: recording, and with the ears the parts it took it apart into, vocals, drums, bass and other; 404 once another is analyzed
POST /api/remake?name=FILEa recording to rework (or flip, or remake), sent as for /api/analyze; optional genre, seed, bpm, sampled and flip in the query, as for remake, and a ticket that stop_remake names it by; answers with a reply
GET /api/projectthe open song as a project file (application/octet-stream, named after the song in Content-Disposition): the song, the recordings it plays and its release; what stays out of it (Apple loops, a pack’s sounds, a file this computer no longer has) is said in X-Claudius-Note; 404 with no song
POST /api/project?name=FILEa project the demo saved, as the file itself (a .claudius, or the .zip an earlier demo saved: both are zips) with Content-Type: application/zip or application/octet-stream (300 MB at most), named in the query; claudius unpacks it into a song folder of its own under ~/Music/claudius, named after the file, and opens it there; answers with a reply
/mcpthe MCP endpoint
POST /api/phoneserves the page a phone plays along on, with a new key (or answers with the one being served): {"url": "http://192.168.1.23:7879/?key=…", "phones": 0}, also in the state as phone; 503 when the computer is on no network
DELETE /api/phonestops serving it
POST /api/chat/agent{"agent": "claude"} (claude, gemini or codex): starts that agent for the chat, which claudius runs on this computer and talks to over the Agent Client Protocol, in place of one running; the state’s chat.agent names it while it runs. A claudius others reach (--public, a token, --files) says no, as chat.starts_agents does (security)
DELETE /api/chat/agentstops it
POST /api/transportwhere the studio’s song is, {"playing": true, "at": 12.5} (seconds from its start), for the phone’s page to follow; the studio sends it as it plays while the page is served
GET / and anything elsethe web studio; when it is not built, a page that says how to build it

state, since, settled and timeout combine as described below; timeout is in seconds, 20 by default and 600 at most.

Versions and long polling

Two numbers tell a client what changed:

  • version goes up on every change to anything in the state: a log line, the progress of a job, a new render, an edit.
  • song_version is the version at which the song itself last changed. A render belongs to the song version it was made from, in render.version, so the render is current when render.version >= song_version.

A client keeps itself up to date with one request in flight:

curl -s http://127.0.0.1:7878/api/state                 # version 7
curl -s 'http://127.0.0.1:7878/api/state?since=7'       # returns when the version passes 7, or after 20 s

since=N answers as soon as the version is greater than N, and after timeout seconds otherwise, with whatever the state is then. The client takes the version of each answer as its next since. A since ahead of the server’s version, as after a restart, waits out the timeout once and then answers with the current version.

settled=1 waits for something else: that no job is running and that the render is of the current song. That is the moment the verdict describes the song as it is now. When the session renders only on request (--no-auto-render) and no render was asked for, it is settled at once. settled takes precedence over since.

curl -s -X POST http://127.0.0.1:7878/api/command -H 'Content-Type: application/json' \
  -d '{"cmd":"new_song","genre":"house","seed":9,"bpm":126}'
curl -s 'http://127.0.0.1:7878/api/state?settled=1&timeout=120'    # returned after 6.5 s, with the render and verdict

The MCP tools wait the same way after every edit.

The state

GET /api/state returns a State. Here it is after the request above, with long lists cut short:

{
  "version": 7, "song_version": 2, "busy": null, "progress": null, "cancellable": false, "ears_loading": false,
  "can_undo": true, "can_redo": false,
  "undo_label": "new song: Crimson Tide — house at 126 BPM in G dorian (seed 9)", "redo_label": null,
  "log": ["sample library: Apple Loops and your folders",
          "new song: Crimson Tide — house at 126 BPM in G dorian (seed 9)",
          "rendered in 6.3 s: -9.9 LUFS, verdict 92.6 — 93/100 (arc 0.86, mix 0.92, theory 1.00). Fix first: nearly mono (correlation 0.96): widen pads, chords and effects; the drop is only 2.8 LU louder than the breakdown (aim for 3-7): thin the break or push the drop"],
  "genres": [{ "name": "deep_house", "family": "house", "aliases": ["deep", "soulful house", "lounge house"],
               "description": "Deep house: softer four-on-the-floor, ...", "bpm": [118.0, 124.0] }],
  "song": {
    "title": "Crimson Tide", "genre": "house", "seed": 9, "bpm": 126.0, "key": "G dorian", "swing": 0.5257842,
    "bars": 72, "seconds": 137.14285714285714,
    "progressions": [["A", ["i7", "IV9", "i7", "VIImaj7", "i7", "IV9", "i7", "V7"]], ["B", ["i7", "ii7", "i7", "VIImaj7"]]],
    "sections": [{ "name": "intro", "kind": "intro", "start_bar": 0, "bars": 8, "energy": 0.35950592,
                   "layers": ["kick", "hat", "perc"], "prog": "A", "variant": "sparse",
                   "filter_in": true, "build": false, "gap": false, "impact": false, "fills": false }],
    "layers": ["kick", "clap", "hat", "ohat", "shaker", "perc", "bass", "chords", "pad", "lead", "arp"],
    "tracks": [{ "name": "kick", "kind": "drum", "role": "kick", "sound": "sampled bd (tr909:bd)",
                 "level_db": 0.0, "pan": 0.0, "reverb": 0.0, "delay": 0.0, "duck": 0.0,
                 "muted": false, "solo": false, "loudness": -13.0, "fx": [], "bus": "drums" }],
    "drums": [{ "lane": "kick", "pattern_bars": 4,
                "variants": [["main", [0.99353635, 0.0, 0.0, 0.0, 0.9903264, 0.0, 0.0, 0.0]]] }],
    "parts": [{ "name": "bass", "role": "bass", "style": "syncopated", "styles": ["offbeat", "syncopated", "offbeat"],
                "preset": "saw_bass", "presets": ["organ_bass", "pluck_bass", "saw_bass", "sub_bass", "808", "reese",
                "acid", "wobble", "log_drum", "fm_bass", "rubber_bass", "moog_bass", "dist_bass", "deep_bass",
                "salamander:piano"],
                "register": [33, 52], "density": 0.42195085 }],
    "script": "// Crimson Tide — house (seed 9)\n// song(\"house\", 9);   // uncomment to start over from the generator\n...",
    "lineage": ["generated: house seed 9"]
  },
  "render": {
    "version": 2, "url": "/api/audio/2.mp3", "seconds": 137.75695833333333, "lufs": -9.918853251636394,
    "true_peak_db": -1.05, "bpm": 126.0,
    "sections": [["intro", 0.0, 15.238095238095237], ["groove", 15.238095238095237, 76.19047619047619]],
    "waveform": [0.7832023, 0.6933847, 0.24473634, 0.7832023],
    "stems": []
  },
  "verdict": {
    "total": 92.55483794905726,
    "summary": "93/100 (arc 0.86, mix 0.92, theory 1.00). Fix first: nearly mono (correlation 0.96): widen pads, chords and effects; the drop is only 2.8 LU louder than the breakdown (aim for 3-7): thin the break or push the drop",
    "scores": [["arc", 0.8594193282170034], ["mix", 0.92], ["theory", 1.0]],
    "issues": [[0.35, "nearly mono (correlation 0.96): widen pads, chords and effects", "width+"],
               [0.0695062248036405, "the drop is only 2.8 LU louder than the breakdown (aim for 3-7): thin the break or push the drop", "form"]],
    "ears": null,
    "measures": [["arc_correlation", 0.76], ["band_air_db", -18.5], ["band_low_db", -3.4]]
  }
}

State

fieldtypemeaning
versionintegergoes up on every change
song_versionintegerthe version of the last change to the song
songSongView or nullthe open song, null before the first one
renderRenderView or nullthe latest finished render; it may be of an older song version while a new render runs
verdictVerdictView or nullthe verdict of that render
busystring or nullthe running job: "rendering", "listening", "mutating: judging 4 variations", "evolving: generation 2 of 3 done", "saving", or a step of listening to a recording sent with /api/sample, /api/groove, /api/remake or /api/analyze: "taking song.mp3 apart into its voice, drums, bass and the rest", "sampling the voice of song.mp3"
progressnumber or null0 to 1, when the job knows it
cancellableboolwhether busy is a job that cancel stops; a step of listening to a recording runs to its end
ears_loadingbooleanearshot’s models are still loading; until they are, verdicts come from the meters and music theory only
can_undo, can_redoboolean
undo_steps, redo_stepsintegerhow many edits undo can take back, one at a time, and redo can bring back
undo_label, redo_labelstring or nullwhat undo would take back, what redo would bring back
historyDone listthe last 200 changes made to the song, the latest first, as its history keeps them: each change’s id (what go_back takes), its kind (edit, undo, redo, back for a going back, or moved when a save copied the song’s takes into its folder), its label (what undo calls it), what it changed in words (said: “added the whistle track (lead), playing the synth whistle; tempo 124 to 128”), when (at, milliseconds since 1970), and whether go_back can still take the song back to before it (can_go_back)
logstringsthe last 200 lines of the session log, oldest first
genresGenreInfo listevery genre: name, description, bpm range
releaseReleaseView or nullthe release in the making for the song: its details (as set_release takes them), song_title, what the artwork is and its artwork_version, the checks (each a level, problem, warning or note, what it is about and its message) of the render checked, whether it is ready, where the last kit went, and the made_options
pitch_checkPitchCheck or nullthe last pitch check asked of the person: its id, bpm, the notes to play (t and d in beats, p MIDI), where each phrase’s answer goes (answers, beats), how long it lasts (beats), the asker’s note, its status (waiting, taken or cancelled), and, once sung, claudius’ answer
voicestring or nullthe person’s voice as their last pitch check heard it, in words
piecesPiecesView or nullthe auto-sampler’s last offer: the recording, the take’s seed, and its pieces, each with its id, place in the recording, bars, how sung it is, where its phrase is sung (from and to, in seconds) and the section of the recording it is in (“hook 2”), where to hear it as it was cut (raw) and treated, and its treatment in words
chatChatViewthe chat with the assistants: its messages (the last 200, the oldest first; each with its id, higher than the one before, after a clear too, from (null for the person, else who wrote it), text, at in ms since 1970, and reply_to), and the assistant listening now with listening_until (ms since 1970), or null
take_requestTakeRequest or nullthe last take someone asked the person to record: its id, from, role, name and note as request_take gave them, its status (waiting, taken or cancelled), and, once taken, claudius’ answer to the take

SongView

fieldmeaning
title, genre, seed, bpm, key, swingthe song’s settings; key reads like "A minor"
bars, secondsits length
progressions[name, [numerals]] pairs, "A" and "B" in generated songs
sectionsSectionView per section: name, kind, start_bar, bars, energy, layers, prog, variant, the flags filter_in, build, gap, impact, fills, and takes: where it starts in each take it plays, in bars from the take’s start
layersevery name a section can switch on: drum lanes, parts, loops, pattern tracks
tracksTrackView per track: name, kind (drum, part, loop, pattern, fx), role, sound in words, the mix (level_db, pan, reverb, delay, duck, muted, solo), its bus, its chain of effects fx (each as the song keeps it, a map named by fx, as fx() writes it), loudness in the master (LUFS while playing) once rendered, and for a take, seconds: how long its recording is
mixMixView: the buses as [name, effects], the master chain, its lufs and ceiling_db, and the reverb and delay the sends feed
drumsDrumView per lane: lane, pattern_bars, variants as [name, velocities] with one velocity per sixteenth (0 for none), and trigs as [name, [[step, trig]]] for the steps with a trig (prob, cond, ratchet, ramp, flam, nudge, pitch, decay, tone, pan, each only where it differs from its default), and the lane’s own time and feel as lane() sets it: length (sixteenths before it starts again, when it has a length of its own), speed (1), swing (when it has its own), groove and groove_amount (1)
groovesthe names of the grooves the song keeps, heard in recordings or written as tables; lanes play them as they play claudius’ own
partsPartView per generated part: name, role, style, the styles its genre offers, preset, the presets it may switch to, register (MIDI low, high), density, and cycles: for each progression its sections play, then each it has notes written out for and plays nowhere now, prog, the beats its cycle comes round in, whether it is written out, and its notes ({t, d, p, v}, beats from the cycle’s start), as the theory engine writes them or as written
scriptthe song as a script; running it on the song changes nothing
lineagewhat was done to the song, oldest first

The last entry of tracks is always fx, the transition effects (crashes, risers, impacts), whose mix scripts set with mix("fx", ...).

RenderView

fieldmeaning
versionthe song version it was rendered from
url/api/audio/<version>.mp3; the same path ending in .wav gives the 24-bit master
seconds, lufs, true_peak_db, bpmthe master’s length and loudness
sections[name, start seconds, end seconds], for drawing the arrangement
waveformabout 1000 peak values from 0 to 1
stemstrack names with a stem at /api/stems/<version>/<name>.wav (empty unless rendered with stems)

VerdictView

fieldmeaning
total0 to 100
summaryone line: the total, the scores, the first three issues
scores[name, 0..1] for mix, arc, theory, and with the ears genre, production (and refs)
issues[severity 0..1, what, where to fix it], worst first
earsEarsView or null: genre_query, genre_z, best_alt, best_alt_z, production_z, worst_flaw, worst_flaw_z, sounds_like, p_real
measures[name, value] meters: lufs, true_peak_db, band_*_db, stereo_correlation, drop_minus_break_lu, …
fixes{target, label} for each issue one change fixes (the quick_fix command makes it), absent when none

The critic and the ears explains every score, measure and issue target.

Commands

POST /api/command takes one command as a JSON object tagged by "cmd", with Content-Type: application/json. The fields marked optional may be left out.

cmdfieldswhat it does
new_songgenre; optional seed, bpm, key, loops (false), sampled (as the genre is), sample_search, complexity (0 to 1; the genre’s own)composes a new song; sampled builds it on samples from free libraries, sample_search searches for its phrase with your words (Songs built on samples), complexity says how layered it is
loadpathopens a song folder, a blueprint.json, a script file (run on the open song), or a project the demo saved (a .claudius file, or the .zip an earlier demo saved, unpacked into a song folder of its own under ~/Music/claudius)
open_textname, textopens a song from a file’s text, as the studio sends a file chosen on its computer: a blueprint.json’s when name ends in .json, otherwise a script’s; saving makes a song folder of its own
saveoptional path, optional stems (true: each track on its own in stems/)writes blueprint.json and song.rhai now, then the whole folder from a render (see Jobs); default folder: the one the song lives in under ~/Music/claudius (opened from or saved to), else ~/Music/claudius/<genre>-<title>-<seed>
rename_songtitlegives the song another title, an edit undo takes back; a song saved in a folder claudius named moves to the one its new title names, with its history, and is saved there
exportformats (such as ["mp3", "flac:16"]), optional pathwrites the latest render in those formats, when it is of the song as it is now (otherwise: the song has changed since its last render: render it, then export); default folder as for save
set_releasedetails (every field of ReleaseDetails: artist, title, writers, made …), optional artwork (a JPEG or PNG file)replaces what stores are told about the release, and checks it again
write_kitoptional pathwrites the release kit from the latest render, when it is of the song as it is now and nothing stops the release; default release/ in the song’s folder
set_tempobpmas tempo()
set_keykeyas key(): the progressions follow a change of mode
set_swingswingas swing()
set_progressionname, chords (strings)as prog()
set_sectionindex; optional name, bars, energy, layers, prog, variant, filter_in, build, build_style (classic, roll, sweep, riser or drop_out, or several stacked with +, as roll+riser; naming one turns the build-up on), build_amount (0 to 1), build_bars (the bars at the section’s end the build-up takes, 0 for each part’s own length; naming some turns it on), gap, gap_beats (how long the gap lasts, in beats; turns it on), impact, fills, source (where it starts in the song’s takes, in bars from their start: 16.25 is a beat into the 17th bar) and take (the take source is for; every take when not given)changes any of a section’s properties; with source, the section plays the takes from there
add_sectionafter, kind, bars, like (optional)inserts a section of kind after index after, set as the section named like, else as the song’s nearest section of the kind, else as the genre writes the kind (its layers and energy), else, for a bridge, as a bridge of the song’s own (under its neighbours, its drums thinned to those that keep time, on chords of its own that lead into the section after it), else as section after at the kind’s energy; with none of the song’s takes, so that every other section plays the same stretch of them
remove_sectionindexremoves a section (a song keeps at least one)
move_sectionfrom, tomoves a section
split_sectionindex, atsplits a section at bars in (1 to its length less one): the first keeps its name, how it starts and where it plays each take; the second (verse_b) plays each take on from where the section had reached it, keeps how it ends (a build-up, a gap), and starts its chords again from the first
toggle_layersection, layerswitches a track on or off in a section
set_drum_steplane, variant, step, velocitysets one sixteenth (0 removes the hit); a new variant starts as a copy of main
set_drum_patternlane, variant, stepsa whole variant in step notation, as drum()
set_triglane, variant, step (a sixteenth, from 0); optional trigwhat the step does beyond striking, as trig() sets it; no trig clears it, and a step without a hit gets one
set_lanelane; optional length (0: its pattern’s), speed, swing (0: the song’s), groove ("": none), groove_amount, late_ms (-80 to 80: every hit that far behind the beat; ahead, below zero)the lane’s own time and feel, as lane() sets it
set_partname; optional style, preset, register ([low, high]), density, reseed (false), late_ms (-80 to 80)as part(); reseed writes the part again with a new seed
add_trackname (one word of letters, digits, _ and -, not one the song has), kind (drum or part); optional role (a part’s: bass, chords, pad, keys, lead, arp), sounda drum lane, silent until its steps are written, playing sound (a drum voice or a kit’s tr909:bd), as drum() and drum_sound(); or a part of your own, as part() with a role, playing sound (a synth preset or an instrument; the genre’s draw when left out). It plays where the form names it, else in every section with energy 0.6 or more
remove_tracknamea drum lane, part, loop, take or pattern track out of the song and every section, as remove()
set_notespart, prog; optional notes ([{t, d, p, v}], beats from the cycle’s start; velocity 0.8 when left out)the part’s notes over that progression written out, as notes(): they replace what the theory engine writes there (an empty list rests); without notes, the theory engine writes it again, as clear_notes()
set_mixtrack; optional level_db, pan, reverb, delay, duck, drive_db, muted, solo, busas mix()
set_fxtarget (track:<name>, bus:<name>, master, send:reverb, send:delay), fx (effects as TrackView.fx has them; a send takes exactly one)replaces that chain, as fx(), bus(), master(#{ fx }) and send_fx() do; an effect it cannot read is refused with its place and why
run_scriptcoderuns a script on the song
analyzepaththe analysis of an audio file, as text in the reply’s message
song_likeoptional genre, seeda new song like the recording analyzed last, in the genre (the open song’s by default): its tempo, halved or doubled into the genre’s range when it is outside, its key, progressions, form and swing, none of its sound
change_genregenre (any number fused with +); optional seedthe song in another genre, one change undo takes back: its form, chords and key, recordings, written notes, lead melody and pattern tracks kept, the genre’s drums, bass, parts, sounds, swing and mix playing it (Changing the genre)
tunetrack; optional strength, speed_ms, humanize, vibrato, scale (chords, key, chromatic or notes such as "C D E G A"), offa tune effect first in the track’s chain, the one there changed with what is given, or with off taken out (Tuning a voice)
assess_voicetake, or path and optional keyhow a take of the song or an audio file is sung (Your voice), as text in the reply’s message; changes nothing
remakepath; optional genre, seed, bpm, sampled (true), flip (false)a rework of the file in the genre, all of it through in its own sections and on its chords with the genre’s drums and bass under it (Remaking a song from audio); flip: true, a new song of the genre on its hook and pieces of it; sampled: false, a new song on its skeleton only; the genre defaults to the open song’s, and the tempo to the recording’s, or double or half it when that is nearer the genre’s range (half only where the recording holds its chords two bars)
harmonizepart; optional style (block, the default, a chord style: sustain, half, stabs, offbeat, pump, syncopated, charleston, or a comping idiom: skank, gospel, house_piano …), sound, name (<part>_chords)chords under the part’s melody, as a new part that harmonizes it, on in the sections the melody plays in; for block, on the melody’s own sound
generate_trackwhat (drums, percussion, bass, chords, keys, pad, strings, lead, arp); optional genre (the song’s), replace (a part of the song), name (<genre>_<what>), seeda track written the way the genre plays it: a part as the genre’s own part of the role is (its idiom, a sound from its palette, its register, density, voicing and mix), added where the song plays its part of the role or in place of replace (its name, mix and sections kept); the genre’s drums in place of the song’s lanes of their names and beside the others; its percussion beside the song’s drums. Each is another take
vary_tracktrack (a part or a drum lane); optional take (false)a variation of the take it plays (a part’s idiom keeps its cells and draws their details again; a lane is varied a step or two, its strong hits kept), or with take, another take (a part’s seed anew; a lane from the template of the genre it was written as, the song’s or the one its drums were generated from)
swap_soundoptional track (a part or a drum lane), to, only (drums or parts, with no track)another sound for the track: to (one of its swaps, or any synth preset, installed instrument or drum sound), or its next_swap, the next of its swaps no other track plays; block chords under a part change with it. With no track the whole song swaps: the drums onto the next_kit (or to, one of kits) and each part onto its next sound. It runs as part() with a preset and drum_sound(), so every note, pattern and mix setting stays; a part played by a rack runs as rack(), the layers that play the sound it is heard by on the new one and the rest (the sub under a stacked bass) as they were
add_takepath, from (a section’s name); optional name (take1, take2, …), role (vocal, lead, chords, keys, bass, drums, texture; lead)the recording as a take: it plays once from the start of section from and on through the sections after it as long as it lasts; the song keeps a copy
trim_taketrack; optional start (0) and end (its end), in seconds into its recordingthe take cut down to that much of its recording (Takes): it plays from the start of the same section, the sections past its new end drop it, and the recording stays for undo
sample_piecespath (a file, or library:<id>); optional seed (0: the best; any other: another draw), count (phrases, 2, 1 to 4), bars (1 to 8; the fewest of 1, 2, 4 or 8 each phrase fits in), find, kinds (phrase, hook, passage, break, bass, stab; every kind it holds by default)the auto-sampler’s pieces of the recording, the phrases numbered as they come in it, each as it was cut and through a treatment, in pieces (each with its kind and what it scored for, about), before any goes into the song; when phrases were asked for and none could be cut but other pieces could, those are offered and no_phrase says why
redraw_piecesoptional seed (the next take)the same recording’s pieces drawn again, other pieces than the last where there are any
keep_pieceskeep ([{"id": 1, "treated": true, "chopped": false}]); optional sections, every (once, 2, 4, 8, 16 or through; as the song suits)the pieces chosen sampled into the song, each as it was cut or through its treatment, whole or chopped onto pads (chopped), coming round as every says; the offer goes
sample_songpath; optional count (2, 1 to 4), bars (1, 2, 4 or 8; a passage 4, 8 or 16), find (“a person singing”), sections, how (phrases, passage, chops or stabs), every (as for keep_pieces), kinds (as for sample_pieces)samples the recording’s vocals into the song: its best phrases sung whole, those sample_pieces offers first, as loops vox1, vox2 …, placed and mixed; with kinds, the best piece of each kind, kept as its kind plays. The reply says where each came from and went
extract_groovepath; optional name (the file’s), lanes (every drum lane), bpmthe groove of the recording’s drums, kept with the song, and the lanes put in it; its tempo is bpm, else an Apple Loop’s from GarageBand’s catalogue, else one in the file’s name (92bpm), else heard. The reply says the tempo and what it heard
transcribe_drumstake, or path; optional bars (1, 2 or 4; the recording’s, up to 4), variant (main), bpm, keep_take (false)a beat, played or beatboxed, as the song’s drums: its kicks, snares and hats folded into a pattern and written into the kick, snare (else clap) and hat lanes; steps hit only some times round play with that chance; a take goes quiet unless keep_take
add_hitsfrom (a section’s name), hits ([{lane, t, v}]: the lane struck, beats from the section’s start, velocity, 0.8 when left out); optional bars (1, 2 or 4; as much of 4 as was played), variant (main), grid (0.25, a sixteenth; 0 keeps the hits where they were played), start and beats (when the take began and how long it went on, in beats from the section’s start; 0 and its last hit)drums played on pads (a phone’s, a MIDI controller’s) as the lanes they strike, folded into a pattern; a step struck only some of the times round plays with that chance, as hard as it was struck on average
add_scratchfrom (a section’s name), track (one of the song’s tracks, * for the whole mix, or a sample from the library as the phone’s GET /api/library names it, lib:...), optional recording (a record recorded off a microphone in place of the track’s, a WAV file in base64, up to 10 s; mono at 24 kHz, as the phone sends it, keeps a command under its 1 MiB), moves ([{t, at, fader}]: seconds into the scratch, seconds into the record, the crossfader from 0, shut, to 1, open, open when left out); optional bar (0, the first), bars (1, up to 8), name (scratch1, scratch2, …), role (lead)a scratch kept as a take that plays from the start of section from: the track alone over the bars is the record, read back and forth along the moves through the crossfader
transcribe_taketake, sounds (presets or instruments); optional name (melody), role (lead), chromatic (false), keep_take (false), style (line)the take’s melody as notes, played by a new part for each sound; the take goes quiet unless keep_take
add_notesfrom (a section’s name), notes ([{t, d, p, v}]: beats from the section’s start, length in beats, MIDI pitch, velocity, 0.8 when left out), sounds; optional name (played), role (lead), style (line), request (the take request the notes answer)notes played or written, chords and all, as a new part for each sound
request_takefrom (a section’s name); optional role (as add_take’s, or a part’s: pad, arp …), name, note (what to record, for the person)asks the person to record a take: the studio’s Record window opens for it; the request goes in take_request, waiting, and replaces one asked before
cancel_take_requestidthe person will not record the take asked for, as the Record window’s Not now says
chat_saytextthe person writes to the assistants in the studio’s chat (4000 characters at most)
chat_answertext; optional from (who writes: “an assistant”), reply_to (the id of the message it answers)an assistant writes in the chat, as send_message does
chat_listenoptional from, seconds (50, 1 to 300)an assistant listens for what the person writes: chat.listening names it until 20 s after seconds
clear_chatthe chat’s history goes, in the state and in chat.jsonl
request_pitch_checkoptional low and high (MIDI, default 57 and 69), noteasks the person for a pitch check: the Record window opens with its phrases; it goes in pitch_check, waiting, and replaces one asked before
cancel_pitch_checkidthe person will not do the pitch check now
quick_fixoptional target (one of the verdict’s fixes; none: all of them)makes the verdict’s quick fixes as one edit; refused while the verdict is of the song before its last change
mutateoptional count (4, 1 to 32), keep_best (true)a job: tries variations and keeps the best if it beats the song
evolveoptional generations (3, 1 to 20), children (6, 2 to 32)a job: an evolutionary search from the song
install_packsoptional names (the missing default packs when left out)a job: downloads sample packs, as claudius setup does; not the opt-in packs, whose licence is unclear, and not on a shared claudius
renderoptional stems (false)a job: renders and judges the song
undo, redo
go_backto (a change’s id in the state’s history)the song as it was before that change: it and every change since are undone, as that many undos would, and redo brings them back one at a time; refused for a change undo can no longer take back (can_go_back false)
togethersaid (what undo calls it), commands (edits of the song: set_mix, set_tempo, set_key, swap_sound, toggle_layer, remove_track and the other edits, but no undo, redo, go_back or together)the edits made as one change, which the history records as one and undo takes back at once; when one fails, none is made and the song stays as it was. The palette sends it for a request in plain words a person confirmed
cancelstops a mutation or evolution after its current candidate or generation
stop_remaketicket (the one sent with /api/remake)stops that remake wherever it is: under way, its file still on its way, or not arrived yet; it answers stopped, and the song stays as it was
{"cmd": "set_tempo", "bpm": 124}
{"cmd": "set_section", "index": 0, "energy": 0.5, "layers": ["kick", "hat"]}
{"cmd": "set_drum_step", "lane": "kick", "variant": "main", "step": 3, "velocity": 0.6}
{"cmd": "set_part", "name": "bass", "style": "rolling", "reseed": true}
{"cmd": "add_track", "name": "lead2", "kind": "part", "role": "lead", "sound": "saw_lead"}
{"cmd": "add_track", "name": "conga", "kind": "drum", "sound": "tr909:lt"}
{"cmd": "run_script", "code": "tempo(126); mix(\"lead\", #{ level: -2 });"}

set_tempo, set_key, set_swing, set_progression, set_drum_pattern, set_part, add_track, remove_track, set_notes and set_mix are turned into the matching script call and run as a script, so they accept exactly what the script functions accept and fail with the same messages (add_track checks its name first). The other edits change the blueprint directly. Every edit that changes the song is one undo step with a label, and starts a render after 200 ms unless the session runs with --no-auto-render.

Jobs

render, mutate, evolve and save are jobs. A job runs on its own thread, one at a time, and the command answers as soon as it has started. Follow it in busy, progress and log, or wait with settled=1. A mutate or evolve while a job runs is refused, and the refusal leaves the version as it was; render and save wait for the job in progress instead:

{"ok": true, "message": "rendering after the job in progress", "version": 4}
{"ok": false, "message": "busy (rendering); try again when it is done, or cancel it", "version": 4}

A save writes blueprint.json and song.rhai at once. Asked for while the session is idle, it starts its own render; asked for during a job, such as the render that follows an edit, it waits, and the job slot passes straight to it when that job ends, so the session never looks idle in between and settled=1 waits for the save too:

{"ok": true, "message": "saving to /tmp/cl-save2 (blueprint.json and song.rhai now, the audio after the render)", "version": 14}
{"ok": true, "message": "saving to /tmp/cl-save2: blueprint.json and song.rhai now, the audio once the current job (rendering) is done", "version": 4}

Either way the save renders the song as it is when its turn comes and rewrites the whole folder from that render, so the score in it is always the song its audio plays: song.wav, song.mp3, blueprint.json, song.rhai, project.json, report.json, verdict.json, credits.txt when sample packs play, and with "stems": true each track’s stem in stems/ as 32-bit float, about 120 MB a track for a five-minute song. Each file appears only once it is whole, and a write that fails leaves the file as it was. The log then says saved <folder>, or could not save <folder>: <reason>, as when the disk has no room for the folder’s audio and 256 MB to spare:

could not save /Users/me/Music/claudius/house-neon-7: there is not room for it on the disk: it takes about 1.4 GB, and 900 MB is free (the stems are 1.3 GB of it)

cancel does not stop a render that has started.

Replies and errors

Every command answers with a Reply:

fieldmeaning
okwhether the command did what it was asked
messagewhat happened, or why not
versionthe state version after the command
{"ok": true, "message": "new song: Crimson Tide — house at 124 BPM in G dorian (seed 9)", "version": 2}
{"ok": false, "message": "no progression 'Z' (there are A, B)", "version": 11}
{"ok": false, "message": "Runtime error: expected ']', found the end (line 1, position 12)", "version": 11}

A command claudius understood but refused (a bad edit, a script error, a busy session) answers 200 OK with "ok": false, and changes nothing. The HTTP status says when the request itself is wrong:

statuswhenbody
400 Bad Requestthe JSON is not a commanda Reply whose message starts with not a command: and names the unknown cmd or the missing field
401 Unauthorizeda token is required and missing or wrongthis claudius needs its token (Authorization: Bearer <token>, or ?token=<token>)
403 Forbiddenthe Host header is not a loopback name and the server is not --publicclaudius only answers on localhost (start it with --public and a --token to share it)
404 Not Foundno such render or stemno render of version 999, no stem 'kick' in render 13 (render with stems), audio is /api/audio/{version}.wav or .mp3
413 Payload Too Largea command body over 1 MiBFailed to buffer the request body: length limit exceeded
415 Unsupported Media Typea command without Content-Type: application/jsoncommands are JSON (Content-Type: application/json)

Audio

/api/audio/{version}.wav and .mp3 serve the render of song version version, with Range requests, so players can seek:

$ curl -sI -H 'Range: bytes=0-99' http://127.0.0.1:7878/api/audio/13.wav
HTTP/1.1 206 Partial Content
content-type: audio/wav
accept-ranges: bytes
content-range: bytes 0-99/72955106
content-length: 100

The MP3 is encoded on the first request (a second or two for a song) and kept. A session keeps its last ten renders on disk, so older versions return 404. Stems exist only for a render made with {"cmd": "render", "stems": true}, and only the latest render’s stems are served and kept, as 24-bit WAV; the copies a save with stems writes into the song folder are 32-bit float.

The live mix

/api/window?from=S&secs=N mixes N seconds of the song as it is now, from S seconds in, from the tracks the last render made, through the buses, returns and master, at the loudness that render settled (design 0023). The studio asks for one window after another from just after its playhead while the song plays and is newer than its render, so that a fader, a pan or a send is heard as it moves. The body is the song’s version, the window’s first sample and its sample rate, each 8 bytes little-endian, then the samples, left and right in turn, as 32-bit floats:

$ curl -s 'http://127.0.0.1:7878/api/window?from=2&secs=0.5' | head -c 24 | od -A d -t u8
0000000                   14               96000
0000016                48000

When there is no window to be had that way, the answer is a 409 that says why, and the next render plays the song: no song or no render yet, an edit of a track’s own sound (bass changed its sound: the next render plays it), or of the song’s length.

Who may call it

The server is written for one person on one computer, and opens up only when asked. The security model has the reasoning; these are the rules as a client sees them.

Host names. Without --public, every request must name a loopback host in its Host header: localhost, 127.0.0.1 or [::1], with any port. Anything else gets 403, which stops a web page from reaching claudius through DNS rebinding. It is not access control: any program on the machine can send Host: localhost.

Tokens. With --token <secret> (or CLAUDIUS_TOKEN), and always with --public, which makes a token when it is given none, every request must carry the token, in one of three ways:

  • Authorization: Bearer <secret>;
  • ?token=<secret> in the URL, which also answers with Set-Cookie: claudius_token=<secret>; Path=/; HttpOnly; SameSite=Strict, so a browser opened at /?token=<secret> keeps working without it. When the request came through https (X-Forwarded-Proto: https, which tunnels send), the cookie is also Secure;
  • that cookie.

The comparison takes the same time wherever the strings differ. CORS preflight requests (OPTIONS) are answered before the token check, so a browser can ask what is allowed.

Commands are JSON. /api/command refuses any other content type, and the MCP endpoint does the same, so a page on another site cannot send a command with a plain form post or a no-cors fetch.

CORS. Cross-origin requests are allowed from pages served by http://localhost, http://127.0.0.1 and http://[::1] on any port, for GET, POST and DELETE, with the headers Content-Type, Authorization, mcp-session-id and mcp-protocol-version. Pages from anywhere else, including https://localhost, get no Access-Control-Allow-Origin, so the browser does not let them read the answer.

Security headers. Every response carries:

x-content-type-options: nosniff
referrer-policy: no-referrer
x-frame-options: DENY
content-security-policy: frame-ancestors 'none'

so a browser does not guess content types, leak the address in a Referer, or let another page frame the studio.

Exporting

A song’s master is song.wav in its folder, 24-bit at 48 kHz, and every song folder has a 256 kbps song.mp3 beside it. claudius export writes the master in any other format:

claudius export out/deep_house-liquid-avenue-21 --format flac       # liquid-avenue.flac in the song's folder
claudius export out/deep_house-liquid-avenue-21 -f mp3,wav:16,opus   # three files at once
claudius export out/deep_house-liquid-avenue-21 -f mp3 -o ~/Desktop/liquid-avenue.mp3
claudius export ~/Music/mix.wav -f aac --title "Night Bus" --artist "Ana"
claudius export --list                                                # every format, and any this machine cannot write
wrote out/deep_house-liquid-avenue-21/liquid-avenue.mp3 (MP3, 320 kbps, 8.4 MB)
wrote out/deep_house-liquid-avenue-21/liquid-avenue.wav (WAV, 16-bit, 44.1 kHz, 36.9 MB)
wrote out/deep_house-liquid-avenue-21/liquid-avenue.opus (Opus, 160 kbps, 4.3 MB)

The files are named after the song’s title; when two share an extension, the later ones also carry their format (liquid-avenue-mp3-192.mp3). --out names the file for one format, or the folder for several.

In the studio, the Export menu in the toolbar downloads the latest render in any of the formats below, as a file named after the song (the app asks where to save it, a browser downloads it); formats this machine cannot write are greyed out, and say why. An assistant has the export tool, which writes into the song’s folder (or a path), rendering first when the song changed since its last render:

{"formats": ["mp3", "wav:16", "opus"]}

Over the HTTP API, GET /api/export/{version}/{name}.{ext}?format=flac:16 answers with that render as a download named {name}.{ext}, encoded when it is asked for (the latest one is kept for a second request). Command::Export ({"cmd": "export", "formats": ["mp3"], "path": "..."}) writes the files as the tool does.

Formats

formatwhat it writesfor
wavWAV, 24-bit, 48 kHzthe master as it is: mastering engineers, other DAWs
wav:16WAV, 16-bit, 44.1 kHzCD, and distributors that ask for CD quality
wav:32WAV, 32-bit float, 48 kHzmore processing elsewhere
aiff, aiff:16AIFF, 24 or 16-bitLogic, GarageBand and Apple’s other apps
flac, flac:16FLAC, 24 or 16-bitlossless at about four fifths of the size or less: Bandcamp, archives
alac, alac:16Apple Lossless in an .m4alossless in Apple Music and on an iPhone
mp3MP3, 320 kbpssharing, and every player there is
mp3:v0MP3, variable bitrate (about 256 kbps)the same quality in smaller files
mp3:192, mp3:128MP3smaller files still
aacAAC in an .m4a, 256 kbpsApple Music, the iPhone, the web
opus, opus:96Opus, 160 or 96 kbpsthe web: the smallest files at a given quality
oggOgg Vorbis, quality 7games, and players of Ogg

A format is written format[:quality][@rate]:

  • the quality is the bits of a lossless file (16 or 24, or 32 for a float WAV), the kbps of MP3 (32 to 320), AAC (64 to 320) or Opus (32 to 256), v0 to v9 for MP3’s variable bitrate, and 0 to 10 for Vorbis;
  • the rate is @44100 or @48000. A 16-bit file is 44.1 kHz unless you say otherwise; everything else keeps the master’s 48 kHz, and Opus is always 48 kHz.

To 44.1 kHz the master is resampled with a filter flat to 20 kHz that keeps what cannot exist at the lower rate 95 dB down, and 16-bit files are dithered, so quiet endings fade instead of breaking up.

For the web

Every current browser plays MP3, AAC, Opus, Ogg Vorbis, FLAC and WAV; Safari plays Ogg Opus and Ogg Vorbis from 18.4 (macOS 15.4, iOS 18.4). Opus makes the smallest files for streaming, and MP3 or AAC reach the oldest devices. AIFF and Apple Lossless are for Apple’s apps: Chrome and the browsers built on it play neither.

Tags

Files carry the song’s title (or --title), --artist, --album, and the name and version of the claudius that made them: ID3v2 in MP3, Vorbis comments in FLAC, Opus and Ogg. AAC and Apple Lossless carry them when ffmpeg writes them; Core Audio writes none.

How each format is written

WAV, AIFF, FLAC, MP3 and Opus are written by claudius itself, in Rust, and Ogg Vorbis by libvorbis (aoTuV), which is built in: none needs another program. FLAC is encoded frame by frame, each frame in the smaller of two ways of choosing its predictors, or holding its samples verbatim where both would take more; every FLAC is decoded again before it is kept, and stored verbatim throughout if it does not come back exactly. AAC and Apple Lossless come from the system’s encoder: Core Audio on macOS, which is Apple’s own AAC encoder, and ffmpeg on Windows and Linux. Where neither is there, those two formats are unavailable, --list says so, and exporting them fails with AAC needs Core Audio (macOS) or ffmpeg, and this machine has neither.

Measured on a song against the usual encoders at the same bitrate (the spectrum’s difference from the master, in third-octave bands), claudius’ MP3 matches LAME’s at 192 and 320 kbps, and its Opus matches libopus at 160 kbps.

Publishing

Spotify, Apple Music, Amazon Music, YouTube Music, TikTok, Tidal and Deezer take music only from distributors: DistroKid, CD Baby, TuneCore, Amuse, SoundCloud for Artists and others. A distributor’s upload form asks for an audio file, a cover and a page of details, and stores turn a release down for a cover of the wrong size, a sound without a licence or a title in capitals. claudius publish checks a song the way they do, and writes a release kit: the files a distributor takes and every answer its form asks for.

claudius publish out/lofi-hollow-harbor-5 --artwork ~/Pictures/hollow-harbor.jpg \
  --artist "Ana Lima" --writer "Ana Lima" --made assisted --date 2026-12-04
claudius publish out/lofi-hollow-harbor-5 --check     # check again, and write nothing
Hollow Harbor by Ana Lima
  artwork  3000 × 3000 JPEG
  audio    3:12, -12.5 LUFS, -2.3 dB true peak
  made     written with help: an assistant or claudius' generator wrote some of it, and you shaped it

  ..  audio    the master is -12.5 LUFS: Spotify plays it 1 dB quieter and Apple Music 3 dB quieter, as they play songs at about -14 and -16 LUFS
  ..  sounds   Strudel piano (Salamander, one layer), in keys, asks for credit, which release.txt has: Salamander Grand Piano V3 by Alexander Holm (CC BY 3.0), Strudel edition by Felix Roos, https://creativecommons.org/licenses/by/3.0/

wrote the release kit to out/lofi-hollow-harbor-5/release:
  Ana Lima - Hollow Harbor.wav           WAV, 16-bit, 44.1 kHz: the one to upload, which every distributor takes
  Ana Lima - Hollow Harbor (24-bit).wav  WAV, 24-bit, 48 kHz: for distributors that take high-resolution audio
  cover.jpg                              3000 × 3000 JPEG
  release.txt                            what to enter in the distributor's form
  release.json                           the same, for programs

Checks marked -- are problems: a store would turn the release down, so no kit is written until they are fixed, and the command fails. ! marks a warning, worth fixing, and .. a note, worth knowing. --json prints the checks as JSON.

In the studio

Publish…, at the foot of the toolbar’s Export menu, opens the Publish dialog. Drop the cover onto the studio, or Choose a file, fill in what stores ask, and say how the song was made; each field is sent as you leave it, and the checks below, of the latest render, come back with the answer. Write the release kit writes it into release/ in the song’s folder once nothing stops the release. The details and the artwork stay with the song: saving it, or writing the kit, puts release.json and artwork.jpg (or artwork.png) in its folder, and opening that folder again brings them back. In the web studio, the browser reads the dropped cover and sends it to claudius.

The demo has the same dialog. It checks nothing and writes no kit, but it keeps the details and the cover with the song, and its Project file (.claudius) carries them: release.json and artwork.jpg (or artwork.png) beside it. Open that file in claudius, or in the demo again, and they are the song’s release again (Carrying on in claudius). A release.json that names artwork outside the project keeps its details but not that file.

Over MCP and HTTP

An assistant has the publish tool. It passes on what the person said (the artist, the songwriters, the artwork’s file, how the song was made) and gets the checks back, and with write, it writes the kit too:

{"artist": "Ana Lima", "writers": ["Ana Lima"], "artwork": "/Users/ana/Pictures/hollow-harbor.jpg", "made": "assisted", "write": true}

What the tool leaves out stays as it was. Its description, and the claudius-songs skill, tell the assistant to ask the person for these, and never to answer how the song was made for them. Over the HTTP API, set_release sets the details and an artwork file, POST /api/release/artwork takes the artwork as the file itself, write_kit writes the kit, and State.release holds the checks.

The release kit

The kit goes into release/ in the song’s folder, or the folder --out names. Writing it again replaces it, and removes the files of the kit before it, which a new title would otherwise leave behind.

filewhat it is
<artist> - <title>.wavthe master as WAV, 16-bit at 44.1 kHz: the file to upload, which every distributor takes
<artist> - <title> (24-bit).wavthe master, 24-bit at 48 kHz, for distributors that take high-resolution audio
cover.jpg or cover.pngthe artwork, exactly as you gave it
release.txtevery answer the forms ask for, what to say about AI, the credits the sounds’ licences ask for, and the checks
release.jsonthe same for programs, with the artwork’s and the audio’s measurements

release.txt reads like this, ready to copy into a form:

For the form
  Title             Hollow Harbor
  Version           (none)
  Primary artist    Ana Lima
  Featuring         (none)
  Release           Hollow Harbor, a single
  Genre             Hip-Hop/Rap, Lo-Fi Hip-Hop
  Release date      2026-12-04
  Record label      Ana Lima
  Songwriters       Ana Lima
  Producers         (none)
  ℗ line            2026 Ana Lima
  © line            2026 Ana Lima
  ISRC              (leave it empty: the distributor assigns one)
  UPC               (leave it empty: the distributor assigns one)
  Explicit lyrics   no
  Lyrics language   none (instrumental)
  Length            3:12

What you give

Everything you give is kept in the song’s folder as release.json, so the next claudius publish of that song needs none of it again; each flag replaces what it says. A song without one starts from its own title and genre, and takes the artist, songwriters, producers, label and owner from the latest release among the song folders next to it.

flagwhat it is
--artworkthe cover: a square JPEG or PNG, 3000 × 3000
--artistthe name the song comes out under
--title, --versionthe title (the song’s, unless you give one) and a version such as “Extended Mix”
--featuringa featured artist (repeatable)
--albumthe album or EP the song is on; without one it is a single
--genre, --subgenreas stores list them: the song’s genre gives a start (house is Dance, House)
--datethe release date, YYYY-MM-DD
--labelthe record label; the artist’s name when you have none, as distributors advise
--writera songwriter’s full legal name (repeatable): publishing royalties are paid to it
--producera producer (repeatable)
--ownerwho owns the recording and the composition, for the ℗ and © lines; the artist by default
--isrc, --upcthe codes, if you have them; the distributor assigns them otherwise
--explicitthe lyrics are explicit (--explicit false takes it back)
--madehow the song was made: written, assisted or generated (below)

How the song was made

Distributors ask whether a song is made with AI: DistroKid asks whether it includes AI-generated music, vocals or lyrics, and Spotify shows the AI credits distributors send. claudius makes no audio, vocals or lyrics with AI: its sounds are synthesized or recorded. Who wrote the music is the question, and only you can answer it:

--madewhenwhat release.txt says
writtenyou wrote the notes, the parts and the arrangement, with claudius as the instrumentno AI: answer no where a distributor asks
assistedan assistant or claudius’ generator wrote some of it, and you shaped itAI-assisted composition: answer yes, and credit AI-assisted composition where AI credits are asked for
generatedan assistant or claudius’ generator wrote itAI-generated composition: answer yes, and credit AI-generated composition

Until it is said, the release has a problem: every distributor asks, and the answer is yours to give. Release one song at a time, a song you would play to someone: stores remove songs uploaded in bulk to collect plays, and distributors close the accounts behind them.

The checks

Artwork

checkwhy
a JPEG or a PNGproblemstores take nothing else: a WebP, HEIC or TIFF is named, to save again
squareproblemevery store shows covers 1:1
at least 1400 × 1400problemApple Music’s minimum
at most 10000 × 10000problemSpotify’s maximum
3000 × 3000warningwhat stores ask for; TuneCore takes no less than 1600, and CD Baby and TuneCore no more than 3000
RGBproblemCMYK is for print, and stores take RGB only, for black and white art too
full colour, 8 bits a channelwarningSpotify takes 24-bit colour: no palette, no 16 bits a channel
opaqueproblemstores need artwork with nothing see-through; an unused alpha channel is a note
sRGBwarningstores show covers as sRGB, so Display P3 or Adobe RGB colours shift
stored uprightwarningstores ignore the tag that turns a photo, so a turned one shows sideways
JPEG quality 80 or morewarninga lower one shows blocks and smears on a large screen; the quality is read from the file’s tables
sharpwarningstores turn down blurry or pixelated art
at most 10 MBwarningTuneCore’s limit (CD Baby’s is 25 MB)

The sharpness check measures the width of the strong edges in the picture. In a sharp photo or type, the sharpest of them cross in one to three pixels; in a picture enlarged k times, none is narrower than about k pixels. It finds covers enlarged from a third of their size or less, and says what size they look enlarged from. Art that is soft on purpose, glass or mist, has no sharp edges either, so the warning says to ignore it then.

Stores also check what is in the picture, which claudius cannot see, and release.txt lists it: the only text is the artist’s name and the title, spelled as in the form; no web addresses, QR codes, social media names or logos, store logos, prices, or “CD”; an image you made or have a licence for; not the artwork of another release; and nothing blurry, pixelated, turned or cut off.

Audio

checkwhy
30 seconds or longerwarningSpotify counts a play from 30 seconds on, so a shorter song earns nothing there
silence at the start under 2 s, at the end under 5 swarninglisteners expect a song to start, and to end when it does
true peak at most -1 dBwarningstores’ encoders can clip a master above it; master(#{ ceiling: -1.0 }) keeps it under
louder than -14 LUFSnoteSpotify and Apple Music turn songs down to about -14 and -16 LUFS: nothing to fix

Sounds

A release needs the rights to every sound in it, so each recorded sound the song plays is checked against where it came from:

sounds fromwhat it means
packs under CC0, the Unlicense or public domain, and the curated packs with licences of their own (jRhodes, the TR-909 pack)nothing to do: their licences allow music made with them
packs under CC BY (Salamander, Greg Sullivan’s E-Pianos, MuldjordKit, the Strudel piano)a note: credit them, as release.txt does, in the release’s credits or notes and in descriptions
packs whose licence is unknown (Tidal drum machines, Dirt-Samples)a problem: swap those sounds
packs under CC BY-SA (Mridangam)a problem: a song made with them has to be shared under the same licence, which stores rule out
packs that forbid commercial use or new works (NC, ND)a problem
a pack this machine does not havea problem: its licence cannot be checked
a sample map you added, with a licence of its owna warning: read it
Apple Loopsa note: Apple’s licence allows releasing music made with them, though not the loops on their own
your own recordings, and chops of thema warning: release them only if you made them or have cleared their samples

Details

checkwhy
an artistproblemand not “Various Artists”, “Unknown” or the like
how the song was madeproblemabove
one artist per namewarningothers go under featuring: stores add them to the title
a title that is a titlewarningstores turn down placeholders (“Track 3”, “Untitled”), promotion and producer tags (“Free Download”, “Prod. by”), featured artists, capitals and emoji
songwriters, by full legal namewarningdistributors ask for them, and a stage name is not one
an ISRC and a UPC, if given, that are codesproblem12 characters (USRC17607839), and 12 or 13 digits with a check digit
a date that is a dateproblemYYYY-MM-DD; a date that has passed is a warning, one less than four weeks ahead a note: stores take days to weeks, and Spotify’s editors hear songs pitched a week before

Where to send it

Make an account with a distributor, upload the 16-bit WAV and the cover, and copy the answers from release.txt. They all ask much the same; the main differences are what they charge, how much of the earnings they keep, and the stores they reach. SoundCloud for Artists distributes from SoundCloud with an Artist Pro subscription, and SoundCloud and Bandcamp also take the same WAV and cover directly, with the credits in the description.

Sample packs

The sample packs are recordings of real instruments and drum machines, mapped so that claudius can play any note at any velocity with them. Every pack in the default set is under a licence that lets you make and publish music with it. Without packs claudius synthesizes every sound; with them, every new song draws its parts from all the installed instruments that suit its genre (a flute or a vibraphone for a lofi lead, a string section or a choir for a trap pad, a Rhodes or an organ for house chords) and its drums from all the installed kits, so two songs of one genre rarely sound alike. The studio’s Instruments tab offers every instrument that can play a part.

Packs live in ~/Library/Application Support/claudius/packs on macOS and ~/.local/share/claudius/packs on Linux, or in $CLAUDIUS_PACKS. Each pack is a folder with an index.json (its licence, attribution, files and how every instrument maps onto them) and a files/ folder.

The packs

claudius-packs list shows every pack with its state and licence. The 22 default packs hold 254 instruments:

packwhatinstrumentslicencecredit requiredon disk
salamanderYamaha C5 grand piano, 5 velocity layers1CC BY 3.0yes226 MB
epianosWurlitzer EP200, Yamaha CP80, Hohner Pianet T3CC BY 3.0yes21 MB
jrhodes1977 Rhodes Mark I, 5 crossfaded layers1free for making music; no redistribution of the samplesno38 MB
vsco2VS Chamber Orchestra 2: strings, brass, woodwinds, harp, timpani, key-split sections36CC0no284 MB
vcslmallets, bowed vibraphone, wine glasses, pipe organ, ocarina, tenor sax, harmonica, didgeridoo, a TX81Z FM synth, zithers, world and orchestral percussion, effects51CC0no238 MB
tr808Roland TR-808 by Michael Fischer, every knob at five positions16CC0no13 MB
tr909Roland TR-909 by Audio Realism, accent layers and knob sweeps11free for personal and commercial use, no redistributionno26 MB
tr707Roland TR-707, all 15 sounds13public domainno0.5 MB
uzuthe uzu drum kit made for Strudel15Unlicenseno2.4 MB
muldjordMuldjordKit, an acoustic rock kit (bank acoustic)11CC BY 4.0yes135 MB
freepatsupright piano, FM piano, drawbar organ, basses, guitars (clean, jazz and distorted), synth pads, strings and leads (General MIDI’s programs, which a song never draws by itself: a script may name them), glasses of water, a hang22CC0no225 MB
doublebassdouble bass pizzicato with round robins1CC0no30 MB
growlybassSquier Jazz Bass, fingered1CC0no67 MB
voicea low male “ah”, and a 5-voice choir made from it2CC0no27 MB
sonicpiSonic Pi’s samples: kicks, snares, hats, electronic one-shots, glitches, bass hits, drones, vinyl, tabla, loops18CC0no33 MB
solocelloa solo cello, bowed and plucked2CC0no60 MB
erhuan erhu: long and short bows, sul tasto3CC0no43 MB
steelpana tenor steel pan, 5 velocity layers1Unlicenseno38 MB
synthdrumsdrums made on synthesizers after vintage analog kits11CC0no2 MB
bodybody percussion: claps, snaps, stomps, chest and belly hits14CC0no20 MB
zamenhoftwo kits of electronic glitches2CC0no56 MB
miscellaniasound effects: aliens, zaps, sirens, metal, breaking glass, chains, bells, glockenspiel glissandi19CC0no41 MB

The download is about 3.2 GB, larger than the 1.6 GB on disk, because vsco2, vcsl, tr909, doublebass, growlybass, voice, solocello, erhu, body, zamenhof and miscellania arrive as WAV and are converted to lossless FLAC as they install; each conversion is read back and compared with the WAV. Where a pack was cut for size (the piano keeps 5 of its 16 velocity layers, VSCO leaves out the tremolo and muted brass), the pack’s description in claudius-packs list says what was left out.

Two more packs install only when you name them:

packwhatlicence
splendidSteinway grand released into the public domain by AKAI, 4 layers (77 MB)public domain
piano-liteStrudel’s default piano: Salamander, one layer, MP3 (10 MB)CC BY 3.0

Three are opt-in: their licences are unclear or carry conditions, and they install only with --accept-licence.

packwhatwhy it is opt-in
tidal-drum-machinesStrudel’s default banks, about 70 drum machinesno licence is declared and the provenance is unknown
dirt-samplesthe TidalCycles Dirt-Samplesno licence, and some samples come from commercial records
mridangammridangam strokes by Arthur CarabottCC BY-SA 4.0: share-alike may extend to your music

All three install lazily: their samples download the first time a song plays them. New songs never draw from them, as nothing says what you may do with music made with them; choose them by hand in a script (.bank("LinnDrum"), part("lead", #{ preset: "pack:instrument" })) when you know their terms suit you. 0007 Which samples we ship explains how packs are chosen.

Installing

claudius setup                          # the default packs and the listening models, asking first
claudius-packs install --defaults       # the default packs only
claudius-packs install splendid          # one pack
claudius-packs install mridangam --accept-licence
flagwhat it does
--defaultsevery default pack
--lazyrecords the pack now and downloads each sample the first time it plays
--threads Nparallel downloads (8)
--accept-licenceallows an opt-in pack (--accept-license works too)

Curated packs come from their authors’ GitHub repositories at pinned commits, except tr909 (a zip from audiorealism.se) and the FreePats drawbar organ (a .tar.xz from freepats.zenvoid.org), which are unpacked with the system’s tar (or unzip). Each file downloads to a .part file, is checked against its expected size, and is renamed into place, so an interrupted install resumes where it stopped: run the same command again. Installing a pack that is already there downloads only what is missing and deletes files its index no longer uses.

A later claudius can add instruments to a pack (FreePats’s distorted guitar came after the pack’s first release). A pack installed before lacks them, and a synth plays their parts until it is installed again: claudius-packs list shows it as lacks N, claudius doctor names what it lacks, and claudius setup, the studio’s Download the instruments and install_packs fetch only those instruments.

Listing a repository uses GitHub’s API, which allows 60 requests an hour without an account. If an install fails with set GITHUB_TOKEN if the API rate limit was hit, set GITHUB_TOKEN (or GH_TOKEN) to any GitHub token and run it again.

Removing

claudius-packs remove splendid

remove deletes the folder <packs>/<name> and everything in it. It takes a plain pack name, as claudius-packs list shows it, and only for a pack that is installed (its folder has an index.json) or that the registry knows, which covers a half-finished install. Anything else is refused and nothing is deleted:

$ claudius-packs remove ..
Error: '..' is not a pack name
$ claudius-packs remove nonexistentpack
Error: pack nonexistentpack is not installed

Paths are refused the same way as ..: a/b and absolute paths are “not a pack name” too.

Names

A script or a genre asks for an instrument by name, and the installed packs decide what plays:

you writeplays
pianoa friendly alias: the first installed of salamander:piano, splendid:piano, freepats:upright_piano, piano-lite:piano
vsco2:violinsthat pack’s instrument, by name or by one of its aliases (vsco2:violin_ensemble)
tr808:sd:3variation 3 of that instrument
vinyl_scratcha variation by its own name, when it starts with its instrument’s (Sonic Pi’s names): sonicpi:vinyl:3
kick, bd, hha bare drum name: the first installed kit of tr909, tr808, muldjord, tr707, uzu that has it
RolandTR909_bda Strudel bank name: bank RolandTR909, sound bd
bd with bank tr909that kit’s kick

claudius-packs resolve answers what a name plays on your machine, and claudius-packs aliases lists every friendly name with what it resolves to now (264 of them with the default packs):

$ claudius-packs resolve piano
salamander:piano
$ claudius-packs resolve bd:2 909
tr909:bd:2
$ claudius-packs resolve sd acoustic
muldjord:sd
$ claudius-packs resolve theremin
Error: nothing installed matches theremin

In scripts, drum names and synth presets are looked up before the packs, so s("bd") plays the synthesized kick and .s("epiano") the FM synth. Sounds has the full order and the names to use for the recordings.

Banks and variations

A bank is a drum kit picked by name. s("bd*4, [~ sd]*2, hh*8").bank("tr909") plays all three on the 909. Banks answer to the pack’s name and its aliases:

bankalsokit
tr909909, rolandtr909, tr-909Roland TR-909
tr808808, rolandtr808, tr-808Roland TR-808
tr707707, rolandtr707, tr-707Roland TR-707
muldjordacoustic, acoustic_kit, rock_kitMuldjordKit
uzuuzu-drumkituzu drum kit
synthdrumssynth_drums, synth_percussionFreePats synthesizer percussion
sonicpisonic_pi, sonic-piSonic Pi’s kicks, snares, hats and rides, and its other groups
bodybody_percussionbody percussion: stomp, clap, snap, chest, belly, heel …

Drum names have synonyms (kick, kd, bassdrum for bd; snare for sd; rimshot, sidestick for rim; and so on), so s("kick").bank("808") works, and s("bd sd hh").bank("sonicpi") plays Sonic Pi’s bd, sn and hat. A variation picks another recording of the same drum: bd:2 in the pattern, or .n("0 1 2"). The drum machines have many:

  • tr808: every knob at five positions, 25 variations of bd, sd and the cymbal (tone by decay, or tone by snappy), 5 of the toms, congas and open hat;
  • tr909: variation 0 of every drum plays its 11 accent levels as velocity layers; the others are the knob sweeps (125 for bd and sd, 121 for the toms, the decay of the hats, the tuning of the cymbals);
  • tr707: one recording per sound;
  • sonicpi: each group’s sounds, in the order of their names, which they also answer to: vinyl:3 is vinyl_scratch, bd:6 is bd_haus.

claudius-packs instruments shows how many variations each instrument has.

Strudel sample maps

Any Strudel sample map can be added as a pack of your own:

claudius-packs add-map github:tidalcycles/uzu-drumkit       # reads strudel.json on the main branch
claudius-packs add-map github:user/repo/branch/sub/folder   # strudel.json in that folder
claudius-packs add-map https://example.org/samples.json
added tidalcycles-uzu-drumkit (16 sounds, licence Unlicense, lazy)

The pack is named after the GitHub owner and repository (tidalcycles-uzu-drumkit; a curated pack’s name is refused), and installs lazily: each sample downloads the first time a song plays it. Its sounds take the names in the map, so a map with RolandTR909_bd answers to s("bd").bank("RolandTR909"). The licence comes from the map’s _license field or, failing that, from the GitHub repository. When there is none, it is recorded as unknown, add-map prints a warning, and every song that uses the pack says so in its credits.txt. claudius-packs install <name> downloads all of a user pack’s samples at once.

Credits

A song that plays sample-pack instruments gets a credits.txt next to it with the packs it used, and only those:

Sounds:
- E-Pianos (Yamaha CP80, Hohner Pianet T, Wurlitzer EP200) by Greg Sullivan (CC BY 3.0), SFZ mapping by kinwie / sfzinstruments https://creativecommons.org/licenses/by/3.0/
- jRhodes3d by Jeff Learman [jRhodes licence: free for making music (CC0 for musicians); redistributing the samples: CC BY-NC 4.0] https://github.com/sfzinstruments/jlearman.jRhodes3d/blob/master/LICENSE
- Roland TR-808 samples by Michael Fischer (Technopolis, 1994), packaged by TidalCycles [CC0-1.0] https://creativecommons.org/publicdomain/zero/1.0/
- VS Chamber Orchestra 2: Community Edition by Versilian Studios (CC0); recorded by Sam Gossner and Simon Dalzell [CC0-1.0] https://creativecommons.org/publicdomain/zero/1.0/

The packs whose licence requires credit (CC BY) come first, then the others as a courtesy, then a Warning: licence unknown for ... line for any pack without a known licence. When you publish the song, put the lines of the packs that require credit where you credit the music.

claudius-packs credits prints the required credits of every installed pack, and claudius-packs credits piano rhodes bd@tr909 those of the packs behind specific names (name@bank for a drum in a bank).

Auditioning

commandwhat it does
claudius-packs instrumentsevery installed instrument with its range, velocity layers, round robins, zones and variations
claudius-packs render <name> <out.wav> [--bank B] [--notes 60,64,67] [--secs S]renders a chord with one instrument
claudius-packs audition [dir] [--pack P]renders every instrument (an arpeggio, or a few hits for drums, and a beat per kit) into dir (/tmp/claudius-packs-audition), and reports instruments that are silent or seem mapped an octave off
$ claudius-packs instruments
salamander:piano                     piano                pitched   A0..C8   layers 5  rr 1  zones 150  variants 1
epianos:wurlitzer                    electric piano       pitched   A1..G#6  layers 4  rr 1  zones 48   variants 1
vcsl:marimba                         mallets              pitched   F2..C7   layers 1  rr 1  zones 30   variants 1   one-shot
...

Memory

Decoded samples stay in memory once played, up to 3072 MB by default (CLAUDIUS_PACKS_CACHE_MB changes the budget). When a new sample takes the cache over budget, the samples used longest ago that nothing is playing are dropped until it is back to 80 % of the budget; they are decoded again the next time they play.

Apple Loops and your own samples

Besides synthesis and the sample packs, claudius plays three kinds of recordings: Apple Loops when GarageBand or Logic content is installed, cuts of songs you give it, and any audio file a script names.

Apple Loops

Where claudius finds them

GarageBand and Logic keep a database of every installed loop with its tempo, length in beats, key and scale, instrument, genre and mood. claudius reads the newest LoopsDatabaseV*.db in ~/Music/Audio Music Apps/Databases or in GarageBand’s container (~/Library/Containers/com.apple.garageband10/Data/Music/Audio Music Apps/Databases), read-only, and keeps the loops whose files exist. A full install has about 14,000; claudius doctor counts them:

  ok  Apple Loops     14096 loops and samples

The count includes your user library. When there is no database, every Apple Loops feature quietly falls back to synthesis or the packs.

How a song uses them

Drum one-shots. When make, song() in a script, or new_song writes a drum lane, it may cut the lane’s sound from a loop instead of synthesizing it: a kick from a loop whose subtype is Kick, a hat from a Hi-hat loop, a clap from a loop with “Clap” in its name, percussion from Conga, Bongo or Clave loops (a cowbell only where a genre writes one). Loops tagged with a GarageBand genre that suits the song’s genre (Deep House and Tech House for house, Hip Hop for trap and lofi) are four times as likely. The chance is --samples, or samples in song(); it is 0.75 unless you change it, for make, scripts and new_song alike, so the same seed makes the same song everywhere. When the genre puts the song’s drums on a sample-pack kit, the kit wins.

To cut a hit, claudius finds the onsets in the loop and scores each hit by its level, the room before the next hit, how much of the previous hit bleeds into it, and whether its decay suits the lane (long for a kick, short for a closed hat). The best one is trimmed to its decay, faded, normalised to −1 dBFS and cached as a WAV in ~/Library/Caches/claudius/samples/ (~/.cache/claudius/samples/ on Linux), so the loop is read once. The track’s sound then reads like hat cut from 'Silver Hi-Hat 04' (Apple Loops). Whether a lane uses a one-shot is drawn the same way with or without Apple Loops, so the drum patterns of a seed are the same on every machine and only their sounds differ.

Loops. House, deep house and techno have a percussion loop part called top. claudius picks a Drums or Percussion loop of a suitable subtype and genre within 23 % of the song’s tempo (the closer, the likelier), warps it to the tempo, and plays it in the sections that list top. Tonal loops are also transposed to the song’s key by the shortest way, a minor loop to the minor tonic (the relative minor in a major key).

Loop families. make --loops, song("house", #{ loops: true }) and new_song with "loops": true build the whole song around a family of loops produced together: loops in one folder, at one tempo, whose names share a prefix before the instrument word (“Bliss Abyss” in “Bliss Abyss Chord Layers 01”). The song takes the family’s tempo and key, reads the chords of its harmony loop bar by bar from their pitch content (helped by the family’s bass loop), and plays the family’s chords, bass and beat loops as tracks, the way you would start a song in GarageBand. Families with a bass loop and a genre that suits the song are favoured.

Scripts. .bank("apple") cuts drum names from Apple Loops instead of synthesizing them: s("bd*4, [~ cp]*2").bank("apple").

Warping

A loop plays at the song’s tempo and key through Signalsmith Stretch, ported to Rust, which changes tempo and pitch in one pass, in the app and the web demo alike. When the tempo changes by less than 1.5 % and the key not at all, claudius resamples instead (varispeed), which adds no artefacts at all. The loop is stretched as three copies end to end and the middle one kept, so it wraps without a click. Warped loops are cached in ~/Library/Caches/claudius/stretched/.

The licence

Apple’s licence for GarageBand and Logic content lets you use the loops in music you make; read Apple’s software licence agreement for the exact terms. claudius reads the loops where GarageBand or Logic installed them and never copies them anywhere, except the one-shots it cuts, which stay in its cache. It does not redistribute them, and nothing in the claudius repository or its releases contains Apple content.

--no-library (on make, evolve, studio, serve and mcp) keeps Apple Loops and your user library out of the song while the sample packs still play; --synth-only keeps the packs out too; --samples 0 keeps only the one-shots out.

Chopping a song

claudius chop turns a recording into material:

claudius chop ~/Music/reference.mp3 --bars 2

It analyses the song (tempo, downbeat, key, sections), then writes into out/chops/<file name>/:

  • one loop per section, --bars bars long from the section’s first downbeat (01-intro-2bars.wav, 02-drop-...), tagged with the tempo, the length in beats, the key and the section’s energy;
  • a kick.wav, clap.wav and hat.wav, each cut from the sparsest section that still has that instrument.

Each file is added to the user library, ~/Library/Caches/claudius/user/library.json, which claudius merges with the Apple Loops index: from then on, the one-shots can be picked for drum lanes like Apple Loops one-shots are.

--find "a vocal chop" also cuts out the moments that best match a description, using earshot’s search, as find-a-vocal-chop-1.wav and so on (--top of them per description).

Flipping a recording into a song

claudius make --sample <file> builds a song around a recording, the way a producer flips a sample:

claudius make --genre lofi --sample out/chops/reference/03-drop-2bars.wav
  • The recording’s tempo, length and key come from the user library when it is a chop. Otherwise claudius analyses it with the genre’s tempo range and uses 4, 8, 12 or 16 beats of it.
  • It is warped to the song’s tempo and transposed to the song’s key by the shortest way.
  • Six times in ten (when it is at least four half-beat slices long), it is re-chopped: an eight-slice motif that starts each half bar on the slice of the same position and fills the rest with random slices. Otherwise it plays as recorded.
  • It becomes a loop track named sample1 (then sample2 …), with the role sample, ducked under the kick and sent to the reverb, and plays in the drops, hooks and grooves, and in some breaks.

The song’s history records it as flipped '<file>' (<tempo> BPM, <beats> beats, transposed <semitones>), with , re-chopped at the end when it was.

To write a whole new song on another song’s skeleton instead, use claudius remake; see Remaking a song from audio.

Sampling a song’s vocals

The auto-sampler takes the best sung phrases of a recording (a song, an a cappella, a vocal loop) and puts them into the open song, as a producer samples a vocal: claudius sample song.mp3 --on SONG, sample_song for an assistant, or Sample its vocals into the song in the studio’s New song dialog, after choosing the file.

  • Separating the voice. With earshot’s models, claudius first takes the recording apart into its vocals, drums, bass and the rest (Spleeter’s nets, about 8 s for a four-minute song, kept for the next time), and hears the voice on its own from then on.
  • Finding the phrases. claudius finds the recording’s tempo, key and bars (the beats a band plays, when it speeds up and slows down), and the phrases its voice sings whole: each from the quiet before its first word to the quiet after its last, so that a cut never falls inside a word or a held note, in the fewest of its bars that hold it (1, 2, 4 or 8; --bars asks for one of them, and a phrase longer than that is parted at its longest rest, or left out). It scores them as the Sample window does: how much of each holds a pitch in a voice’s range, A2 to C6, and how much of its sound is the voice (with the voice apart, its share of the phrase; else how much sits in the middle of the stereo picture, where a voice is mixed), a longer phrase a little more. With the ears, it also listens to each for “a person singing” (or what --find says, such as “a rap verse”), and their reading leads. It keeps the best two (--count, up to four), no two overlapping: the phrases Pieces of it offers first.
  • Cleaning them. With the voice apart, each phrase is the voice as it was sung and mixed, in stereo, its rumble under 90 Hz out. Without it, each keeps the middle of the stereo picture and its sustained part, without what strikes (the drums, by harmonic-percussive separation), above 160 Hz and below 11 kHz. Either way, at −1 dBFS, faded in and out, and as long as its bars were played, each made one tempo.
  • Fitting them. Each becomes a loop of its own, vox1, vox2 …: the phrase, then the bars of silence before it comes round again, warped to the song’s tempo and moved to its key by the shortest way, as a flipped sample is. A change of the song’s tempo or key moves it too. A voice is always stretched, never sped up or slowed down, and moved to the key with its formants (the resonances of the singer’s throat) kept where they were, so that three semitones down it still sounds like the same singer, not a giant, and three up not a chipmunk. Any track with the vocal role is warped this way, a take you sang as well.
  • Placing them. The phrases go where a vocal suits the song: the drops and hooks first, then the breaks, the verses and grooves, the builds (--in names the sections or kinds). In each place, a phrase plays from the section’s first bar or answers from the bar after, whichever its notes agree with better: its pitch profile against the chord tones under each time it plays. It plays only in the sections with room for it (an answer needs room after the phrase it answers); when no section asked for has room for a phrase that long, nothing is sampled and the reply says so.
  • How often. A phrase comes round as --every says (every for an assistant): once from the start of each of its sections, 2, 4, 8 or 16 (once every so many bars, silent between), or through (all through each). Said nothing, the song decides by its genre and by what its sections play: once in each section where a lead or a voice sings already, as two melodies at once say neither; else every other time round, answered, in a genre built on samples (those that sample by default: boom bap, lo-fi, trip-hop, jazz rap, chipmunk soul, filter house and others), whose producers loop what they sample; and once every 8 bars in the rest, a voice that comes back now and then. The reply says which, and why.
  • Mixing them. A phrase is mixed as a vocal (−15 LUFS while it plays, a little under): high-passed at 200 Hz, a little presence at 3 kHz, compressed 3:1, with some reverb and delay and a light duck under the kick. A lead that plays with it steps back 1.5 dB, once: a lead that already plays beside a phrase sampled before stays where it is.

The phrases are kept with the song, in takes/ in its folder, and go with it when it is saved elsewhere or its folder moves, as takes do. The reply says what came of it in its first line (which the studio’s toast shows, and undo names), then where each phrase came from and went:

sampled 2 phrases of Many Miracles Vocal Melody.caf into the song: vox1, vox2
vox1: bar 6 of Many Miracles Vocal Melody.caf (the ears +2.0 for 'a person singing', 60% sung), in its own key at 122 BPM, once in each of the drops and hooks (drop), from the first bar, as a lead or a voice sings there already, on chords it agrees with 74%
vox2: bars 11-12 of Many Miracles Vocal Melody.caf (the ears +1.9 for 'a person singing', 54% sung), in its own key at 122 BPM, every 8 bars from the first bar in the breaks (break), now and then, as house is not built on samples, on chords it agrees with 83%

Other ways to sample

Phrases that come round are one way producers sample a recording. The auto-sampler knows four more, which --how asks for (how for an assistant); phrases are the way when none is said:

  • Its vocals (--how vocals): the recording’s whole voice, taken apart from the band, sung through the song from its first downbeat to its end, as a remix puts a song’s vocals over a new beat. The song’s sections follow the recording’s bar for bar, so that its verses sing over the song’s verses and its choruses over its hooks, whole: each section is built from the song’s own section of its kind (a verse from its verse, a chorus from its hook, else the one nearest in energy), on the recording’s chords, at its tempo (or the multiple of it the song’s genre plays, so that the voice keeps its own speed and pitch) and in its key. The song keeps its own drums, sounds and mix, and the voice plays on a track of its own, vocals, each section keeping its stretch of it when sections are added, moved or taken out later. It needs the voice apart from the band, which the ears do: the desktop app and the command line with the listening models; in a browser claudius says it cannot yet.
  • A passage (--how passage): a whole stretch of the recording, 4, 8 or 16 bars of its best sung part (--bars; 8 where a section has room for them, else 4), the better where one of its own sections starts, played through as the verse or chorus of the sections it goes in: the drops and hooks, unless --in says. It is the voice alone when claudius can take it apart, else the record as it plays with its lows out, so that the song’s bass and kick play under it. The song’s chords in those sections follow the passage’s, moved into the song’s key as the passage is, when the recording plays chords there and the analysis heard the chord of every bar of it; the reply names them. An a cappella plays none (with its voice apart, what is left under it is all but silent), and the song keeps its own. A trance record is built on a vocal this way, and a hip-hop beat on a soul record’s chorus.
  • Chops (--how chops): the best sung phrase (--bars 1, 2 or 4; 2 when none is said) cut in eighths of its beats, and the six slices that hold the most voice played in a new syncopated rhythm, two bars round, the second moving the motif on and ending in a stutter. It is a track of its own, chops, in the drops and hooks: the voice as an instrument.
  • A stab (--how stabs): one short hit of it, the sharpest syllable of its best phrases (80 to 350 ms), on a drum lane of its own, vox_stab, struck on a few beats of every two bars and moved to the song’s key, in the drops and hooks and the verses. Its rhythm is a drum lane’s: change its steps in the Drums tab, or with set_drum_pattern.

The auto-sampler takes other kinds of piece too, chosen as Pieces of it offers them first (below), without a window to choose in: --kinds break,bass (kinds for an assistant) samples the best drum break and the best bass line of the recording, each kept as its kind plays, and phrase among the kinds adds --count phrases. With --how chops, each is chopped onto pads instead. To hear the pieces and choose among them, use the window, or sample_pieces and keep_pieces.

sampled a passage of Many Miracles Vocal Melody.caf into the song: passage
passage: bars 1-8 of Many Miracles Vocal Melody.caf, its voice (the ears +2.7 for 'a person singing', 35% sung), 5 semitones up into F minor at 126 BPM, played through from the first bar of the drops and hooks (drop, drop2), the song's chords there following it (i i7 III iv7 i7 v7 i i7)

In the studio, the Add a recording window offers each way as a card under How should it go in?: Its vocals, Whole, Its sung phrases, Pieces of it (every kind of piece of it, below), A passage, Chops and A stab. For Its vocals the window says what it does to the song, and Put its vocals in the song does it (undo takes it all back). For the others, Plays in chooses the song’s sections it goes in (none chosen: where it suits), and the button at the foot (Sample a passage, Chop it, Sample a stab) puts it in. In the New song dialog, Sample it into the song takes a way too. In a browser, which cannot take the voice apart from the band, Its sung phrases are found in the whole mix and come out rough, many shorter than a sung line (on JamendoLyrics’ 79 songs, 46% of them under a second and a half, where the songs’ lines run 3 seconds), and the window says so; the desktop app takes the voice apart first and finds its phrases whole.

What the window hears first

As soon as the window holds a recording, claudius listens to it, as analyze does, and the window shows what it heard before anything is asked: its length, tempo and key, whether a voice sings in it, its sections over its waveform, and each phrase its voice sings, marked where it is. Click a phrase to hear it. A recording chosen from a free library is fetched and heard the same way.

Choosing the pieces first

With Its sung phrases chosen, Choose its phrases → opens the Sample window instead of sampling straight away: up to four pieces the auto-sampler found, each a phrase sung whole, numbered as they come in the recording and marked on its timeline, to hear as it was cut (cleaned of the recording’s drums) and through a treatment, side by side. A piece is cut in the quiet before the phrase’s first word and after its last note has died away, never inside a word, and takes the whole bars of the recording the phrase is sung in, silent outside it. The treatments are a producer’s: dusty tape over vinyl crackle, an echo into a long hall, lo-fi crushing, a slow phaser over a chorus, a telephone’s band, a stutter on the last beat, a reversed tail. Press ▶ as cut or ▶ treated to hear a piece (… while it is on its way), tick the pieces you want (on the list or on the timeline), and choose as cut or its treatment for each; the two most sung start ticked, as they were cut. Each time says how often a phrase comes round in its sections: As the song suits (the default, as above), Once, as it starts, Every 4 bars, Every 8 bars or All through it. Put 2 phrases in the song puts the ticked ones in, in the sections chosen in Plays in, a treated one through its treatment, and closes the windows; ← back returns to the ways, and Cancel closes it with nothing added. Other phrases draws other phrases among the good ones, with other treatments. When a piece cannot play, the window says why.

An assistant does the same with sample_pieces (the recording’s path, or library:<id>; seed, count, bars, find, kinds), which lists the pieces, where each is in the recording’s form (“in hook 2”) and where to hear it, redraw_pieces for another take, and keep_pieces with the pieces to keep, whether treated, and how often they come round (every, as above).

With Pieces of it chosen, Choose its pieces → opens the Sample window with every kind of piece the recording holds: its sung phrases, then, under Its drums, bass and loops, the best piece of each other kind and more of a kind where they differ (below), each saying what it is and why it scored as it did (“Drum break · Intro, bars 1-2”, “the drums alone, busy, it loops cleanly”). None of those starts ticked; tick the ones you want, as for a phrase. A piece ticked goes in whole, or on pads, chopped at its hits. When it has no phrase to offer (no voice sings in it, say), the window says why above the other pieces. Another take draws other pieces of each kind among the good ones, other than those it offered last. Besides its phrases, sample_pieces offers the same, as producers sample records (design 0021), each cut on the recording’s bars:

KindWhat it isKept, it plays
hooka loop of 1 to 8 bars of its hook, from the sections with chords that pull most toward being one (its choruses, its drops), without its drums, bass and voiceall through the drops and hooks, in the song’s key
passagea loop of 2 to 8 bars of another passage with chords, from none of the hook’s sectionsall through the other sections but the intro and the outro
breakits drums, 1, 2 or 4 barsas a drum loop where the song’s drums play, at its own pitch, cut onto the song’s grid when its tempo is far from the song’s
bassits bass line, 1, 2 or 4 barsin place of the song’s bass, in the song’s key
stabone hit of its instruments’ chords and a beat of it, the hit that comes in hardest and rings its beat alonestruck as a drum is, on a few beats of every two bars, by a drum lane of its own (stab), in the song’s key, all through it but its intro and outro

Each is scored as its kind: how alone what it is cut from plays in its bars, how well it loops (its first beat against the beat after its end), and what its kind asks besides (how busy a break is, how much a bass line moves, how often a hook comes back and how much its section stands out, how unlike the hook another passage is, and a stab how hard it comes in, at one of SuperFlux’s onsets, and how cleanly its beat rings on). Each says why, in words (“the drums alone, busy, it loops cleanly”), and goes into the sections keep_pieces names, when it names any; a phrase kept with no room in them leaves the other pieces kept, and the reply says why it did not go in. kinds asks for some only (phrase, hook, passage, break, bass, stab); a recording no voice sings in, or none of whose phrases fits the bars asked, offers the rest and says why there is no phrase. They come from the recording’s stems when earshot separates them; without its models, a break and the loops come from the mix’s percussive and harmonic parts, and a bass line, which the mix does not give apart, is not offered.

What is offered is varied as well as good. Besides the best of each kind come up to two more of the kinds producers sample most (of 42,447 samples on WhoSampled, 37% are drum loops and 34% bass lines: Bryan & Wang, ISMIR 2011), and of those the song’s genre samples (a house song leans toward breaks and hooks), each only where it is good and unlike those already offered: a recording’s sparse groove and its busy one, never two cuts of one groove. Asked for one kind, it offers up to four of it. Another take draws other pieces than the take before, where there are any. Several pieces of a kind kept with no sections named share the sections their kind plays in, the fuller in the louder, so that none plays over another.

Behind the window are POST /api/sample/pieces (the recording itself), the state’s pieces, each with where its phrase is sung (from, to) and the section it is in, and GET /api/pieces/<file> for each piece to hear (HTTP API). What analyze hears in a recording says where its voice sings each phrase too (phrases). The online demo offers pieces the same way, in the page.

Without earshot’s models, it goes by the pitch and the stereo picture alone: in a full mix, a lead synth held in the middle can then pass for a voice. Sample only what you may use: a recording of someone else’s song needs their permission before you release what you made with it.

Chopping a piece onto pads

A break, a loop or a phrase kept chopped (keep_pieces with "chopped": true) is cut at its onsets, as producers chop a record onto a sampler’s pads. SuperFlux hears the onsets (Böck & Widmer, DAFx 2013): how much each of 24 bands an octave rises over the same bands a moment before, which the wandering of a vibrato does not set off. The hits that sound as one share a pad (its kicks, its snares, its hats), eight pads at most, and each pad is a drum lane of its own (chop, chop2 …) that strikes it where its hits came and as hard, straight and with none of the song’s groove, so that the lanes play the piece as it was. Each hit plays at its own speed, so a break played at another tempo keeps every hit whole, as no loop stretched to fit it does. Then play them otherwise, in the Drums tab or from a phone. A phrase chopped plays in the drops and hooks, as chops of a voice do, and a piece with too few hits to chop says so.

Takes

A take is a recording made for the song: a vocal, a guitar, a melody sung into a microphone. Wherever a command takes a recording’s path, take:<name> names one the song keeps (a take, a rework’s vocals or original, a phrase sampled into it), and stems:<part> a part of the recording claudius heard last, as its analysis took it apart: stems:vocals, stems:drums, stems:bass, stems:other, or stems:recording for the recording itself. A loop starts over in every section it is in; a take plays once, from the start of the section it was recorded over, and on through the sections after it for as long as it lasts. Each section keeps its own stretch of it: add, remove or move a section and the others play what they played, and a section you add plays none of the takes until you turn one on in it. Record one with the studio’s Record button. When you stop, the take waits for you: Play it back plays the song from a bar before it with the take in it, Record again records it over, Keep it adds it to the song, and Throw it away forgets it. Or bring an audio file: drop it on the studio, or press the + button after Record and choose it (or search the free libraries there for one), and Add it whole as a track in the window that opens adds it as a take from the section you pick (Sample its vocals… offers its sung phrases to choose from instead, as above describes). A whole song works too, to trim and put effects on as you like. You can also send the file to the HTTP API, or give it to an assistant, which adds it with add_take:

curl -X POST 'http://127.0.0.1:7878/api/takes?from=drop&name=vox&role=vocal' \
  -H 'Content-Type: audio/wav' --data-binary @vocal.wav
  • The mix. The take is mixed like any track, at the loudness of its role: vocal (-15 LUFS while it plays), lead (-18, the default), chords, keys, bass, drums or texture. The critic hears it with the rest.
  • Where it is kept. claudius keeps each take as 24-bit FLAC, named after its sound, in takes/ in the song’s folder, or in ~/Music/claudius/takes while the song has no folder yet. A save copies the song’s takes into the folder it writes, so a song folder carries its recordings, and a song folder that moved or came from another computer finds them in its own takes/.
  • Tempo and key. When the song’s tempo changes, the take is warped to it, between silences rather than wrapped around as a loop is. It does not follow a change of key.
  • The arrangement. The take is a track of kind take, on in the sections it reaches. toggle_layer turns it off in a section, which silences that stretch of it. In a section before the one it starts with, it plays nothing.
  • Trimming it. Trim… in its track’s menu in the arrangement (right-click its name) keeps part of the recording, from a start to an end in seconds, so that it starts later in itself or stops sooner (trim_take, with track, start and end). It still plays from the start of its section, and the sections past its new end drop it. claudius keeps the cut beside the recording it came from, so undo brings the take back whole. Effects go on it in the mixer, as on any track.
  • Releasing it. Publishing lists takes with your own recordings: release them only if you made them or have cleared their rights.

A take an assistant asks for

An assistant can ask you to record something for the song (“sing the hook over the chorus”), with request_take. The studio’s Record window opens, set up for it: the section the take starts with, what it is, its name, and a line saying what the assistant asked for. When no studio is open, the assistant gives you a link that opens one, such as http://127.0.0.1:7878/?record=1.

Record the take, play it back, and record it again as often as you like. Send it adds it to the song, and the assistant, which has been waiting for it with wait_for_take, hears what claudius made of it and goes on from there: it sets the take’s level, or turns it into notes. Not now tells the assistant you will not record it. Notes played on a MIDI keyboard answer the request as soon as you stop.

Turning a take into notes

A melody sung, hummed, whistled or played one note at a time can become notes, which any instrument then plays: in the studio, right-click the take’s row in the arrangement and choose Turn the melody into notes; over MCP, transcribe_take. claudius reads the notes the take means, as Your voice says, and puts them in the song’s key (unless chromatic) and on its sixteenth-note grid. They become a new part named melody, a lead unless told otherwise, on in the sections the take plays in, and the take goes quiet. Several sounds make one part each, so a set of instruments plays the same line: "sounds": ["piano", "strings"]. The parts are ordinary parts afterwards, whose sound, level and sections you change as you would any other’s.

  • One note at a time. Chords, a strummed guitar or a full mix are heard as no melody, or a confused one.

  • The notes follow the sections. Each section the take covers keeps the stretch of melody sung over it, by its progression. Another section with that progression plays the same notes, and a section the part is turned on in later, which the take never covered, has the part write its own.

  • A style. style turns the line into something else, in the song’s key, and gives the part the role that goes with it unless you give one:

    stylewhat playsthe part
    line (the default)the line as sunga lead
    harmonythe line, and a third above each notea lead
    octavesthe line, doubled an octave downa lead
    chordsa triad under each note, the note on topchords
    bassthe line, moved by octaves into a bass’s registera bass
    arpeach note broken into a rising arpeggio of sixteenthsan arp
    pada chord held through each bar the line sounds in, on the note heard as the bar beginsa pad

    In the studio, the take’s menu lets you pick one before the sound.

Turning a take into drums

A beat, played on a kit or beatboxed into the microphone, can become the song’s drums. In the studio, right-click the take’s row in the arrangement, choose Turn it into drums and a length (1, 2 or 4 bars); over MCP, transcribe_drums. claudius hears each hit, names it a kick, a snare or a hat, and sets it on the song’s sixteenth grid from the take’s first beat. It folds every time round into a pattern of that length, writes it into the song’s kick, snare (or clap) and hat lanes as their main patterns, and the take goes quiet. A step you hit only some of the times round plays with that chance, as a trig. The lanes are ordinary lanes afterwards: change a step in the step sequencer, give it a trig, or put the lane in a groove.

  • How it hears. A kick adds most of what it adds under 150 Hz, a hat over 5 kHz, and a snare, a clap or a beatboxer’s “k” in between. claudius finds those three among the take’s own hits, so a mouth’s kick and a kit’s both sort as kicks. A hat struck with a kick is both.
  • What to check. It hears a kit or a clear beatbox well, and gets some hits wrong: the release of a beatboxed snare can come out as a kick a step later, and a snare layered with a sub as a kick. The step sequencer shows what it wrote; right-click a step to change it.
  • A recording of drums. A drum loop or a break goes in the same way, as transcribe_drums with a path, or drums_from() in a script. Its tempo is the one given, or one in its file’s name (92bpm), or heard, and the grid starts at its own downbeat.

Notes played on a keyboard

What you play on a MIDI keyboard in the studio’s Record window, chords and all, becomes a new part named played, which the instrument or synth you choose plays. The notes go onto the grid you choose, or stay as played. Over the HTTP API and MCP, add_notes does the same with notes given one by one: t and d in beats from the start of section from, p a MIDI pitch (60 is middle C) and v a velocity from 0 to 1. Like a take’s melody, the notes go into the sections they reach, by each section’s progression, and a style makes them harmony, octaves, chords, a bass line, an arpeggio or a pad, as above.

Drums played on pads

Drum pads on MIDI (a pad controller, a drum app sending MIDI from a phone or tablet) play the song’s drums: in the Record window, choose drums for what a MIDI take is. Each note is a drum of the General MIDI drum map, which pads and drum apps send (36 the kick, 38 the snare, 39 the clap, 42 the closed hat, 46 the open hat, 37 a rim), played on the song’s lane of that drum, or of one that stands in for it (a clap for a snare, a closed hat for an open one). The take becomes those lanes’ main patterns, folded as a beat played or beatboxed is, and the window says what had no lane in the song. Over the HTTP API and MCP, add_hits does the same with hits given one by one: the lane struck, t in beats from the start of section from, and v. A phone plays the song’s pads, keys and turntable from the phone’s page too.

Files in scripts

A script plays any audio file through .s() on a note(), n() or chord() pattern:

track("vox", note("c4 ~ c4 [c4 c4]").s("/Users/me/Samples/vox.wav"));
  • The file plays like a sampler: c4 at its recorded pitch, other notes faster or slower.
  • On a track whose role is not a drum role, each note stops at its length plus 50 ms; drum roles play the whole file.
  • A name counts as a file when it contains / or ends in .wav, .mp3, .aif, .aiff, .flac, .caf, .m4a, .aac, .ogg or .opus. It cannot go inside a mini-notation string, where / means “slower”.
  • claudius decodes WAV, AIFF, FLAC, MP3, AAC and ALAC (M4A), CAF, Ogg Vorbis and Opus (in Ogg, WebM or MP4) itself: every format it exports, and more. It asks ffmpeg for anything else when it is installed.

The song stores the file’s path, not its audio, so moving or deleting the file breaks the song. Every decoded file is cached as raw 48 kHz audio in ~/Library/Caches/claudius/decoded/ (about 23 MB per minute of stereo), keyed by its path, size and modification time.

What a shared claudius may read and write

A claudius only you can reach reads and writes wherever you ask. A claudius others can reach checks every path it is given against a list of folders:

how it runsthe folders
claudius serve --public, claudius serve --host with an address other than loopback, or claudius serve --files <dir>~/Music/claudius, claudius’ cache folder, the sample packs folder, the online samples folder, /Library/Audio/Apple Loops, ~/Library/Audio/Apple Loops, plus every --files folder
anything else (studio, serve, mcp)no limit

The checks:

  • Reading. A file named in .s(), opened with load / open, or given to analyze, remake, add_take or sample_song must exist and, after links and .. are resolved, lie inside one of the folders. Opening a blueprint.json also checks every audio file the song plays.
  • Writing. save may create a folder when its nearest existing parent lies inside one of the folders and the rest of the path is plain names, so <allowed>/../escape is refused.

Refusals name the path. A path outside the folders gets the same answer whether or not it exists, so a shared claudius does not tell anyone which files you have; does not exist is said only of a path inside them. The last line comes from a claudius whose sample packs folder was /tmp/claudius-packs-demo (CLAUDIUS_PACKS):

/etc/hosts is outside the folders this claudius may read
/tmp/cl-elsewhere is outside the folders this claudius may write
track 'v': /etc/hosts is outside the folders this claudius may read
track 'v': /tmp/claudius-packs-demo/nope.wav does not exist

A folder that does not exist yet is not on the list: until something creates ~/Music/claudius, a shared claudius refuses to save there (Troubleshooting). Sample-pack instruments and Apple Loops are found by name, not by path, so they play in every mode. The security model explains the policy and its limits.

Samples from free online libraries

Drum breaks, vinyl crackle, field recordings, old records, stems: claudius finds them in free online libraries and downloads them, keeping only what their licences let you make and publish music with.

claudius samples search "vinyl crackle"
claudius samples get freesound:383762

The libraries

librarywhat it hashow claudius asks
Openversean index of Freesound’s sounds (breaks, loops, one-shots, textures, field recordings), Wikimedia Commons’ recordings and Jamendo’s songsits API, without a key: 20 searches a minute, 200 a day
Wikimedia Commonsrecordings Openverse leaves out: old records, orchestras, instruments, free stemsits API
ccMixterstems, a cappellas and samples shared to be remixedits API

Each search asks all three, unless --source names some. Openverse returns Freesound’s high-quality previews (MP3 at about 128 kbps), which is what claudius downloads from it.

The licences

A search keeps what you may publish music made with, with at most a credit, as for sample packs:

licencekeptwhat it asks of you
CC0, a public domain mark from the authoryesnothing; claudius credits them anyway
CC BYyescredit, which claudius writes into the song’s credits.txt
public domain by age (records from before 1926, say)with --us-public-domainnothing in the United States; elsewhere the tune on the record may still belong to its composer’s heirs, for 70 years after the composer’s death
CC BY-SAwith --share-alikethe music made with it must carry the same licence
non-commercial or no derivativesnever

The libraries record the licence each uploader chose. An uploader cannot give away a record they do not own, so claudius also leaves out uploads whose own titles or tags say they were cut from someone’s record (“sampled from”, “70s sample”, “vinyl rip”). That is a guard, not a guarantee: a sound you plan to publish is worth a look at its page, which its credit links.

Searches also leave out the recordings of papers’ supplementary material, which a bot imports to Wikimedia Commons under the names their journals give them (…-pone.0062397.s008.oga, …_MOESM1_ESM): a vowel recorded for a study of voices holds a note, but it is no music. The studio demo’s searches leave them out too.

0010 Samples from online libraries records why these libraries and not YouTube, Spotify, Apple Music or SoundCloud.

Where they go, and credits

A sound downloads into the samples folder, <data dir>/claudius/samples/<library>/ (CLAUDIUS_SAMPLES moves it), with a .json beside it: its title, author, licence and page. claudius samples list lists them.

A song that plays one, through .s("/path/to/the/sound.mp3") in a script or anywhere else a file can be used, credits it in its credits.txt:

Samples:
"Crunchy Drum Break 2 [128bpm]" by deadrobotmusic, CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/), https://freesound.org/people/deadrobotmusic/sounds/629052
"Bauchamp - 130 old drum break" by Bauchamp, CC0 (http://creativecommons.org/publicdomain/zero/1.0/deed.en), https://commons.wikimedia.org/wiki/File:Bauchamp_-_130_old_drum_break.ogg

A scratch is a take of a record cut from the song, so it keeps the credits of what that record held (a sampled phrase, a break, a sample pack’s instrument) beside its file, <take>.flac.sources.json. The song’s credits.txt names them for as long as it plays the scratch, even once it no longer plays the tracks the record was cut from.

A take or a phrase cut from a downloaded recording credits it the same way, beside its file: adding one with add_take or sampling it with sample_song keeps its credit with what the song plays.

A claudius shared with others may read the samples folder, as it reads the sample packs (What a shared claudius may read and write).

Choosing one in the studio

The studio’s Add a recording window (the + after the record button) searches the same libraries: type a few words and press Search, press ▶ beside a recording to hear it, and Choose to hold it. Then Add it whole as a track adds it as a take to trim and put effects on, and Sample its vocals… offers its sung phrases to hear and choose. Either way claudius downloads it once into the samples folder, and the song credits it. Behind the window are GET /api/library/search?q=WORDS and GET /api/library/audio?id=ID (HTTP API).

Wherever a command takes a recording’s path (add_take, sample_song, analyze and remake), library:<id> names one a search found: claudius downloads it and uses the file. An assistant searches with search_recordings, which lists each as library:<id>:

library:freesound:629052  "Rain on a window" by Someone, CC BY 4.0, 64 s (https://freesound.org/s/629052/)

A claudius that may not write its samples folder (one shared with --files elsewhere) answers that it keeps no recordings from the libraries.

Songs built on samples

A song of any genre can be built on samples, as records built on samples are: a phrase from a recording that the song is built on, a drum break, and a texture under it, and in some genres a sung note chopped for a part or a bass note the song’s bass plays on. Trip-hop, boom bap, lo-fi, jungle, big beat and filter house are by default, as their records are; a song of another genre is when asked:

claudius make --genre trip_hop                            # gathers what trip-hop samples first, then composes
claudius make --genre house --sampled                     # house built on the records house producers dig for
claudius make --genre house --sample-search "70s soul"    # ... or on a phrase found for your own words
claudius make --genre lofi --unsampled                    # lo-fi of its own sounds
claudius samples gather trip_hop                          # or gather on its own
claudius make --genre trip_hop --offline                  # play what was gathered before, download nothing

new_song takes the same as sampled and sample_search, and a script’s song() as options of the same names.

What each genre digs for

A genre’s profile says what its producers sample (sampling): not its own name or a mood, but kinds of records. Trip-hop digs for film scores, spy themes, library music and psychedelic soul; boom bap for soul, jazz piano, horn sections and vibraphone; house for disco, gospel choirs, philly soul and organ; filter house for disco loops it plays through a low-pass filter that opens in its drops; jungle for funk and jazz drum breaks and dub reggae; trap for orchestral strings, choirs, flutes and bells; afrobeats for highlife and palm-wine guitar. Each gathering tries the genre’s searches in an order the song’s seed picks, and the recordings each finds in an order the seed picks too, so that two songs dig through different records. Words of your own replace the genre’s searches for the phrase; the break and the texture still come from the genre’s.

How a sample is cut and played

Gathering downloads recordings of a fitting length and cuts each on its bars: the grid of its tempo, or, for a band that speeds up and slows down, the beats it plays, each bar of a piece then stretched to one length so that the piece keeps one tempo:

rolewhat is cuthow a song plays it
breakwhole bars of the break, and its kick, snare and hatas a loop track (break), re-chopped at times, where the genre’s sections list it, else in place of the layers the profile names (trip-hop’s kit, house’s top loop and shaker); the drum lanes it stands in for play the break’s own hits
phrasethe two bars the ears hear as most like what was asked for (“dark cinematic orchestral strings”, or your words; without the ears, the loudest), rather two the recording plays again, which loop as it does, with their key and chords; and two bars of another passage, from another section of the recording or on other chordsas a loop track (sample) in place of the genre’s chords or keys; the song takes its key, its tempo and its chords as progression A. The other passage plays as sample2 in some of the sections that list the phrase, on its own chords as progression A2 (the genre’s B stays the contrast it gives the sections on it): the louder of the two where the song lifts (its drops and hooks) and the other elsewhere, or every other section in a song that only lifts or never does. A genre with no major mode plays a major phrase in its relative minor. Where either passage plays, the song’s lead and arpeggio step aside, and the record carries the melody
texturesixteen seconds from the middleas a loop track (texture) under the song
vocala note a voice holds, chopped: the steadiest and loudest of about a third of a second (with the ears, the one of the best eight most like what was asked for), with the note it was sung atas a part (vox) in the drops and hooks (else the loudest sections) that plays the chop as a sampler would: moved from where it was sung to the song’s chords, as a lead’s motif or an arpeggio within a fifth of it, through a vocal’s mix (a high-pass at 200 Hz, a little presence, compression, reverb and delay). Garage, future bass and house chop one most often; trip-hop, boom bap, lo-fi, jungle and drum & bass now and then
bassa note a bass plays on its own, chopped from its attack: from a recording of a note or a few (not a song, and not one that calls itself a kick, a drum or a sound effect), the steadiest and loudest of about two thirds of a second, within 15 dB of the recording’s loudest, with most of its energy under 300 Hz and little above 2 kHz (a note out of a full mix has hats and voices over it). With the ears, the one of the best eight most like what was asked for. Its note is where it sounds: the pitch tracker hears the recording twice as fast, so that an 808’s C1 is found, and a note whose fundamental is weaker than its octave, as a bass guitar’s low notes are, is found an octave downon the song’s own bass part, where it plays, with its notes: a sampler plays them on the note, moved from where it was played, within an octave of it. Funk, reggae and phonk sample one most often (slap bass, dub bass, distorted 808s); boom bap, lo-fi and trip-hop an upright’s pluck, neo-soul and R&B a fretless, the disco genres a bass guitar, hip hop and trap an 808, now and then

A phrase meets the genre’s tempo as a producer plays a record, in one of three ways. The song’s seed picks among the ways that cost about the least, so not every song does the same:

  • Faster or slower by whole semitones, as a sampler plays a record, its pitch moving with its tempo, until its tempo (or half or twice it) falls in the genre’s range. A soul record at 98 BPM plays four semitones up in a house song at 123.47 BPM, in a key four semitones above its own, and the song takes that tempo and key, so the phrase is only resampled and plays in tune with everything else. How far a genre goes is in its profile (pitch: trip-hop slows a record by up to five semitones, house speeds one up by up to five). A remake’s hook that a voice sings in is not sped up or slowed down, unless the genre’s profile says its producers mean it to be (speeds_voices, as chipmunk soul’s does). Trip hop plays such a hook at its own speed in half time a little under its range rather than stretch the voice by more than a tenth (under): a pop song at 125 BPM becomes trip hop at 62.5, on trip hop’s own drums.
  • Chopped onto the song’s grid at its own speed, at a tempo two thirds, three quarters, four thirds or three halves of its own (where you give the song’s tempo, any from two thirds of it to three halves, never half or twice it, which would count its bars at half or double time). Each half beat of it plays from the song’s half beat, a sixteenth at a time from the song’s sixteenth, so its bars are the song’s, its chords change where the song’s do, its hits land where the song’s drums do, and its pitch is kept. Where the song is faster each sixteenth is cut short, and where it is slower a gap follows it, as with an MPC’s chops by the hit. (A half beat played whole at its own speed would put its second sixteenth a quarter of a sixteenth or more off the song’s, 50 ms at 71 BPM.) A 120 BPM record plays at its own pitch in a boom bap song at 90, three quarters of its tempo; one at 80 plays in house at 120, three halves of it. Chopping suits a recording with a clear pulse, whose slices are its hits, in a genre that chops (chop in the profile: boom bap, grime, phonk and IDM most). A recording that flows, such as a string section, is chopped only when nothing else fits it, since its chops would gate it, and house speeds its records up, as house does.
  • Stretched in tune to the genre’s tempo, where claudius can stretch, when the stretch is small or nothing else fits.

The song’s lineage says how far it went, which way, and where the other passage plays (sampled: phrase 'Old Soul' 4 semitones up (another passage of it in hook, hook2), or ... chopped onto the song's grid at its own pitch (played at 120 BPM)). Both passages play the same way. A break plays as it is within a few percent of the song’s tempo, and otherwise chopped onto the song’s grid at its own pitch, as jungle’s producers chop one, since a break stretched far smears its hits. The web demo stretches as the app does, with the same stretcher. Each role keeps its own colour from the profile: the high-pass that leaves the low end to the song’s bass, the tape, the 12-bit crush.

On top of that colour, a song treats its phrase with one move its genre’s producers make, which the song’s seed picks (treat in the profile says which moves and how often). The moves:

  • filtered until it lifts: held behind a low-pass at 1.4 kHz that opens across the build into each drop or hook, then out of the way there;
  • darkened: a low-pass at 2.6 kHz all through;
  • a telephone’s band in the intro and the breaks: 450 Hz to 3.2 kHz there, as it is elsewhere;
  • overloaded and smashed: the mixer’s drive at 9 or 15 dB;
  • crushed: 12 bits at half the rate;
  • as it is.

Trip-hop darkens and filters, big beat overloads, lo-fi darkens and crushes, and filter house keeps its own sweep. A move is made only where the phrase plays for it to be heard: a song whose phrase never plays in a drop or a hook is not filtered until it lifts. The song’s lineage names the move (sampled: phrase 'Old Soul' 4 semitones up, filtered until it lifts), and the second passage plays through the same.

With earshot’s models, the ears score each cut against what was asked for, and cuts under z 1.5 are left out and not fetched again. The cuts go into <samples>/prepared/<role>/<genre>/, or asked-<words>-<hash>/ for words of your own, so that a recording gathered for two of them is cut for each, each with its recording’s credit beside it, so a song’s credits.txt names them.

Gathering, a few at a time

The studio and an assistant gather the way claudius make does. A new song built on samples whose genre (or words) has fewer of a role than it keeps starts a job, sampling for house, that gathers up to two more of each, then makes the song with them. Its log shows each recording tried. Stop ends the gathering, and the song is made with what is there. So a genre’s collection grows with its songs, to the number its profile keeps (eight phrases, six breaks, three textures and four vocals for trip-hop), and each song draws one of each by its seed. A role the libraries had nothing more of is not searched again until claudius starts again. A claudius shared with others (--root) and claudius studio --offline gather nothing: they play what was gathered before, or what stands in for it.

Offline, or before anything is gathered, a genre plays the layers its profile names in a sample’s place (trip-hop’s drum lanes for the break, its electric piano and strings for the phrase), so it still makes a song.

In the web demo

The studio demo samples as well, as the app does: a song of a genre built on samples, or one asked to be, is built on recordings from Freesound, Jamendo and Wikimedia Commons under CC0 or CC BY, found as the song is made from what the genre digs for or your words, loops and whole songs alike. claudius itself cuts them, in the page, as the app cuts them: a phrase of two bars out of a whole song, in its key, with its chords, played up or down by whole semitones into the genre’s tempo, or chopped onto the song’s grid at its own pitch. The demo has no ears, so its phrase is the loudest two bars of a recording’s harmonic sections, and it cannot stretch, so a recording that no speed fits plays chopped. The demo asks the website for the recordings, and the website asks Openverse and the libraries, so your browser contacts no one else; a visitor may ask for 30 new searches a minute. Each track names its recording, and the log gives each one’s full credit.

A song the demo sampled goes on in claudius: its project holds what the demo cut from each recording, with the recording’s .json beside it, as a sound downloaded here has one, so claudius credits them in the song’s credits.txt from then on.

Your voice

claudius listens to singing the way a vocal coach does, and tunes it the way a careful producer would. It hears which note you mean at every moment and how near you come to it, and it learns how you sing: where you tend to go sharp or flat, how widely your notes scatter, how fast you settle on a note, and your vibrato. It hears this in any recording of one voice, a take in your song or a file, and the same reading turns your melodies into the notes you meant when you turn a take into notes.

How a take is sung

In the studio, right-click a take’s row in the arrangement and choose How is it sung?. Over MCP, an assistant calls assess_voice with the take’s name, or with an audio file’s path. On the command line, claudius voice hears a file:

$ claudius voice "Lights and Sound Vox Melody.caf"
12 notes, 75% within 25 cents of the note meant and 100% within 50; range C4-A#4; flat by 13 cents in the middle (F4),
sharp by 11 cents at the top (A#4); held notes scatter 20 cents either way, so a note lands within 25 cents 75% of
the time; settles on a note in 30 ms; furthest off: G4 at 6.8 s (-46 cents), A4 at 3.3 s (+38 cents), A4 at 7.3 s
(+35 cents)

A cent is a hundredth of a semitone. A held note about 25 cents off starts to sound sour against the music, and 50 cents is halfway to the next note.

  • The notes. How many notes it heard, and how many of them were sung within 25 and within 50 cents of the note meant. The furthest off are named, with where they are in the recording and how far off they were.
  • The range. The lowest and highest notes meant.
  • Sharp or flat. Where you sing above or below the note, at the bottom of your range, in the middle and at the top. Many singers go flat as they climb, or sharp when they push. A place you sing in tune is left out.
  • The scatter. How widely your held notes land around where you usually put them, and from that, how often a note lands within 25 cents.
  • Settling. How long a note takes to reach where you hold it: the scoop or slide into it.
  • Vibrato. How fast and how wide your vibrato is on notes long enough to hear one.

A take is heard in the song’s key and over its chords, from the section it starts with. For a file, --key "A minor" (key over MCP) gives the key it is sung in. --notes lists every note with where it was sung, and --json gives all of it as data.

How claudius reads it

  • Pitch. claudius reads the voice’s pitch every 10 ms with YIN, then finds each period again at the full sample rate, to about a cent.
  • Where the notes are. A model of how notes go, each scooped into, held and let go, finds where each note starts and ends, so that a scoop, a slide or a vibrato is part of its note and a breath or a note sung again begins another.
  • Which note each one is. A singer puts a note off by so much for the whole of it, so each note is read once, from where it was held, as this singer sings. The song settles what the voice leaves in doubt: the tones of its key and of the chord under the note are likelier than others, and a step likelier than a leap. The more widely you scatter, the more the song decides. A note 40 cents under F♯ in C major is read as an F sung sharp from a loose singer, and as the F♯ it nearly is from a precise one.
  • Learning the singer. From your singing alone, claudius reads the notes as anyone would sing them, learns how you sing from how near they came, and reads them again as you sing them, twice over.

It wants one voice at a time: a dry take or an a cappella, not a full mix. A voice more than half a semitone off on most notes, with nothing to sing against, is heard as singing the notes next to them; sung over the song, or with a key, it is heard against those.

Checking your pitch

A pitch check tells claudius how you sing without any take at all. In the studio’s Record window, press Check my pitch, or let an assistant ask for one. Six short phrases of four notes play, one at a time, and you sing each back in the gap after it, in whatever octave suits you. It takes about a minute. Wear headphones, so that the microphone hears you and not the phrases.

24 of 24 notes sung back (1 octave below the notes played), 63% within 25 cents of the note and 96% within 50; by step
71% within 25 cents, by leap 40%; range A2-A3; flat by 18 cents at the top (A3); held notes scatter 14 cents either
way, so a note lands within 25 cents 79% of the time; settles on a note in 90 ms; a vibrato of 5.6 Hz, 22 cents either
way, on long notes; furthest off: A3 (-41 cents), G3 (-36 cents), F#3 (+33 cents)

Besides what a take tells, a check knows the notes you were asked for, so it says how many you sang back, in which octave, and how much nearer you land a note reached by step than one reached by a leap. The phrases walk a major scale between A3 and A4, mostly by step. An assistant can give other notes with low and high.

The voice it hears becomes yours. The Record window shows it, and from then on tuning sings your takes as the check heard you, unless a tuner’s voice says otherwise. claudius keeps it in voice.json in its settings folder (Files and settings), on this computer only. A new check replaces it, and deleting the file forgets it. The online demo hears a check as claudius does, and keeps the voice only while the page is open.

An assistant asks with request_pitch_check. The studio’s Record window opens for it (or the link the assistant gives opens one), you sing it, and the assistant, which has been waiting with wait_for_pitch_check, hears what claudius heard. Not now tells it you will do it another time.

Tuning a voice

The tuner moves each note of a voice onto the note it means, as far as its singer needs. It learns how the take is sung, as above, so it knows that you go flat at the top and that your notes usually land within 15 cents. Your usual error goes. Of the scatter, only what is within humanize cents of the note stays, as expression. A precise singer is left nearly alone and a loose one is brought in. Each note is read against the song’s key and the chord under it, so a note sung between two goes to the one the music has.

In the studio, right-click a take’s row and choose Tune it:

settingwhat it does
Naturallyeach note brought on over 40 ms, 10 cents of your own kept, the vibrato as sung: the scoop into each note stays
Tightlyon the note within 15 ms, 3 cents of your own kept
Hardsnapped onto each note at once and held dead still: the robotic sound
Not at allthe tuner taken out

The voice keeps its own character: claudius moves it period by period (TD-PSOLA), so it sounds like you singing a little higher or lower, not like a tape sped up. The tuner is an effect, first in the take’s chain, so the graph shows it and its settings, and undo takes it out. An assistant tunes a track with tune, and a script with fx():

fx("take1", [#{ fx: "tune", speed_ms: 20, humanize: 5 }, #{ fx: "compressor", threshold_db: -20, ratio: 3, attack_ms: 5, release_ms: 80 }]);
fx("take1", [#{ fx: "tune", strength: sections(0.5, #{ hook: 1 }) }]);
settingdefaultwhat it does
strength1how much of the way to the notes, from 0 to 1; it can move, by section or along a curve, like a mix
speed_ms40how fast a note is brought onto its pitch after it starts; 0 at once
humanize10the cents of your own wandering around a note that stay
vibrato1how much of the vibrato stays, from 0 to 1
scale"chords"what the notes are read against: "chords" (the song’s key and the chord under each note), "key", "chromatic" (any note), or only some notes, #{ notes: ["C", "D", "E", "G", "A"] }
voicelearntthe singer, as assess_voice --json gives one; learnt from the take itself when not given

On the command line, claudius tune tunes a file outside any song (with --key or --notes) and writes the tuned recording beside it:

$ claudius tune "Lights and Sound Vox Melody.caf" --key "F major"
12 notes tuned, moved 10 cents on average and 27 at most; wrote Lights and Sound Vox Melody-tuned.wav

--speed 0 --humanize 0 --vibrato 0 is the hard-tuned sound, and --strength how much of the way to go.

Playing from a phone

A phone can play the open song with drum pads, a keyboard and a turntable, in the song’s own sounds. What you record there goes into the song: drums as its drum lanes, keys as a new part, a scratch as a take. It works in the studio app and in the browser studio that claudius serve serves, with a phone on the same Wi-Fi, and in the studio demo on the site, with a phone on any network.

Pairing

The phone button after Record in the studio’s top bar opens Play from a phone. claudius shares a page for phones, and the window shows its address as a QR code beside the steps: point the phone’s camera at it and open the link. The address carries a key of its own, which the phone keeps, so the page stays open on that phone until the studio stops sharing it (Stop sharing) or claudius quits; the next time, the address has a new key. The window’s first card says when a phone plays along; Done closes it and leaves the page open to phones, and the phone button stays lit while it is. If the page stopped (the demo opened in another tab takes it), Share it with my phone opens it again.

In the demo, the code opens the same page on claudius’ site instead, which reaches the demo’s tab through a relay on the site (below).

On the phone, tap Start: a phone plays sound only after a tap. The page shows the song, the section and bar the studio is at, and the beat. The sounds are the song’s own, rendered by claudius as the song mixes them, and the phone plays them itself, so a tap sounds at once, whatever the Wi-Fi does. An iPhone plays them with its ring switch on silent too.

Recording a take

The phone plays the song in the studio as well as following it: ▶ plays it from where it is, and ■ stops it. Tap ● and the take records along with the song; with the song stopped, ● starts it in the studio a bar before the section it is at, so you hear a bar first, and the take starts with that section. Tap ● again to send the take: the song changes as if you had made the edit in the studio, and undo takes it back. The phone keeps its clock with the computer’s and follows the studio’s transport, so what you play lands where you heard it, and the delay of the phone’s own speaker is taken off.

  • Pads. A pad for each of the song’s drum lanes, which sounds harder the nearer its top you strike it. A take becomes the lanes you struck, folded into a pattern of 1, 2 or 4 bars (as many as you played, up to 4) on the sixteenth grid and written as their main patterns, as a beat played or beatboxed into the microphone is: a step struck only some of the times round plays with that chance, as hard as you struck it on average.

  • Keys. Two octaves, with − and + for the octave, playing the sound of one of the song’s parts, a synth preset or an installed instrument; a key sounds harder the nearer its bottom you strike it. A take becomes a new part playing what you played in that sound, in the role you choose (keys, lead, chords, bass or pad), as notes played on a keyboard do.

  • Turntable. A record of two bars cut from a section of the song: one of its samples (the phrase it was built on, a flip, a take), a voice (a vocal chop), a part that plays notes, a beat (a sampled break), or the whole mix. A drum lane alone, a kick or a clap, is one sound struck, so it is not offered. Under From the library are samples to put on instead, each by its recording’s title and tempo: the phrases, vocal chops and breaks claudius gathered for the song’s genre (then those gathered for words you searched), and the Apple Loops and loops of your own folders of the genre’s kinds, nearest the song’s tempo first. A sample is a record of its own first bars (a vocal chop, all of it); the demo has no library, so it offers the song’s own records only. The record waits at its cue, its first sound, which a sticker marks as it comes round under the needle. Pulled back past its cue, it is silent, as the lead-in groove before a vinyl record’s first sound is; past its end it goes round to its start. With motor on it spins in time with the song: one cut from the song at its own speed, since it was cut at the song’s tempo, and a sample at the speed its tempo needs, by octaves the nearest (a loop at half the song’s tempo plays in time as half time), as a DJ sets a record’s pitch. pitch moves it up to 16 % faster or slower, the tempo it plays at shown beside it, and in time brings it back. One turn is 1.8 seconds of it, as on a record at 33⅓. A scratch on a sample credits it in the song’s credits.txt, as the song’s own samples are.

    ● mic records a record off the phone’s microphone, up to 8 seconds (tap it again to stop sooner): a voice, a sound in the room, a record playing nearby. It goes on the turntable as your recording, its peak at the master’s ceiling, and spins at its own speed; a take of a scratch on it carries the recording to the studio, which makes the scratch of it. A browser lets only a page it trusts use the microphone: the demo’s, served over https, or the page opened on the computer that runs claudius. The page your phone opens from the studio’s QR code is on your network without https, so there ● mic says so: record it in the studio’s Record window instead, and the take comes to the turntable as one of the song’s records.

    Your finger holds it as a DJ’s does. Rest a finger on it without moving and it drags: the record slows under it, the more the harder you press, and stops under a firm finger. A phone measures no force, so the page reads the press from how large your fingertip’s touch is (pressing flattens it), against the lightest and firmest touches it has seen; where the screen says nothing of that either, the longer your finger rests, the harder it brakes, stopping the record in about half a second. Move your finger a few millimetres along the record (further than a fingertip shifts as you press harder) and it grabs: the record goes with it until you lift it, to scratch or to spin it by hand, and holds still while your finger does. It follows your finger’s path as smoothly as your finger moves, a few hundredths of a second behind it, since a phone tells the page where a moving finger is only 60 or 120 times a second (on a slow or busy phone, which hears of it later and in bursts, up to a tenth of a second or so behind, rather than stuttering). Let go while moving and the record runs on at the speed you gave it, up to four times its own, so a swipe spins it faster, and a swipe backwards spins it back a moment, until the slipmat brings it to the platter’s speed (with the motor off, to rest). The motor, like a DJ’s turntable’s, brings the platter up to speed in a third of a second, and its brake stops it as fast. A spot under your finger shows how hard it brakes, and a ring that it grabs.

    Moved fast, the record whistles no highs folded back, as a needle reads a record, and the crossfader opens within a hair of its travel, as a scratch DJ’s does, so a flick cuts the sound in and out. A take becomes a take of the scratch, scratch1, scratch2 …, that plays from the start of the section it began in, read along your moves as you heard them: where the record was every few milliseconds, and the crossfader, so that fast strokes and cuts come out as you played them.

The pads, keys and turntable play without a take too, for practice, and while the studio is stopped.

MIDI controllers

A MIDI controller plugged into what opens the page plays what is on its screen: drum pads by the General MIDI drum map (as in the Record window), keys by their notes, and the turntable by its jog wheel and crossfader. For the turntable, tap Learn MIDI, turn the jog wheel, then move the crossfader: the page keeps what it learned. A browser lets a page use MIDI only on a secure connection, so this works on the demo’s page, which is on claudius’ site, and, for the app and claudius serve, on the computer itself: Open it on this computer in the Play from a phone window opens the page there, where a controller plugged into the computer plays it. Chrome and Edge have MIDI, on Android too; Firefox has it once you allow the site’s MIDI add-on it offers; Safari has none, on an iPhone either, but there the phone is the controller.

With the demo

The demo runs claudius in the browser tab, which a phone cannot reach, so the tab and the phone both join a room of a relay on claudius’ site, which passes what they say to each other. The room’s name is random and in the QR code alone; the relay keeps nothing of what passes through it. The phone needs the internet rather than your Wi-Fi, and the tab has to stay open: closing it closes the room (the phone says the demo is not open), and reloading it keeps the room, so the phone plays on. The demo’s engine renders the phone’s sounds and takes in the tab, after any render it is busy with, so the first sounds can take half a minute to arrive.

When it does not connect

  • The page does not open. The phone and the computer have to be on the same network, and some networks (a café’s, a hotel’s, a guest network) keep their devices from reaching each other. The computer’s firewall may ask whether claudius may accept incoming connections: allow it. The page’s port is 7879, or another one when 7879 is taken.
  • “This page is closed” means the studio stopped serving the page, or claudius restarted: open Play from a phone again and scan the new code.
  • “stopped: play the song in the studio” stays while the studio is not playing: a take records along with the song, so the song has to play.

Files and settings

claudius keeps songs, sounds, models and caches in separate places, so that each can be backed up, moved or deleted on its own. The paths below are for macOS and Linux; where an environment variable moves a folder, it is named.

Where everything is

whatmacOSLinuxmoved by
songs saved from the studio and the MCP tools~/Music/claudius$XDG_MUSIC_DIR/claudius, else ./outthe path of save
songs written by the command line./out (where you run it)./out-o
caches~/Library/Caches/claudius$XDG_CACHE_HOME/claudius or ~/.cache/claudiusCLAUDIUS_HOME
sample packs~/Library/Application Support/claudius/packs~/.local/share/claudius/packsCLAUDIUS_PACKS
samples from online libraries, each with its credit~/Library/Application Support/claudius/samples~/.local/share/claudius/samplesCLAUDIUS_SAMPLES
scratch space while a pack installs~/Library/Caches/claudius/packs~/.cache/claudius/packs
listening models~/.cache/earshot-rs~/.cache/earshot-rsEARSHOT_HOME
your genres~/Library/Application Support/claudius/genres~/.config/claudius/genres
the themes you added, a file each~/Library/Application Support/claudius/themes~/.config/claudius/themesCLAUDIUS_HOME
your voice, as a pitch check heard it~/Library/Application Support/claudius/voice.json~/.config/claudius/voice.jsonCLAUDIUS_HOME
the answer about usage statistics~/Library/Application Support/claudius/telemetry.json~/.config/claudius/telemetry.json
whether to update automatically, and the day it last looked~/Library/Application Support/claudius/updates.json~/.config/claudius/updates.json
studio window preferences, under settings~/Library/Application Support/claudius-studio/app.ron~/.local/share/claudius-studio/app.ron
Apple Loops (read only)/Library/Audio/Apple Loops, ~/Library/Audio/Apple Loops
programs and web studio (install script)~/.local/bin, ~/.local/share/claudius/webthe sameCLAUDIUS_INSTALL_DIR

On Linux, $XDG_MUSIC_DIR comes from ~/.config/user-dirs.dirs; without it, the studio saves under out in the folder it was started from. The web studio keeps its preferences in the browser’s local storage.

Every settings file says which version of it claudius wrote, and any later claudius reads it, a setting at a time: one it cannot read is its default alone, and one a later claudius added is kept when an earlier one writes the file (0016). Updating from any version keeps what you set.

Song folders

A song folder holds a song in every form claudius has for it. One function, song::write_folder, writes every folder, whether the CLI (make, script, render, remake, evolve, mutate) or a save in the studio or over MCP made it, so they hold the same files:

filewhat it is
song.wavthe master, 48 kHz, 24-bit
song.mp3a 256 kbps copy (Exporting writes other formats)
blueprint.jsonthe song’s genome
song.rhaithe song as a script
project.jsonthe arranged session
report.jsontempo, key, form, loudness, and every track’s level and gain
verdict.jsonthe critic’s verdict
credits.txtattributions, when sample packs play
stems/<track>.wavevery track, 32-bit float: from a save with stems, and from make and render with --stems; a save without them takes out the stems an earlier save wrote, and one with them those of tracks the song no longer has, so that the folder never holds stems of another version of its song (other files in stems/ stay)
release.jsonwhat you gave claudius publish: the artist, the songwriters, the artwork, how the song was made
release/the release kit claudius publish writes (Publishing)
takes/the song’s takes, 24-bit FLAC: recordings made for it, which a save copies in
history.jsonlevery change made to the song since it began, one a line, from a save in the studio or over MCP: what it changed, when, and what undo calls it; opening the folder again brings undo and redo back as they were

Stems are floating point because a track can peak above full scale before the master’s limiter brings the mix down. claudius judge runs its arrangement and theory checks when project.json sits next to the audio, so any song folder gets the full verdict.

blueprint.json is the song: claudius render, claudius script --on, claudius evolve --from, claudius mutate, and open in the studio and the MCP tools all start from it. The song model describes its fields. Every later claudius opens it; a newer claudius’s song, in a format this one does not read yet, says so and asks for an update. A blueprint that plays audio files (Apple Loops, chops, files from scripts) stores their paths, so it plays on another computer only where those files exist. Takes are the exception: they travel in the folder’s takes/, and a song folder that moved finds them there.

Caches

Everything in the cache folder can be deleted while claudius is not running; it is rebuilt on demand.

folderwhatgrows by
decoded/the sounds of 30 seconds or less claudius has read (samples, loops, one-shots), decoded to raw 48 kHz stereo .f32, keyed by path, size and modification timeup to 2 GB
stretched/Apple Loops and samples warped to a tempo and keyup to 1 GB
samples/drum one-shots cut from Apple Loopsa few hundred KB each
user/library.jsonthe user library: chops and found sounds from claudius chop
models/the command palette’s models: potion-base-8M.clde, which finds what your words mean, needle3.cact, which reads requests the palette cannot make out otherwise, and whistle.cact, which hears what you say to it8 MB, 35 MB and 17 MB, once each
renders/<process id>-<session>/a running session’s renders: <version>.wav, .mp3, and <version>/ with stemsabout 70 MB per four-minute render, and a WAV per track more for the latest render with stems (Export, Each track on its own)

A session keeps its last ten renders and deletes older ones as it goes. It holds a lock on .in-use in its folder while it runs, which the system lets go of when the process ends, however it ends. When a session starts, it deletes the folders of sessions that have ended: a free lock, and nothing written for a minute. Folders without a lock file, from claudius before 0.3, go once nothing has been written to them for 12 hours. decoded/ and stretched/ keep what was used lately: past their size, the files used least lately go until each holds three quarters of it. A longer recording is decoded each time it is read, which takes a fraction of a second, rather than kept: its decoded file would be about ten times the size of its MP3.

The pack installer’s scratch space holds downloaded archives and their unpacked files only while a pack installs, and is removed afterwards.

Sample packs and models

A pack is a folder under the packs folder with an index.json and a files/ folder; Sample packs covers installing and removing them. claudius-packs list prints the folder in use.

The models live under models/<repository>/<revision>/ in the models folder, one revision folder per pinned model, with CLAP’s text embeddings of earshot’s vocabulary cached in text/clap-d78c3994912c.bin. Deleting the folder makes the next verdict download 785 MB again (1.13 GB with the AudioSet tagger).

Your genres

A genre is a JSON file. claudius loads its built-in genres, then every .json file in your genres folder; a file whose name matches a built-in genre replaces it. The fields are those of crates/claudius/data/genres/house.json; copy it, rename the name, change what you like, and claudius genres lists it: under its family (“house”, “hip hop”) if it names one, else under “your own”, and a search finds it by its aliases too, the other names it goes by. A file that does not parse makes every genre lookup fail, the built-in genres included, so make and song() fail with Error: genre file <path> and the JSON error under Caused by:, and the studio’s list of genres comes up empty. Fix or move the file and try again.

The web studio

claudius studio, serve and mcp serve the web studio at / from the first of these folders that has an index.html:

  1. --web <dir>, or CLAUDIUS_WEB;
  2. share/claudius/web next to the program’s folder (~/.local/share/claudius/web for ~/.local/bin/claudius);
  3. web inside the program’s folder;
  4. crates/claudius-ui/dist of the checkout the program was built from (cargo xtask web builds it there).

Without one, / shows a page that says how to build it, and the API and MCP work as usual.

Assistant configuration

claudius connect edits these files, keeping a copy of the previous version as <file>.bak:

clientfile
Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json (macOS), %APPDATA%\Claude\claude_desktop_config.json (Windows), ~/.config/Claude/claude_desktop_config.json (Linux)
Cursor~/.cursor/mcp.json
Claude Codeits own configuration, through claude mcp add --scope user

Environment variables

variabledefaultwhat it changes
CLAUDIUS_HOMEthe cache folder abovewhere caches and session renders go
CLAUDIUS_PACKSthe packs folder abovewhere packs are installed and read
CLAUDIUS_SAMPLESthe samples folder abovewhere samples from online libraries are downloaded and read
CLAUDIUS_PACKS_CACHE_MB3072memory for decoded sample-pack audio
CLAUDIUS_PORT7878--port of studio, serve, mcp, doctor and connect
CLAUDIUS_TOKENnone--token of serve and mcp
CLAUDIUS_WEBfound as abovethe web studio folder
CLAUDIUS_FFMPEGffmpeg on PATH, then /opt/homebrew/bin, /usr/local/bin, /usr/binthe ffmpeg claudius uses for formats it cannot decode, and to export AAC and Apple Lossless off macOS; none turns it off
CLAUDIUS_DEBUGunsetwhen set, renders print their timings and the beat tracker its cues to stderr
DO_NOT_TRACK, CLAUDIUS_TELEMETRYunsetDO_NOT_TRACK=1 or CLAUDIUS_TELEMETRY=0 keeps usage statistics off whatever the answer
CLAUDIUS_TELEMETRY_URLthe Worker in telemetry/where usage statistics go, to test an endpoint (the only place a debug build sends them)
CLAUDIUS_UPDATESonoff stops the studio’s daily look for updates
CLAUDIUS_UPDATE_SINCEunseta version for the updater to act as, to try an update against the latest release
EARSHOT_HOME~/.cache/earshot-rswhere the listening models and text embeddings go
EARSHOT_OFFLINEunset1 never downloads models; a verdict without them uses meters and theory
EARSHOT_THREADShalf the cores, at most 4threads per model
EARSHOT_FFMPEG, EARSHOT_FFPROBEfound like CLAUDIUS_FFMPEGthe ffmpeg and ffprobe earshot decodes reference tracks with
GITHUB_TOKEN, GH_TOKENunsetsent to GitHub’s API while installing packs, for its higher rate limit
CLAUDIUS_SERVERhttp://127.0.0.1:7878the server the standalone claudius-ui program connects to
CLAUDIUS_MOCKunset1 makes claudius-ui run against its built-in demo song
CLAUDIUS_DEMO_SAMPLESunsetthe address the native demo asks for the samples a genre built on them plays, such as http://127.0.0.1:4321/studio/samples (The studio UI); without it, those genres play what stands in for their samples
CLAUDIUS_UI_PLANunseta scripted run of the studio window, for testing (The studio UI)

The install script reads CLAUDIUS_VERSION, CLAUDIUS_INSTALL_DIR and CLAUDIUS_DOWNLOAD_URL; see Install.

Themes

A theme is a look of your own, or one someone made and shared: the studio’s colours, written in a small file. The studio comes with two looks, Dark and Light, and wears any theme you add beside them.

Wearing one

? > Look > Add a theme… chooses a theme file (a .json). The studio wears it at once and keeps it: in the app, as a file in the themes folder of claudius’s settings (~/Library/Application Support/claudius/themes on a Mac, ~/.config/claudius/themes on Linux, %APPDATA%\claudius\themes on Windows); in a browser, in the page’s storage. The themes you added are listed under Look, and in the look’s menu at the right end of the transport bar, beside Dark, Light and As the system is. The studio wears the theme you chose the next time it opens, too. A theme of the same name as one already added takes its place.

Making one

? > Look > Copy this look as a theme copies the look you wear now as a theme file, every colour in it, named “Dark (mine)” or after the theme. Paste it into a file ending in .json, change its name and the colours you want, and add it. A theme need not name every colour: those it leaves out are its base look’s. So a theme can be as small as

{
  "claudius_theme": 1,
  "name": "Ember",
  "base": "dark",
  "colors": { "accent": "#ff5500", "playhead": "#ffd0a0" }
}
  • claudius_theme is the theme format, 1 today. Every later studio reads every earlier format.
  • name is how the theme is listed (up to 60 characters).
  • base is the look it is drawn on, dark or light: the colours it leaves out are that look’s, and it decides how the tracks’ and the sections’ colours are shaded (at a clean middle shade on a light theme, as the light look draws them).
  • colors holds the colours, each as #rrggbb, or #rrggbbaa to be see-through, and two numbers. A name the studio does not know (a colour a later studio added) is left out and said when the theme is added, never refused.
colourwhat it colours
bgthe window behind everything
canvaswhat the arrangement draws the music on
panelthe panels
raised, raised_hiwhat stands on a panel (a card, a menu), and the same under the pointer
wellwhat sits sunk in a panel: a fader’s track, a meter, a knob’s arc, the roll, a block of code
fielda field you type in
cell, cell_altan empty cell of a grid (a step that does not play), and every other beat’s
control, control_hia control, and a control under the pointer
line, line_softthe lines that divide, the strong ones and the soft ones
text, text_dim, text_fainttext, quieter text, and the quietest (keep it readable: at least 4.5:1 against the panels)
accentthe accent: what is chosen, the main button
good, warn, badthe verdict’s colours, and what went well, needs a look, or failed
lcd, lcd_text, infothe transport’s display, its figures, and its colour off the display (the genre, the verdict’s notes)
playheadthe playhead
soloa track soloed
strongthe strongest ink, which a control under the pointer is drawn in
edgethe edge of a quiet control, a field above all (none on the dark look)
faint_bg, hover_line, pressedwhat egui draws itself: the faintest fill, the outline under the pointer, a control pressed
lcd_holdhow much ink the display’s quieter figures keep, 0 to 1
shadowhow dark the shadows are, 0 to 255

The tracks’ and the sections’ colours (a kick’s, a chorus’s) are the studio’s in every theme, so that the same instrument reads the same everywhere.

The studio’s dark look, as a theme file, every colour named:

{
  "claudius_theme": 1,
  "name": "Dark",
  "base": "dark",
  "colors": {
    "bg": "#101217",
    "canvas": "#101217",
    "panel": "#171a20",
    "raised": "#20242c",
    "raised_hi": "#2a2f39",
    "well": "#0b0d11",
    "field": "#0b0d11",
    "cell": "#171a20",
    "cell_alt": "#1f232b",
    "control": "#272c36",
    "control_hi": "#323844",
    "line": "#2e333e",
    "line_soft": "#1f232b",
    "text": "#dde1e8",
    "text_dim": "#8f97a4",
    "text_faint": "#868d9b",
    "accent": "#ffa348",
    "good": "#54d486",
    "warn": "#f6c04a",
    "bad": "#f05e56",
    "lcd": "#090f11",
    "lcd_text": "#84e8ff",
    "info": "#84e8ff",
    "playhead": "#ffecd6",
    "solo": "#ffd440",
    "strong": "#ffffff",
    "edge": "#00000000",
    "faint_bg": "#15181e",
    "hover_line": "#424958",
    "pressed": "#3c4351",
    "lcd_hold": 0.0,
    "shadow": 150
  }
}

Privacy and usage statistics

claudius runs on your computer and sends nothing about you or your music anywhere. It listens to the microphone only while the studio’s Record window is open (its meter shows what the input hears), or while the command palette listens for what you say to it, after you click its microphone, in a browser once you have allowed the page to use it. It keeps the takes you record with your song, on your computer, and what you say to the palette nowhere: it is heard on your computer and let go. What a pitch check learns of your voice stays there too, in its settings folder. It goes on the network for six things only: the downloads you ask for (the sample packs, from GitHub and their authors’ sites, the listening models, from Hugging Face, the command palette’s three small models, from Hugging Face too, the first time you type in the palette or in a search field of genres or sounds, the first time it cannot make out a request and the first time you say something to it, and the recordings claudius samples finds); the samples a song built on samples gathers as it is made, from Openverse, Wikimedia Commons and ccMixter (--offline keeps it from asking); the update check, once a day, to GitHub; an assistant you connect from outside your computer if you set that up; the feedback you send, when you send it; and anonymous usage statistics, which are off until you turn them on.

What you type in the command palette or a search field stays on your computer: the models that find what your words mean and read your requests run in claudius’s engine there (or in the claudius you connected the studio to), and the demo’s runs in your browser, on the copy the site serves.

The website

ludwie.com (claudius.devlato.com, its old address, sends you there) counts visits with Cloudflare Web Analytics: a script from Cloudflare (static.cloudflareinsights.com) reports the page, where the visit came from and how fast the page loaded, without cookies and without anything that identifies you or follows you to other sites. Otherwise it makes no requests to anyone else from your browser: no fonts or other scripts from other servers. The studio demo’s samples are the one thing it fetches for you. When the demo makes a song built on samples, it asks the site, and the site’s Worker (site/worker/index.js) asks Openverse for recordings and Freesound, Jamendo or Wikimedia Commons for their audio. It sends them the search’s words (the kinds of record the genre digs for, or the words you typed for it) and nothing about you, and they see the site, not your address. What they answer is kept in Cloudflare’s cache, searches for a day and audio for a year. To keep the site within what Openverse lets it ask, Cloudflare’s rate limiting counts each address’s searches that the cache has not kept, 30 a minute at most; the site itself records none of them.

A phone playing along with the demo reaches the demo’s tab through a room of the site’s relay (site/worker/room.js, a Durable Object on Cloudflare): what the tab and the phone say to each other (the song’s sounds, the time, the takes) passes through it and is kept nowhere. A room’s name is 128 random bits that the demo’s QR code alone carries, and only the site’s own pages may join one.

Feedback

Feedback at the right of the studio’s bottom bar (also Send feedback… in its ? menu, or Cmd+K), the same in the web demo, the site’s form, and an assistant you ask to pass something on (its send_feedback, which it uses once you say yes) send what you wrote to the people who make claudius. With it go, unless you untick them, claudius’ version, your system (macOS, Linux, Windows or a browser) and the genre of the song open; and an email address, only if you give one for an answer. Nothing else goes: not your song, its files, your name or anything that tells you apart.

It goes to https://claudius-feedback.devlato.workers.dev/v1/feedback, a Cloudflare Worker whose source is feedback/ in this repository. It checks the message and keeps those fields and the day it came, in a Cloudflare D1 database; it keeps no IP address. Cloudflare’s rate limiting sees each address to let five messages a minute through at most, and keeps none of them. Only the people who make claudius read what is kept. To have a message deleted, send a private report on GitHub, as the security policy describes, saying what it said.

Usage statistics

They stay off unless you say yes. The studio asks once, at the end of its first-run tour, with two answers and neither one picked for you; closing the tour without answering leaves them off. The studio’s ? menu has the same switch, and from a terminal:

claudius telemetry        # whether they are on, and an event exactly as it is sent
claudius telemetry on
claudius telemetry off

When they are on, claudius sends four kinds of events, each at most once a day:

eventwhendetail
starteda command starts: studio, serve, mcp, make and the rest (not thumbnail, which a file manager runs for each project it shows)none
setupclaudius setup, or the studio’s pack download, endsok, models (the models did not download), or packs:<name> (the first pack that did not install)
panicclaudius stops on a panic, a bugthe file and line, such as claudius/src/render.rs:123, never the message
perfclaudius renders a song, listens to one with the ears, or decodes a recordingrender, ears or decode, and in value how fast: seconds of audio a second, to two figures (38: it rendered a minute of song in about a second and a half)

An event is these eight fields and nothing else (value is 1, but for a perf event’s speed):

{
  "v": 2,
  "event": "started",
  "command": "studio",
  "version": "0.5.0",
  "os": "macos",
  "arch": "aarch64",
  "detail": "",
  "value": 1
}

claudius 0.4 and before send the same without value ("v": 1), and the endpoint still takes those.

It never holds a file name, a path, a song or any part of one, your name, or an identifier: nothing tells one person’s events from another’s. It is sent in the background with a 3-second timeout and never sent again, so a computer without a network notices nothing.

Where they go

To https://claudius-telemetry.devlato.workers.dev/v1/event, a Cloudflare Worker whose source is telemetry/ in this repository. It refuses anything that is not an event of the shape above, and writes its fields to Workers Analytics Engine, which keeps them for three months. It writes no IP address and nothing else from the request. Cloudflare, which runs it, sees each request the way any web server sees one.

Keeping them off

Any of these keeps them off, whatever the answer:

  • DO_NOT_TRACK=1;
  • CLAUDIUS_TELEMETRY=0 (or off);
  • CI set, as on continuous integration;
  • a debug build (cargo run without --release), which sends only to CLAUDIUS_TELEMETRY_URL, when that is set.

The answer is kept in telemetry.json in claudius’ settings folder (~/Library/Application Support/claudius on macOS, ~/.config/claudius on Linux, %APPDATA%\claudius on Windows), with the day each kind of event last went out. Deleting the file is the same as never having answered.

For maintainers

  • node telemetry/test.mjs checks that the Worker takes what claudius sends and refuses everything else; a test in claudius-cli checks that it knows every command counted (all but telemetry and thumbnail).
  • npx wrangler deploy in telemetry/ publishes it. Analytics Engine has to be enabled on the Cloudflare account once, in the dashboard.
  • scripts/telemetry-report.sh [days] sums the events of the last 30 days (or days) by event, command, version and system. It needs CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN, a token that can read Account Analytics.
  • node feedback/test.mjs checks that the feedback Worker keeps what claudius sends and refuses everything else. Once, npx wrangler d1 create claudius-feedback (its id into feedback/wrangler.toml) and npx wrangler d1 execute claudius-feedback --remote --file schema.sql; then npx wrangler deploy in feedback/ publishes it. npx wrangler d1 execute claudius-feedback --remote --command "select * from feedback order by id desc limit 20" reads the latest.

Updates

Claudius looks for a new release once a day, downloads it in the background, and installs it when you say so.

In the studio

When a new release has been downloaded and checked, a bar under the toolbar says so. Restart to update installs it, closes the studio, and opens the new version. What’s new opens its release notes, and Later puts it off until the studio opens next. While it downloads, the status bar shows how far it is.

The ? menu has Check for updates, which looks now and says what it found, and Update automatically, which turns the daily look off and on.

An older claudius beside this one

A claudius installed before in another way keeps its own version, and an assistant set up with it starts it. When the studio finds an older claudius on its port, it runs beside it, and a bar under the toolbar says so: Connect an assistant opens the window that sets the assistant up with this version, and Later puts the bar off until the studio opens next. The assistant does not know what this claudius can do has the rest.

How each install updates

installed withthe update
the Mac app (the install script, or a disk image dragged to Applications)the new disk image for your Mac; its app takes the old one’s place. The app has to be in a folder you can write in, as Applications is
an AppImagethe new AppImage takes the old file’s place
the install script on Linux, or on a Mac with --no-appthe new archive’s programs and web studio take the old ones’ place in ~/.local
the Windows installer, or install.ps1the new installer runs once Claudius has closed
Homebrew, cargo, the .deb or .rpm, a build from sourcenothing is downloaded: the bar says how it updates (brew upgrade claudius, your package manager, …)

From the command line

claudius update             # downloads the latest release, and installs it after asking
claudius update --yes       # without asking
claudius update --check     # only says whether there is a newer release
claudius update --auto off  # the studio stops looking (on turns it back on)

Checked before it is installed

The latest release is the one GitHub’s releases/latest points to. Its file for your computer is downloaded over HTTPS, and checked against the SHA-256 sums the release lists in SHA256SUMS; a file that does not match is thrown away. The releases cannot be changed once published, and each has a provenance attestation (see Install).

Your songs

Every release opens the songs that earlier ones saved: the test suite keeps the songs each release saved and opens them all (saved songs keep opening). A song saved by a newer Claudius than yours says so, and asks you to update.

What it sends

The daily look is one request to github.com for the address of the latest release, and, when there is a newer one, the download of its checksums and its file for your computer. GitHub sees these requests, as it sees any download, and nothing about you or your music goes with them. It is off with claudius update --auto off, Update automatically in the studio’s ? menu, or CLAUDIUS_UPDATES=off, and in CI.

CLAUDIUS_UPDATE_SINCE=0.1.0 makes Claudius act as if it were that version, to try an update against the latest release.

Troubleshooting

Start with claudius doctor: it checks the web studio, the packs, the models, Apple Loops, ffmpeg and the port, and says what to do about each. The sections below are the problems it cannot see, by the message you get.

macOS will not open claudius

“Claudius” Not Opened
Apple could not verify “Claudius” is free of malware that may harm your Mac or compromise your privacy.

macOS says this about an app downloaded in a browser that Apple has not notarized: a release older than 0.8.0, or a build of your own. The releases since are notarized and open straight away, so downloading the latest is the simplest answer. The app itself is fine; it is the check. Otherwise, either:

  • install it from Terminal instead, which gives an app macOS opens straight away, because it checks only what a browser downloads:

    curl -fsSL https://github.com/devlato/claudius/releases/latest/download/install.sh | sh
    
  • or click Done, open System Settings, Privacy & Security, scroll down to the line about Claudius, click Open Anyway, and confirm. macOS remembers it after that.

The same message about a claudius program from a downloaded .tar.gz has the same two answers.

The verdict has no ears

earshot is unavailable (download failed: https://huggingface.co/Xenova/larger_clap_general/resolve/...); judging with meters and theory only

The verdict then has mix, arc and theory scores but no genre or production. The models download on first use, 785 MB, from the Hugging Face Hub. The usual causes:

  • No network on the first run. Run claudius setup --no-packs once while online.
  • EARSHOT_OFFLINE=1 is set. Then a model that is not cached fails with onnx/audio_model.onnx is not in the cache (...) and offline mode is on (EARSHOT_OFFLINE=1 / EarsOptions::offline): run once online to download it.
  • A download was altered or cut short. Every model file is checked against a pinned SHA-256 hash, and a file that does not match is thrown away: ... does not match its pinned SHA-256 (got ..., expected ...); not using it. Run it again; if it keeps failing, something between you and the Hub changes the files.
  • EARSHOT_HOME points somewhere unwritable: cannot create <folder>.

The first load after the download spends about 30 s embedding earshot’s vocabulary; later loads take 4 to 8 s. In the studio, verdicts include the ears from the moment the log says ears ready (...). --no-ears skips the models altogether, which also saves about half a gigabyte of memory.

The port is in use

$ claudius serve --port 7933
Error: port 7933 is taken, by another claudius or another program (--port picks another)

claudius studio stops with the same message when the program on the port is not claudius; when it is a claudius, the studio opens on it instead. claudius doctor tells the cases apart:

  --  port 7933       used by another program: pass --port to studio, serve and mcp
  ok  port 7922       claudius is running here

Pick another port with --port or CLAUDIUS_PORT, for every command that should meet there: claudius studio --port 7900 and an assistant configured with claudius mcp --port 7900. claudius mcp does not stop: it runs a session of its own without a web studio and says so on stderr:

claudius mcp: a session of its own (no web UI: port 7933 is taken, by another claudius or another program (--port picks another))

The assistant edits a different song from the studio

claudius mcp works on the studio’s song only if it finds the studio. It looks at http://127.0.0.1:7878 (or --port, --url) when the assistant starts it, so:

  • The studio was started after the assistant. Restart the assistant’s MCP server (in Claude Desktop, quit and reopen it) once the studio is up. stderr says which way it went: driving the claudius app at ... or a session of its own.
  • The studio runs on another port. Use the same --port in both.
  • An older claudius holds the port. See below.

The assistant does not know what this claudius can do

An assistant that knows fewer genres, tools or commands than this version has is talking to an older claudius. The usual cause is a copy installed before, with the install script (~/.local/bin/claudius), next to the app: an assistant set up with that copy, or with a bare claudius that a terminal finds there, starts it, and it serves the port the studio uses.

The studio and claudius mcp run beside an older claudius on the port instead of driving it, and the studio shows a banner that says so; claudius doctor names it (an older claudius (0.2.0) is running here). What the assistant changes then goes to the older one’s song, not the studio’s. The banner’s Stop it and take port 7878 sets that right at once: the studio asks the older claudius to save its song (into ~/Music/claudius/from claudius 0.8.0, which Open it here then opens), stops it, and serves its own engine on the port too, where the assistant’s claudius finds it once the assistant is restarted. It stops nothing that is not claudius, and nothing whose song it could not save first. To set it right for good:

  1. Connect the assistant again from this version: the studio’s ? menu, Connect an assistant, or claudius connect <assistant>. It writes the full path of this claudius, and names any older copy a terminal finds first (An older claudius (0.2.0) is at /Users/you/.local/bin/claudius).
  2. Remove the older copy if this one is all you use (rm ~/.local/bin/claudius), or install it again the way you did to update it.
  3. Quit and reopen the assistant, then the studio.
  • The claudius runs with a token (claudius serve --token, or --public). claudius mcp then stops instead of starting a session of its own, and the client shows a server that failed to start: the claudius at http://127.0.0.1:7878 asks for a token: pass --token or set CLAUDIUS_TOKEN (a wrong one is refused too). Give it the token: CLAUDIUS_TOKEN in the client’s environment, or claudius mcp --token <token>.

An MCP client shows no claudius tools

  • The client was not restarted after claudius connect (or the studio’s Connect an assistant). Claude Desktop reads its configuration at start.
  • The Mac app was not in Applications. Opened from its disk image or from Downloads, it runs from a copy macOS takes away again, and connecting says so: claudius is running from <path>, <why>, which goes away: move Claudius into Applications, open it from there, and connect again.
  • The configured program is not there. connect writes the absolute path of the claudius that ran it. If you moved or reinstalled it elsewhere (say from ~/.cargo/bin to ~/.local/bin), run claudius connect again. A hand-written entry with plain "command": "claudius" fails in apps that do not see your shell’s PATH.
  • The configuration file is not valid JSON. connect refuses to touch it: <file> is not valid JSON; fix it or move it aside, then run this again.
  • An HTTP entry with nothing listening. --http entries ("url": "http://127.0.0.1:7878/mcp") need claudius studio or claudius serve running.

To see what the client sees, run the server by hand and give it an initialize request:

printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' | claudius mcp --no-ears

It should answer with a line starting {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":... and claudius’ instructions. The protocol is on stdout and everything else on stderr, which Claude Desktop writes to ~/Library/Logs/Claude/mcp-server-claudius.log.

Sample packs are missing

A script that asks for a drum machine or an instrument without packs fails with what to do:

Error: Runtime error: track 'd': no sample packs are installed for bank 'tr909' (install them with: claudius-packs install --defaults) (line 1, position 17)

and an unknown sound ends its list with sampled instruments need packs: claudius-packs install --defaults. In a session started with --synth-only the packs are installed but switched off, and the same mistakes say so: sampled instruments are off in this session (--synth-only) and bank '808' plays sample packs, which are off in this session (--synth-only).

A song made where packs were installed does not render where they are not, because its blueprint names the instruments it plays:

Error: no installed instrument "tr808:sh" (no packs installed: claudius-packs install --defaults)

Install the packs (claudius setup), or only the pack named before the colon (claudius-packs install tr808). Under --synth-only the hint reads the sample packs are off in this session instead. A file deleted from inside a pack fails with sample missing: <path> (reinstall the pack); installing the pack again downloads only what is missing.

Installs that fail say so per pack and resume when run again:

claudius-packs: vsco2: ...
Error: could not install: vsco2 (run again to resume)

claudius setup downloads the listening models even when a pack fails, so the critic has its ears either way; it ends with the error, and with how to retry.

Two causes need more than a retry. set GITHUB_TOKEN if the API rate limit was hit means GitHub’s 60 requests an hour without an account ran out: set GITHUB_TOKEN to any token. cannot extract <archive>: ... means the system’s tar could not unpack the tr909 zip or the organ’s .tar.xz; install bsdtar or GNU tar with xz support (and unzip).

ffmpeg is missing

claudius does not need ffmpeg to work. Without it:

  • on Windows and Linux, exporting AAC or Apple Lossless fails with AAC needs Core Audio (macOS) or ffmpeg, and this machine has neither: install ffmpeg, or export MP3 or Opus;
  • files in formats claudius cannot decode itself fail with cannot decode <file>: <reason> (installing ffmpeg adds more formats). It reads WAV, AIFF, FLAC, MP3, AAC and ALAC, CAF, Ogg Vorbis and Opus on its own.

claudius doctor shows .. ffmpeg not installed (optional: reads the formats claudius cannot). claudius looks for it on PATH and then in /opt/homebrew/bin, /usr/local/bin and /usr/bin, since apps started from the Dock do not get your shell’s PATH. CLAUDIUS_FFMPEG=/path/to/ffmpeg names one, CLAUDIUS_FFMPEG=none turns it off.

Two files do not decode even with ffmpeg:

  • A file longer than 30 minutes (of stereo at 48 kHz): <file> is too long: claudius decodes up to 30 minutes of stereo at 48 kHz. Cut the part you want with any audio editor, or with ffmpeg: ffmpeg -i mix.flac -t 600 first-ten-minutes.flac.
  • A playlist or a list of files (.m3u8, an ffconcat list): ffmpeg is allowed to open only the file it is given, so it says Format not on whitelist. Point claudius at the audio file itself.

The studio in a browser does not start

While the studio arrives, the page shows its outline and how much of it has arrived; then the studio takes its place. When the page says The studio could not start:, what follows says why:

  • The browser cannot draw it. The studio needs WebAssembly and WebGL, which every current browser has. A browser with WebGL turned off, or with a graphics driver it does not trust, cannot draw the studio: chrome://gpu in Chrome and Edge, and about:support (Graphics) in Firefox, say whether WebGL works.
  • Something stopped the studio’s program loading (... did not load, its program did not arrive). An extension that blocks scripts can do this: let the page run its scripts, or open it in a private window, where most extensions do not run. A connection that drops while the program arrives leaves it unfinished: reload the page.

If the page never gets past Starting the studio, or says something else, the message is worth an issue (see Something else).

The studio window has no sound

The status bar at the bottom of the window shows audio problems after audio::

  • no audio output: ...: the window could not open the system’s default output device when it started. It opens the device once, so after you plug in headphones or change the output, restart the window.
  • could not fetch http://127.0.0.1:7878/api/audio/<n>.wav: ... or ... answered 404 Not Found: the render is not there. A session keeps only its last ten renders.

If there is no error, there may be nothing to play yet. The first render of a new song takes a few seconds (the toolbar shows the job in progress), and with --no-auto-render nothing renders until you press Render. Check the volume slider at the bottom right too.

In the browser, the first playback has to start from a click (browsers block sound a page starts on its own), and the page plays the MP3.

If the window shows Cannot reach claudius at http://127.0.0.1:7878, the claudius it was opened for is gone; start claudius studio again. Use the demo switches to the built-in demo, which needs nothing else.

A take records nothing

When the Record window says nothing is coming in, or a take arrives silent (the window says it as soon as the meter has heard nothing at all for a few seconds, and on macOS and Windows offers Open the system’s microphone settings):

  • macOS has not allowed the microphone. Open System Settings → Privacy & Security → Microphone and turn on Claudius, or the terminal you started claudius studio from. macOS asks the first time; a take recorded after a “Don’t Allow” is silent.
  • Windows has not allowed the microphone. Windows never asks a desktop app: open Settings → Privacy & security → Microphone and turn on Microphone access and Let desktop apps access your microphone.
  • The wrong input or channel. An interface’s guitar socket is often input 2. The meter in the Record window moves with whatever the chosen input hears, before and during a take.
  • The input is turned down. Check the gain knob on the interface, or the input level in the system’s sound settings.
  • The browser has not allowed the microphone. The window says the browser was not allowed to use the microphone: allow it in the site settings behind the icon at the left of the address bar, then open the Record window again. The system has to allow the browser too, as above for Claudius.
  • The page is not secure. A browser records on localhost or over https only, so a claudius opened by its LAN address over http cannot record: the window says this browser cannot record here or that it needs a secure page.

A take goes silent in places

When the window says the input went silent in places, something muted the input or gated it to silence in places, as the processing a system or a browser does to a microphone for calls does. A microphone always hears some noise, so silence to the bit means the input was gated. On a Mac, open Control Center while the Record window is open, choose Mic Mode and pick Standard: Voice Isolation keeps a voice and takes out music, a guitar and claudius’ clicks, and leaves silence between words. Measure cannot get through it either. In a browser, an audio interface usually goes around it.

A MIDI keyboard is not in the Record window

The Record window lists the MIDI inputs there are when it opens: plug the keyboard in first, then open the window again. A keyboard that needs a driver, or one that only connects over Bluetooth MIDI, has to show up in the system first: on a Mac, in Audio MIDI Setup’s MIDI Studio window. In a browser:

  • The page may not use MIDI keyboards yet. Choose MIDI keyboards: let the page use them in the input list, and allow it when the browser asks.
  • MIDI keyboards are blocked for this page. Allow MIDI devices in the site settings behind the icon at the left of the address bar, then reload the page.
  • this browser has none. Safari has no Web MIDI: use Chrome, Edge or Firefox, or the app.

When the notes arrive but sound late, set the window’s Latency for MIDI, which it shows while the keyboard is the input: positive when the notes land late. Only the way out counts there (a key is timed as it is pressed), so it is not what Measure finds for an audio input.

A take lands early or late

claudius lines a take up with what you heard from the times the audio devices report. Some delays are not reported, such as the processing in a laptop’s speakers and microphone, Bluetooth headphones, a video call app routing the audio, or a USB microphone and an output on different clocks, and those make a take land late. Press Measure next to the Record window’s Latency: claudius plays eight clicks and sets the latency from how late they come back.

  • claudius did not hear its clicks. The input has to hear the output while it measures: turn the speakers up a little, or hold the headphones to the microphone, and measure again.
  • the clicks came back at different times. Echoes or noise got in the way: measure again somewhere quieter, with the microphone nearer the speakers.
  • Measure again for each setup. The latency is the output’s and the input’s together: other headphones, speakers or another input have their own.
  • In a browser. Browsers report less of their latency than the app does: Chromium on a MacBook Pro reports about 8 ms of its 68, so takes there land about 60 ms late until you measure.

You can also set Latency by hand: positive when the take lands late. Recording and listening through one audio interface keeps the timing tightest.

The studio window cannot open a claudius with a token

$ claudius studio --port 7922
Error: the claudius on port 7922 asks for a token, which the studio window cannot send: open http://127.0.0.1:7922/?token=<token> in a browser, or start another studio with --port

claudius studio opens on a claudius it finds on the port, and starts its own session when there is none. The native window cannot send a token, so a claudius started with --token or --public is for the browser: open the address in the message with your token in place of <token>. claudius studio --port 7900 starts a separate session instead, with a song of its own.

A song opens but does not render

Songs that play audio files (Apple Loops, chops, files from scripts) store their paths. On another computer, or after the files moved:

render failed: no such file: /Users/me/Samples/vox.wav

On a shared claudius, opening such a song fails earlier, with cannot open <folder>/blueprint.json: the song plays <path>, which is outside the folders this claudius may read, whether the file is missing or outside the shared folders.

claudius cannot open a file in Downloads, Desktop or Documents

macOS keeps every program out of the folders it protects (Desktop, Documents, Downloads, drives you plug in and network drives) until you let it in. The app claudius runs in asks the first time: Claudius when the studio’s engine opens the file. claudius then says so, instead of a bare error:

cannot open /Users/you/Downloads/song.wav: macOS keeps claudius out of your Downloads folder until you let it in. In
System Settings, Privacy & Security, Files and Folders, turn it on for Claudius; or move the file into
/Users/you/Music/claudius

When claudius was started by an assistant or a terminal rather than the app, macOS asks on behalf of that app, and it is the one to turn on. Moving the file into ~/Music/claudius, which no one has to let claudius into, works too. A file that is simply not there says which files in its folder are named like it (there is no file at ...: its folder holds Night Drive’s Hook.wav): an assistant often writes a name almost right, a straight quote for a curly one.

A shared claudius refuses to save

/Users/<you>/Samples/mix is outside the folders this claudius may write

A claudius started with --public, --files, or --host with an address other than loopback saves only inside its folders: ~/Music/claudius (the default), its caches and the sound libraries, plus each --files folder. Save there, or start it with --files for the folder you want.

A script or a song hits a limit

Scripts run under limits so that a mistake cannot hang claudius; Errors and limits lists them all. The ones people meet:

messagewhat to change
the script ran for more than 10 secondsa loop that does too much; scripts are meant to describe a song, not compute one
Too many operationsthe same, counted in operations (5 million)
'*' takes a number above 0 and up to 256, not 100000a smaller factor; the same limit holds for /, fast, slow and ply
track 'x': this pattern is too dense to play: it makes more than 262144 eventsfewer speed-ups inside speed-ups: s("[bd*256]*256") is 65,536 hits a bar
track 'x': this pattern is too dense to play: it needs more than 4000000 steps of worka long sequence sped up a lot, such as a thousand rests and a bd played *256
track 'x' plays 2048 notes per bar; the limit is 1024fewer events per bar
the song is 640 bars long; the limit is 512shorter sections, or fewer of them
the song is 25 minutes long; the limit is 20the same at a slow tempo
the song has 70 tracks; the limit is 64fewer tracks; a pattern with several sounds plays as a track for each
24 tracks of 10.0 minutes are more than claudius renders at once (200 track-minutes, ...)fewer tracks, or a shorter form
mini-notation is limited to 4096 characters (this one has 6000)split the pattern into tracks

The HTTP API refuses commands over 1 MiB with 413 Payload Too Large. mutate tries at most 32 variations and evolve runs at most 20 generations of at most 32 children; larger numbers are lowered to those.

The session is busy

busy (rendering); try again when it is done, or cancel it

One job runs at a time: a render, a mutation, an evolution or a save. Edits still work while a job runs, and a render asked for during a job runs after it. A save asked for during a job waits for it too, and says so: saving to <folder>: blueprint.json and song.rhai now, the audio once the current job (rendering) is done. cancel (stop for assistants) ends a mutation or an evolution after the candidate or generation in progress, and a download of packs from the studio after the pack in progress; a render always finishes.

The analysis of a song is wrong

claudius analyze and remake read tempo, key and chords from the mixed audio, and get some songs wrong:

  • Half or double tempo. Pass --genre, whose tempo range guides the beat tracker.
  • The relative key. A minor song can read as its relative major (D minor as F major or B♭ major when the chords favour them); the chords are usually right, and named in the other key.
  • The progression starts on the wrong chord. The downbeat was placed a beat or a bar off, so the progression is rotated.

Analysis is best on steady electronic music with a clear kick. Evolution and analysis explains how it reads a song.

The disk is filling up

The cache folder (~/Library/Caches/claudius, ~/.cache/claudius on Linux) grows: decoded audio (about 23 MB per minute of every file claudius reads), warped loops, and each running session’s last ten renders (about 70 MB each for a four-minute song). Delete it while claudius is not running; Files and settings says what each folder holds. Sample packs and models are elsewhere and are not affected.

Something else

Run the command again with CLAUDIUS_DEBUG=1 for render timings, and report it at github.com/devlato/claudius/issues with the command, its output and claudius doctor. Security problems go to the private channel in SECURITY.md.

Architecture

claudius is a Cargo workspace of twelve crates. One of them, claudius, is the engine and does all the music; the others decode and encode audio, manage sample packs, listen, find the studio’s actions, edit, serve, draw and parse command lines around it.

The crates

                       claudius-cli  (the `claudius` binary)
                      /      |      \___________________________
                     /       |                                  \
          claudius-server    |                     claudius-ui (feature "studio")
           /     |     \     |                                  |
          /      |   claudius-session                           |
         /       |      /    |                                  |
 claudius-api  claudius (the engine)                      claudius-api
               /      |       \
              /       |        \
   claudius-packs   earshot   claudius-decode
          \           |
           \          |
          claudius-decode
cratewhat it isdepends on
claudiusthe engine: theory, composition, patterns and scripts, synthesis, effects, rendering, the critic, evolution, analysis, the Apple Loops libraryclaudius-packs, earshot, claudius-decode
claudius-decodeaudio files to samples: symphonia in pure Rust, and opus-pure for the Opus symphonia finds, so every format claudius-encode writes reads back; ffmpeg as a fallback, limited to the one file and to 30 minutes; trims the encoder priming of AAC in CAFsymphonia, opus-pure
claudius-encodesamples to audio files: WAV, AIFF, FLAC, MP3 and Opus in Rust, Ogg Vorbis through libvorbis, AAC and Apple Lossless through the system’s encoderclaudius-decode
claudius-packsthe sample packs: registry, installer, SFZ and Strudel-map readers, name resolution, the multi-sample player, credits; also the claudius-packs binaryclaudius-decode
earshota Rust port of the Python earshot: CLAP and the AudioSet tagger through ONNX Runtime, the calibrated vocabulary, realness, measurementsclaudius-decode, ort
claudius-apithe wire types of the HTTP API: plain serde structs, so they build for WebAssemblyserde
claudius-intentthe command palette’s catalogue of the studio’s actions, found by name and by meaning: static word embeddings (Model2Vec’s, each number a byte), a flat vector index, the ranking (0011)serde
claudius-sessionwhat a session does to a song: the edits the API’s commands make (as scripts, or in place), its history (every change as an operation in a log that only grows, and the undo and redo steps), and the views of the song, its render and its verdict as API types; the palette’s model, held onceclaudius, claudius-api, claudius-packs, claudius-intent
claudius-serverthe session (App), the HTTP routes, the MCP toolsclaudius, claudius-api, claudius-packs, claudius-session, claudius-intent
claudius-uithe studio, in egui: a native window and a WebAssembly app, both clients of the HTTP API, with a demo that runs the engine itselfclaudius-api, claudius-intent; in the app, claudius-session for the demo
claudius-webthe demo’s engine in a browser’s Web Worker (claudius-engine, which trunk builds beside the web studio)claudius-session
claudius-macoswhat a Mac asks of the app that winit does not pass on: the files to open (a project double-clicked in the Finder), taken as the Apple Event “open documents” by a handler that answers it in place of AppKit’s. The one crate with unsafe code, the calls into the Objective-C runtime; empty on other systemsobjc2
claudius-clithe claudius binary: one subcommand per task, setup, doctor, connectall of the above

Two dependency rules hold the shape together. The engine knows nothing about HTTP, sessions or windows: it takes a blueprint and returns audio and a verdict. And the UI knows nothing about the engine: everything the studio does, it does through the API’s commands and states, which keeps the API complete. Its demo answers them with the engine itself, the server’s own session code run in memory (claudius_session::host): in a page, in a Web Worker of its own (claudius-web), so the studio’s WebAssembly still depends only on claudius-api; in the app, on a thread.

The engine builds for the browser too (wasm32-unknown-unknown), without its native feature: what a computer of one’s own has, and the C and C++ libraries a browser’s build cannot compile. Downloading packs is left out (claudius-packs without net), and so are the Apple Loops database (SQLite) and Ogg Vorbis (claudius-encode without vorbis; MP3, FLAC and Opus are Rust and stay). The time-stretch stays: it is Signalsmith Stretch ported to Rust (dsp::stretch). It composes, runs scripts and renders there on one thread, about 1.5 s for 8 bars of house. std’s clock and temporary folder exist in a browser only to panic, so the engine reads them through claudius::clock and config::temp_dir; tests/browser.rs keeps it so.

Outside crates/ are xtask/ (the repository’s build and release chores, run as cargo xtask) and fuzz/ (two cargo-fuzz targets, in a workspace of their own because they need nightly).

How a song flows

  genre profile (data/genres/*.json) + seed + options
                     │ compose::generate
                     ▼
                 Blueprint ◀─────── script::run          scripts, studio edits, MCP tools
                     │    ◀─────── evolve::mutate         mutation, crossover
                     │    ◀─────── analysis::song         remakes of audio files
                     │ compose::arrange
                     ▼
                  Project          tracks with notes or audio clips, chords, sections, bus automation
                     │ render::render
                     ▼
                 Rendered          master, stems, per-track levels and gains, LUFS, true peak
                     │ judge::judge (+ ears::Ears::report)
                     ▼
                  Verdict          scores, measures, issues that name what to change
  1. Generate. compose::generate makes every creative choice for a genre and a seed: tempo, key, two progressions, a form, drum patterns, the parts and their sounds, the mix. The result is a Blueprint: a song’s genome, small (tens of kilobytes of JSON), serialisable and diffable.
  2. Edit. Everything that changes a song changes its blueprint: a script, a step in the sequencer, a mutation, an undo. A blueprint is never patched in place by two parties; each edit produces a new one, and the session keeps the old one for undo.
  3. Arrange. compose::arrange expands a blueprint into a Project, the way a producer lays a session out: one loop of every part per progression tiled across its sections, drum variants per section, fills, builds, gaps, transitions, and filter automation on the buses. Arranging is a pure function of the blueprint and cheap next to rendering, so projects are never stored by the session; every song folder gets one in project.json (song::write_folder), for judge.
  4. Render. render::render plays every track through its sound, mixes them to the genre’s targets, runs the buses and returns, and masters the sum to the target loudness under a true-peak ceiling.
  5. Judge. judge::judge measures the master, the arrangement and the score, and, when earshot’s models are loaded, listens. Each issue carries a target (master, form, part:lead, band:sub+ …), which evolution uses to choose its next edits.

A blueprint also prints as a script (script::to_script) that runs back into the same blueprint, which is how the studio’s script tab, GET /api/script and get_song show a song. Patterns and the script engine explains how that round trip is kept.

One session, many clients

  studio window ──┐
  browser tab ────┤ HTTP /api ──┐
  curl ───────────┘             │
  assistant (HTTP) ─── /mcp ────┼──▶  App: one Session behind a Mutex
  Claude Desktop ─ stdio ─ claudius mcp ─(HTTP)─┘       │
                                                        ├─ version on a watch channel → long polls
                                                        └─ one job thread at a time

claudius-server holds one App per process. Its Session is the song with its undo and redo stacks, the latest render and verdict, a log, and the running job. Every client is a view of it: the native window and the browser long-poll GET /api/state?since=N; the MCP tools call the same App methods in process, or the same HTTP routes when claudius mcp drives a studio in another process. Because there is one copy of the song, a person in the studio and an assistant over MCP see each other’s edits within one long poll. 0005 One session, many clients records why, and Server, sessions and MCP how.

Threads

whatwhere it runs
the HTTP server and the MCP transporta multi-threaded tokio runtime; in claudius studio, on its own thread, since the window needs the main thread
a command (POST /api/command)tokio::task::spawn_blocking, because scripts and analysis take milliseconds to seconds
editsone at a time, serialised by the session’s edit mutex
long jobs (render, mutate, evolve, save)a plain std::thread, one job at a time; panics are caught and logged
loading earshot’s modelsa background thread at startup; verdicts include the ears once it finishes
a renderrayon: every track in parallel, then the buses in parallel, the two returns in parallel, and each channel of the soft clipper and true-peak meter
evolutionrayon: the children of a generation are rendered and judged in parallel
synthesispolyphonic notes of a synth track render in parallel
pack downloadsscoped threads, 8 by default
earshoteach ONNX session behind a mutex, with EARSHOT_THREADS intra-op threads
the studio’s networkehttp: a thread per request natively, fetch in the browser; replies come back on a channel

The session’s lock is held only to read or swap state, never across a render or a script, so GET /api/state answers while a job runs. Long polls wait on a tokio::sync::watch channel that every state change bumps.

Determinism

The same blueprint renders the same song, and the same genre, seed and options generate the same blueprint, given the same installed sounds. The pieces that make that so:

  • One random generator, many streams. rng::Rng is xoshiro256++ seeded through splitmix64. Rng::fork(label) derives an independent stream from the current state and the label without advancing it, so generate gives harmony, form, drums, the kit, parts, loops, transitions and the title a stream each: writing one more part does not change the drums.
  • Seeds stored where they are used. Every part has its own seed in the blueprint, and its notes come from seed ^ hash(progression name). Changing a part’s seed rewrites that part alone; changing another part’s style leaves it as it was.
  • Pattern randomness is a hash, not a stream. ?, |, degrade and sometimes decide each event from a hash of a seed and the event’s start time. A pattern gives the same events whichever window you query and in whatever order, which is what lets a track be queried section by section (tests/pattern_laws.rs checks it).
  • Render seeds from names. Each track’s humanisation, each effect’s noise and each reverb’s impulse response are seeded with project seed ^ hash(track or bus name).
  • Hashes. rng::hash_str (64-bit FNV-1a) turns names into seeds and lets evolution skip blueprints it has seen; blake3 names cache files.

What is not deterministic: a seed taken from the clock when none is given (always printed), the sounds that resolve differently on machines with different packs or Apple Loops, and floating-point results across CPUs, which is why the generator snapshots summarise blueprints instead of comparing audio.

Streams have one trap: an option that skipped a random draw would shift every draw after it. So generate draws a tempo and a tonic whether or not they are given, and a bpm or key of your own replaces only the result. song("house", #{ seed: 9, bpm: 131 }) is “Crimson Tide” at 131 BPM, with the form, progressions and drums of song("house", 9); a_tempo_or_key_of_your_own_changes_only_that in tests/script.rs holds the title, the form, progression A and every drum pattern to that. A key brings its mode too: the progressions are written, answered and derived in the style’s mode as always, then moved to the key’s the way key() moves them, so seed 9 asked for E minor instead of its own G dorian plays A as i7 iv9 i7 VII7 i7 iv9 i7 V7 where G dorian has i7 IV9 i7 VIImaj7 i7 IV9 i7 V7; a_key_in_another_mode_gets_the_progressions_in_that_mode holds every progression of 24 songs in three keys to that. A song printed as a script still starts from song("house", 9); the tempo() and key() lines after it set the rest.

Errors

Engine functions return anyhow::Result or Result<_, String> with messages written for the person reading them (unknown sound 'bdd' (drums: ...; synths: ...)). The server passes them through unchanged as Reply.message, MCP tool errors and log lines, and the CLI prints them after Error:. A failed edit leaves the song as it was: scripts run against a copy, and the session swaps the copy in only when the script succeeds.

Where to go next

A tour of the repository walks the code in reading order. The other engineering pages take one stage each: the song model, composition and theory, patterns, rendering, the critic, evolution and analysis, sample packs, the server, the studio, testing and security.

The song model

claudius works with two documents, both in crates/claudius/src/model.rs:

  • a Blueprint is a song’s genome: the choices a producer makes (tempo, key, progressions, form, drum patterns, how each part is written, every sound, the mix), stored as data small enough to read, diff and mutate;
  • a Project is the arranged timeline a blueprint expands into, like a DAW session: tracks with notes or audio clips, a chord track, sections, and effect chains with automation.

Everything that edits a song edits its blueprint. The project is derived on demand by compose::arrange and thrown away after rendering. 0003 The blueprint is the song records why.

Units, everywhere: time in beats from the start of the song (4 beats to a bar, no other metre), pitch in MIDI semitones (60 is middle C), velocity from 0 to 1, levels in dB, sample rate 48 kHz.

The blueprint

This is the head of a real one, house with seed 9 (claudius make --genre house --seed 9 writes it to blueprint.json):

{"version": 1, "title": "Crimson Tide", "genre": "house", "seed": 9, "bpm": 124.0,
 "key": {"tonic": 7, "mode": "dorian"}, "swing": 0.5257842, "humanize": 0.25,
 "harmony": {"progressions": {"A": ["i7", "IV9", "i7", "VIImaj7", "i7", "IV9", "i7", "V7"],
                              "B": ["i7", "ii7", "i7", "VIImaj7"]},
             "bars_per_chord": 1},
 "form": [{"name": "intro", "kind": "intro", "bars": 8, "energy": 0.35950592, "prog": "A",
           "layers": ["kick", "hat", "perc"], "variant": "sparse",
           "filter_in": true, "build": false, "gap": false, "impact": false, "fills": false}, ...],
 "drums": [...], "parts": [...], "loops": [], "patterns": [], "transitions": {...}, "mix": {...},
 "lineage": ["generated: house seed 9"]}
fieldmeaning
versionthe format, BLUEPRINT_FORMAT (1): claudius opens this and every earlier format, and asks for an update to open a newer one (below)
title, genre, seedthe genre names a profile in data/genres/; the seed is the one it was generated with
bpm, key, swing, humanizekey is a tonic pitch class (C = 0) and a mode; swing 0.5 is straight, about 0.66 a triplet feel; humanize 0 to 1 loosens timing and velocity
harmonynamed progressions of Roman numerals and how many bars each chord lasts
formthe sections, in order
drumsdrum lanes with step patterns
partsmelodic parts written by the theory engine
loopsrecorded loops (Apple Loops, flipped samples) and takes
patternstracks written as pattern code by scripts
transitionsthe crash, riser, impact and their switches
mixthe reverb and delay returns, bus chains, sidechain release, per-role level offsets, the master
lineagewhat was done to the song, one line per change, oldest first

Harmony

Progressions are Roman numerals in the key’s own mode (VI in A minor is F major), so changing the key moves every chord with it, and key() in a script re-spells diatonic numerals when the mode changes (Imaj7 in E major becomes i7 in F minor). Generated songs have A and B, and sometimes C, a chorus of its own that the hooks play; sections play A unless they say otherwise, and breaks play B. Scripts may add more names. Composition and theory covers the numeral grammar.

Form

Each SectionSpec is a block on the arrangement:

fieldmeaning
nameunique in the song (drop, drop2)
kindintro, verse, build, drop, break, hook, groove or outro
bars, energylength, and how intense it should be (0 to 1); the critic compares energy with loudness
progwhich progression it plays
layersthe names of the drum lanes, parts, loops and pattern tracks that play in it
variantwhich drum pattern variant its lanes play (main, sparse, alt, half, …)
filter_ina lowpass opens across the section
builda snare roll, a riser and a highpass sweep into the next section, the kick out for its last bar
gapa beat of silence before the next section
impacta crash and an impact on its downbeat
fillsthe genre’s drummer ends its phrases: a turn at the end of four bars, a fill at the end of eight and of the section

Layers are names, not references: a section may list a layer that no track has (a genre’s optional top loop when the library had none), and it plays nothing.

Drum lanes

A DrumLane has a sound, a pattern_bars length (4 in generated songs), and patterns: a map from variant name to hits, each hit a position in beats within the pattern and a velocity. Variants of one lane all have the same length; when a script sets a longer one, the others are repeated up to it. pitch transposes the lane, choke names a group in which a new hit cuts the previous one (the open hat stops when the closed hat plays), late_ms is how far behind the beat every hit plays (ahead, below zero; left out when 0), and mix is the lane’s TrackMix. A Part and an arranged Track have a late_ms too. genre is the genre whose drummer the lane plays as, when that isn’t the song’s (a lane generated from another genre’s drums; left out when there is none): another take of the lane is written from that genre’s template, and when the lane plays the backbeat, the song’s phrases end as that genre’s drummer ends them.

Parts

A Part stores how to write notes, not the notes:

fieldmeaning
rolebass, chords, pad, lead, arp or keys: which writer runs, and its target level
stylethe writer’s style: a bass style (offbeat, rolling, kick_follow, …) or idiom (one_drop, slap, …), a chord rhythm (stabs, pump, charleston, …) or comping idiom (skank, gospel, …), an arpeggio pattern, or for a lead motif or a lead idiom (trap_bells, gfunk_whine, …)
registerthe lowest and highest MIDI note it may use
densityhow busy a lead is (0 to 1)
voices, voicinghow many notes a chord has and how it spreads (close, open, spread, or power: root, fifth and octave)
ratean arpeggio’s step in beats
seedthe part’s own random seed
notesnotes written by hand, by analysis or from a take, per progression, which replace the writer; they may run over several cycles, and come round again after the last they reach
sound, mixits sound and mix

Storing the recipe makes the part small, readable as a script line (part("bass", #{ style: "syncopated", preset: "saw_bass", register: [33, 52], density: 0.42195085, seed: ... })), and editable at the level a producer thinks at: a new seed is a new bass line in the same style, a new key moves the same line. The writer is deterministic, so the recipe is enough to get the same notes back.

Loops and pattern tracks

A LoopPart plays a recorded loop (Sound::Loop with its tempo, length in beats and key): transpose in semitones, and optionally chop, a slice order over slice_beats-long slices, for flipped samples. A loop part with from, the name of a section, is a take (claudius::take): instead of starting over in each section, it plays once from the start of that section (or of the first section that plays it, when that one is gone), on through the later sections that play it. Each section keeps where it starts in each take it plays (SectionSpec::takes, in the take’s beats), set when the take is added or the recording reworked and before any change to the sections (take::pin_all), so that a section added, removed, moved or made longer leaves the others’ stretches as they were; a section added plays none of the takes (take::leave_out), and set_section’s source sets a section’s place, to the beat (take::place). One without a place of its own (in a song saved before sections kept them, or a take turned on in a new section) goes on from the take’s first section as the song’s time runs (Blueprint::take_places).

A PatternTrack is a track a script wrote: code is the pattern expression exactly as written (s("bd*4, [~ cp]*2")), sounds maps each sound label in it to the Sound it resolved to when the track was written, and role is set when the pattern plays one sound. The code is the source of truth: the project re-evaluates it at every arrangement, which is what lets a song print back as the script that made it. Storing the resolved sounds keeps a song’s sounds stable if, say, another sample pack is installed later.

Sounds

Sound is an enum, and every variant is audio:

variantwhat plays
drum { voice, params }a synthesized drum voice with nine parameters (tune, decay, tone, punch, snap, drive, pitch envelope and time, room)
synth { preset, patch }the synth engine with a full copy of a preset’s patch, possibly varied or mutated
sample { path, root, start, end, label }a recorded one-shot played like a sampler; root is the note that plays it as recorded
fx { fx }a transition effect rendered in code: riser, downlifter, impact, reverse_crash, sweep_up, sweep_down
instrument { name, label }a multi-sampled instrument from a pack, by its canonical pack:instrument name; label is what it was asked for by
loop { path, bpm, beats, key, tonal, label }a recorded loop, warped to the song’s tempo and, when tonal, transposed to its key

There is no variant for General MIDI or generated audio, which is the point of 0001 Real audio only. Blueprint::files() lists every file path a song plays, which the server’s file policy checks when a blueprint is opened.

The mix

Every track has a TrackMix:

fieldmeaning
level_dbdB relative to the target loudness of the track’s role, not an absolute fader
pan−1 to 1
fxinsert effects
reverb, delaysend levels to the two returns, 0 to 1
ducksidechain depth from the kick, 0 to 1
drive_dbthe mixer’s drive, 0 to 36 dB: tanh saturation after the inserts, before the gain to the role’s target
busdrums, bass, music or fx
mute, solowhile any track is soloed, only soloed tracks are arranged

The song’s MixPlan holds the reverb and delay effects of the returns, an insert chain per bus, duck_release (the sidechain recovery, in beats), levels (a dB offset per role), bands (where the genre’s healthy share of a band parts from the usual master’s, as in an 808 genre’s sub, for the critic) and the master (fx, a lufs target and a ceiling_db, −1 by default). Effects are plain data too; Rendering, mixing and mastering lists them.

Size limits

A song is at most MAX_BARS (512) bars and MAX_SECONDS (20 minutes) long, and has at most MAX_TRACKS (64) tracks and MAX_TRACK_SECONDS (12,000, such as 20 tracks of 10 minutes), because a render holds every track in memory at 48 kHz, 384 KB a second. Blueprint::check_size enforces it after every script and edit, and render::render refuses a bigger project; it counts the arranged tracks, where a pattern with several sounds is a track for each.

The project

compose::arrange (in compose/arrange.rs, with cycle_spans and part_cycle) turns a blueprint into a Project:

fieldmeaning
title, genre, bpm, key, swing, humanize, seedcopied from the blueprint
barsthe total length
sectionsname, kind, start_bar, bars, energy per section
chordsthe chord track: one ChordSpan (start, length, chord) per chord, across the whole song
tracksthe tracks, each with a role, a sound, notes or clips, a transpose, a chop, a choke group and a mix
mixthe blueprint’s mix plan, with the arrangement’s automation and fixed inserts added to the buses

A Note is {t, d, p, v}: start and duration in beats, pitch, velocity. A Clip places a loop: start and duration in song beats, an offset into the warped loop, a gain and fades, and once for a take’s, which plays to the recording’s end and not again. These are the first three notes of the kick track in the song above:

{"name": "kick", "role": "kick", "sound": {"kind": "drum", "voice": "kick", "params": {...}},
 "notes": [{"t": 0.0, "d": 0.25, "p": 60, "v": 0.9350958}, {"t": 1.0, "d": 0.25, "p": 60, "v": 0.93947273},
           {"t": 2.0, "d": 0.25, "p": 60, "v": 0.9417365}], "clips": [], ...}

What arranging does

For every section, arrange:

  • drums: tiles the lane’s pattern for the section’s variant (or main) across the section. In a build, the snare (or clap) lane turns into a roll over the last half of the section (at least one bar, at most four), speeding up from quarters to thirty-seconds, and the kick drops out for the last bar. With fills, the genre’s drummer ends the phrases: a turn at the end of four bars now and then, a fill at the end of eight and of the section (up to its gap, when it has one), each played the same way across the lanes, as that genre’s drummers end theirs (Drummers).
  • parts: writes one cycle of each part per progression, once, and tiles it across every section that plays the part with that progression, so a hook comes back the same each time. A lead’s cycle is at least 16 beats.
  • loops: one clip per section the loop plays in.
  • pattern tracks: evaluates the code and places each section’s notes from the pattern’s first cycle, one bar per cycle. A pattern with several sounds becomes one track per sound, named <track>.<sound> (drums.bd), each mixed by its own role.
  • transitions: a crash on every impact downbeat and every 8 bars of a drop or hook, impacts and downlifters on impact sections, a riser of up to riser_bars over a build, a reverse crash into the next impact.

Then, across the song, it drops muted tracks (and, when any track is soloed, every track that is not), cuts a beat of silence before every section with gap (risers and reverse crashes play through), and adds automation to the music and bass buses: a lowpass that opens from 350 Hz across filter_in sections and closes towards 500 Hz over the last 60 % of a final outro, and a highpass that sweeps from 10 Hz to 900 Hz across each build. Finally it adds three inserts every song gets unless its genre already has them: width 1.25 with mono below 160 Hz on music, mono below 140 Hz on bass, and light tanh saturation on drums.

Arranging is deterministic: a section’s turns and fills draw from seed ^ hash("drummer") ^ section index, parts from their own seeds.

Slices

Project::slice(from_bar, to_bar) cuts a project down to a range of bars, shifting notes, clips, chord spans, sections, and the automation curves and time-based effects (tape stop, stutter, reverse) of tracks and buses. Evolution auditions candidates on slices, and the tests render slices to stay fast.

Saving and loading

A blueprint’s JSON is its save format: blueprint.json in every song folder, and what open and claudius render read. Most fields have serde defaults (no loops, no pattern tracks, an empty lineage, a main variant), so a file that leaves them out still loads. A pattern track whose code no longer evaluates is skipped when the song is arranged, without an error. Scripts check a pattern when they add it, so that takes a hand-edited blueprint, or one saved by a version of claudius that accepted more (a pattern with a speed-up above 256 from before that limit). song::write_folder writes a project to project.json in every song folder only so that claudius judge can check the arrangement and theory of a rendered file; nothing reads it back as a song.

Saved songs keep opening

Every claudius opens the songs earlier ones saved. Blueprint::from_json is the one way a blueprint.json is read (open in the studio and the MCP tools, claudius render, --on, --from). It refuses a format newer than BLUEPRINT_FORMAT with a newer claudius wrote it, in blueprint format 2, and this one reads up to format 1: update claudius to open it, and reads the rest.

crates/claudius/tests/compat/v<version>/ holds what each release saved: a song in each genre and one edited by a script (<name>.json), with the song.rhai printed for each (<name>.rhai). tests/compat.rs opens every one, checks it the way loading does, arranges it, and runs each script on its song; a field added without a default fails it, naming the file and the field. The folders of 0.1.0 and 0.2.0 came from those releases’ own programs. The release PR adds its version’s (cargo xtask release prepare runs examples/compat_fixtures.rs), so each release is held to every one before it.

Each release’s folder/ is a song’s folder, with what is read back of one: blueprint.json, the project.json that claudius judge and claudius publish read beside it, song.rhai, and, from the release after 0.5.0, the history.jsonl the studio keeps. The folders of 0.1.0 to 0.5.0 are what each release’s own claudius make --genre house --seed 7 --short wrote. tests/compat.rs opens each song, reads its project and runs its script, and the session’s tests/compat.rs replays each history to the song in its folder with its steps to undo and redo: a log that no longer read would open as a history begun anew, and nothing else would say so. The release PR writes its history with examples/compat_history.rs in claudius-session.

A change the songs cannot take as they are (a field that changes meaning or goes away) raises BLUEPRINT_FORMAT, and from_json gets the step that upgrades the JSON of the format before it; the fixtures of the earlier formats then test that step.

Composition and theory

Composition happens in two places. compose::generate makes the creative choices and writes them into a blueprint: which progressions, which form, which drum patterns, which style and seed for each part. compose::arrange turns the stored choices into notes, calling the writers in theory/ for every part. Both are deterministic, so a blueprint is all it takes to get the same notes back.

modulewhat it does
genres.rsloads the genre profiles from data/genres/*.json and your genres folder
compose.rsgenerate, new_part, styles_for, part_sound, kits, flipped samples (add_sample)
compose/arrange.rsarrange, cycle_spans, part_cycle
theory/scale.rspitch classes, the seven modes, keys, scale degrees
theory/chord.rschord qualities and symbols, Roman numerals, voicing
theory/progression.rsthe progression library, the Markov generator, substitutions
theory/rhythm.rsdrum hits, lane templates, euclidean rhythms, rolls, swing, syncopation
theory/drummer.rshow each genre’s drummers end their phrases: turns and fills
theory/idiom.rsidioms: cells, turns and phrases, written in notes over the chords, varied by take
theory/bass.rsbass lines in the genres’ idioms and twelve styles
theory/comp.rschord parts in the genres’ comping idioms
theory/lead.rsthe genres’ lead idioms
theory/melody.rsleads’ motifs, arpeggios and chord parts’ rhythms

Genres are data

Everything a genre knows is in one JSON file. The fields generate reads:

fieldwhat it decides
bpm, swing, humanizeranges to draw from, and the looseness
modesweighted modes for Markov progressions
harmony, markov, extweighted progression styles from the library, the chance of a Markov progression instead, and its chord extensions (0 triads, 1 sevenths, 2 ninths)
bars_per_chordweighted chord lengths
formsone or more forms, each a list of sections with layers, energy and flags: templates, which each song varies
drumslanes: a voice, a step template or a euclidean rhythm, named variants, parameter ranges, Apple Loops subtypes for one-shots, a choke group, whether to tune the kick to the key, a mix, and a late_ms range its feel is drawn from (ms behind the beat: a laid-back snare [8, 24], a pushed kick [-6, 0])
kitsweighted sample-pack drum kits; the weight left over keeps the lanes’ own sounds
kit_mixthe chance that a drum lane plays a kit of its own instead (another installed kit, or its synthesized voice); 0.3 when not given
paletteby role, how a part’s sound is drawn beyond its own presets: core, the chance of one of its own, a weight for each kind (synth, or an instrument category: strings, brass, mallets, electric piano …), and retro, whether it plays the sounds of an era gone (synthwave’s FM piano and string machine)
partsmelodic parts: a role, weighted-by-repetition lists of presets and styles, a register, a density range, voices, voicing, arpeggio rates, a chance of leaving the part out, its own core (an acid line stays acid), a mix, and layers, the sounds it stacks into a rack: each "$" for the sound drawn or a synth preset by name, with a band, level, duck, transpose and fx (trap’s 808 and the 808 saturated for grit, future bass’s bass over a sine sub an octave down). A part that doubles it plays one sound
loopsApple Loops parts: instrument, subtype, genre and mood filters, whether tonal
transitionsriser, impact, downlifter and reverse crash switches, the riser length
mixthe LUFS target, the reverb and delay, bus and master chains, sidechain release, per-role level offsets; each song varies the reverb, the delay, the sends and the colours
query, altswhat the ears should hear ("house music") and the genres it is most often confused with
accepted_flawsproduction flaws of the ears’ that are the genre’s sound, left out of its production reading (lofi’s hiss)

A list like "styles": ["offbeat", "syncopated", "offbeat"] weights by repetition: offbeat is picked two times in three. A preset entry can name alternatives separated by |: "piano|epiano" plays the sampled piano when its pack is installed and the epiano synth otherwise. part_sound explains why that does not change the rest of the song.

How generate writes a song

generate_inner draws, in order, from forks of one generator seeded with the song’s seed (see Determinism):

  1. the tempo and the swing, from the genre’s ranges; the tempo is drawn even when one is given, which then replaces the result, so that a tempo of your own changes nothing else;
  2. harmony: with chance markov (or when the genre lists no styles), a Markov progression of 4 chords (2, one time in five) in one of the genre’s modes; otherwise a progression from a library style, in that style’s mode. The tonic is drawn the same way, always, and a key of your own replaces the tonic and the mode. Progression B is another progression of the same style half the time, else a substitution of A worked out in the style’s mode. Chord length comes from bars_per_chord; a one-chord progression lasts 4 bars, and a song with eight chords in A or B plays 2 bars a chord at most. Then, each from a fork of its own, a four-chord A is answered with chance 0.4 and B with 0.25, when the eight chords last 16 bars or less. When a key of your own has another mode, the progressions then move to it the way key() moves them: diatonic chords keep their degree and take the new mode’s quality, borrowed chords keep their sound spelled in the new mode, and applied chords stay as written;
  3. form: one of the genre’s forms, made the song’s own by form::vary (below), then every section halved (to at least 4 bars) with --short; a form asked for by number (Options::form) plays as written. In a form with verses and hooks, the hooks play a chorus of their own with chance 0.35: progression C, another progression of the style or a substitution of A, never what A or B play (as drawn or answered, or the first half of their eight chords) and no longer a loop than A’s or 16 bars, worked out in the style’s mode and moved to the key like the others;
  4. drums: per lane, a one-shot from the library (with chance samples, 0.75 unless --samples or a script says otherwise, the same for make, scripts and the studio’s new songs, when there is a library) or a synthesized voice with parameters in the genre’s ranges (or half way from the voice’s default towards a random point), the kick tuned to the key; then a 4-bar pattern per variant from the lane’s template (or one of the genre’s other grooves on it, alts) or euclidean rhythm; then, when a kit was drawn, the kit’s drum for the lane (the electronic genres may draw uzu’s and FreePats’ synthesizer percussion besides the drum machines);
  5. parts: per part, unless its optional chance leaves it out, a preset (its own, or one of the two its closest genres play for the role, a preset of one sound such as an 808 or a reese kept where it belongs), a style, a density and a seed of its own. A chords, keys or pad part on a single-voice synth patch, or on an instrument recorded in mono (FreePats’ FM piano, say), gets a light chorus so it does not sit dead centre;
  6. loops from the library, when there is one;
  7. transitions: a crash (recorded or synthesized) and the genre’s switches;
  8. the mix from the genre, made the song’s own by colour::vary (below), and a title from two word lists.

With --loops (a loop family), the song is generated with the family’s tempo and key, both progressions become the chords read from the family’s harmony loop, one chord per bar, and the family’s chord, bass and beat loops replace the parts and lanes of those names.

A form and a mix of its own

A genre’s forms are templates. form::vary changes one for its song, each change drawn with a chance of its own, so that songs of a genre rarely share a form (24 songs of house, lofi, trap, dance-pop or techno play at least 18):

changechance
a section another length its kind takes: an intro or outro 4, 8 or 16 bars, a verse, hook or break 8 or 16, a build 4 or 8, a drop 16, 24 or 32, a groove 8, 16 or 320.45 a section
a third verse and hook, after the last hook before the first break (or after the last hook)0.3
a bridge, 8 bars of the melodic parts without drums or bass on progression B: before the last hook or drop (and the build into it), in a song of two or more with no break between the first and the last, or after a song’s only hook or drop when more than the outro follows0.35
the last hook or drop played twice, the second at full energy0.3
a lift, a 4-bar build without the kick at the energy of the section before it, into a first hook that has no build, in a genre with risers0.35
no intro (a cold start); an intro of only its drums (when they have the kick) or only its melodic parts0.15; 0.25
no outro (the song ends on its last section); an outro of half its tracks0.15; 0.25
the first verse without one melodic part (never the bass); a later verse with one more track from the next hook; the first hook without one of its melodic parts (never the bass)0.3; 0.35; 0.25
any other section between the peaks (not an intro or outro) without one melodic part (never the bass), or else with one more track the hooks and drops play0.3; 0.2 a section
a verse or groove on the drums’ alt pattern, where the genre’s lanes have one0.25 a section
fills switched in a verse, groove or drop; a gap switched before a hook or drop; the intro’s filter sweep switched0.25; 0.3; 0.4
each section’s energy movedup to ±0.05

The song then keeps to 2 to 5½ minutes at its tempo, its longest sections shortened or its shortest lengthened, and each repeated section gets a name of its own (verse3, chorus4). A section only leaves out what it can: a stripped intro, a thinned outro or a bridge keeps a drum lane or a part that every song of the genre has, never only an optional part or a loop. A section’s energy moves with what it plays, so that the critic still hears its loudness follow its energy: 0.15 for a kick gained or lost, 0.1 for a bass, 0.05 for anything else, at most 0.2 for a section left without drums, and 0.1 less for an intro whose filter sweep is switched on (0.1 more when it is switched off).

colour::vary does the same for the mix:

  • the reverb: its decay up to 1.5 times longer or shorter (0.6 to 8 s), its damping ±0.15, its pre-delay −10 to +25 ms, its width and its low cut;
  • the delay: half the time another length (a sixteenth, a dotted sixteenth, an eighth, a dotted eighth, a quarter or a dotted quarter), its feedback, and ping-pong switched three times in ten;
  • each part’s reverb and delay sends;
  • four parts in ten get a colour by role, unless they already have an effect of its kind: on a pad a chorus, phaser, flanger, slow autopan or more width; on chords and keys a chorus, phaser, tremolo, autopan or tape; on a lead tape, a tube, a chorus, phaser or flanger; on an arp an autopan, bitcrusher, phaser or chorus; on a bass a tube, tape or a little wavefolding. A phaser’s or bitcrusher’s mix rises in the hooks and drops;
  • three songs in ten high-pass the music bus in the breaks, at 250 to 500 Hz;
  • the drum bus’s compressor ±3 dB in threshold, its ratio, attack and release each up to 1.3 to 1.6 times higher or lower, and in a third of songs whose drum bus does not saturate them already, tape or a tube on it (1.5 to 4 dB, mixed in at 30 to 60%);
  • a quarter of songs whose music bus does not widen it already widen it 8 to 25% above 150 Hz;
  • half the time, the master’s saturation becomes tape, a tube or tanh.

Each song also plays its genre’s drums its own way: a lane with other grooves (alts) plays one of them by its chance instead of its template, drawn from a stream of its own; each part plays one of its styles (borrowed from the genres that sound most like its own, a genre’s idioms kept to it), a few semitones higher or lower than the genre writes it.

Both draw from forks of their own, one for each change, so a song’s tempo, harmony, drums and parts stay what its seed makes them whatever its form and mix draw, and a new or changed rule leaves the other changes’ draws as they were.

Keys and modes

A Key is a tonic pitch class (C = 0) and one of seven modes: major, minor, dorian, phrygian, lydian, mixolydian and harmonic minor. Key::parse reads "Am", "A minor", "F# dorian", "Eb", "C#m". A key spells with flats when its relative major sits on the flat side of the circle of fifths (Bb major, D minor), with sharps otherwise.

The functions the writers lean on: degree_pitch(d, base) (the pitch of scale degree d counted from the tonic at or above base), snap (the nearest scale tone, ties going down), step (move by scale steps), index_of and from_index (between pitches and diatonic indices), and transpose_from (the shortest way between two tonics, −6 to +5 semitones), used for loops and key changes.

Chords

Chord is a root, one of 20 qualities (triads, sus2 and sus4, sevenths, sixths, add9, ninths, minor 11th, power chords) and an optional bass note. Chord::parse reads symbols (Am7, F/A, Cmaj7, Bbm9, Dsus4, E5, and Δ, ø, ° spellings), and symbol prints them back.

Roman numerals

chord::roman(numeral, key) reads a numeral in the key’s own mode, which is why progressions survive a change of key:

  • the degree is counted in the key’s mode: VI in A minor is F, IV in D dorian is G;
  • case gives the quality: VI major, vi minor; a suffix overrides it (7 dominant on upper case and minor seventh on lower case, maj7, 9, 6, add9, °, ø7, °7, +, sus4, 11);
  • b and # before the numeral move the root: bVII, bII;
  • / and a numeral makes an applied chord, read in the key of the target: V7/V in C is D7;
  • / and a note name sets the bass: I/E.

roman_of(chord, key) goes back, choosing b or # for roots outside the scale. A script’s prog("A", "Am7 Fmaj7") stores chord names as numerals this way.

Voicing

chord::voice picks the actual pitches of a chord inside a register, for n voices, given the previous voicing:

  1. With more chord tones than voices, it drops the fifth, then the root (the bass has it). With fewer, it tries doubling the root, then the fifth, then the third, each try costing a little more.
  2. It enumerates every way to place the tones inside the register, and scores each: distance from the span the style wants (close 3 to 14 semitones, open 10 to 24, spread 17 to 34); a penalty for intervals under a fourth below E3 (MIDI 52), where they turn to mud, and for semitone clashes below E4; and the voice-leading distance from the previous chord (the sum of each voice’s movement), or, for the first chord, the distance from the middle of the register.
  3. It takes the best. When the second best is within one point, it takes the second three times in ten, so repeated progressions do not voice identically every time.

power is the exception: a power chord, as a rock guitar plays it, is the root, the fifth above it and, with three voices and room, the octave. It has no third, so a distorted guitar stays clear. Its root moves to the root nearest the last one’s.

The critic checks the result: voice_leading_<track> is the average movement per voice per chord change, and above 4.5 semitones it raises an issue. A part of power chords alone is not checked: a guitarist moves a power chord as one shape, its voices in parallel.

Progressions

The library in progression::STYLES has eleven styles, each a mode and five to thirteen progressions: minor_epic, minor_dark, minor_soul, dorian_vamp, phrygian, harmonic, minimal, major_pop, major7_jazz, minor_80s and mixolydian. For example minor_soul holds i7 iv7 VII7 IIImaj7 and iiø7 V7 i7 i7; genres weight the styles they use (house: minor_soul 0.35, minor_epic 0.25, dorian_vamp and major7_jazz 0.2 each). Some progressions bend the mode as songs do: borrowed chords (I iii IV iv, I bVI bVII I), applied ones (I V/vi vi IV, Imaj7 VI7 ii7 V7), a tritone substitute (ii9 bII7 Imaj9 Imaj9), the Neapolitan (i VI bII V), and two of eight chords (I V vi iii IV I IV V). every_library_progression_reads_in_its_mode in tests/theory.rs reads every numeral of every style in all twelve keys.

An answer (progression::answer) is what a player does with a four-chord loop the second time round: the loop, then the loop again with another way back to its first chord. The ways, weighted:

waywhenweightexample, the second time round
the dominant of the first chordthe first chord is not diminished2I V vi IV → I V vi V7
in a major key: the flat seventh, the minor fourth, or the flat sixth and seventh, borrowed from the parallel minorthe loop starts on the tonic1 eachI V vi IV → I V vi bVII, I V vi iv, I V bVI bVII
in a minor key: the major fourth (as dorian has it), the sixth and seventh, or the flat second (as phrygian has it)the loop starts on the tonic1, 1, 0.5i iv i v → i iv i IV, i iv VI VII, i iv i bII
a suspension of the last chordits fourth and fifth are in the key1I vi IV V → I vi IV Vsus4

A way the loop already ends on is no answer. In a loop of sevenths, a borrowed chord comes as the mode it is borrowed from has it (bVII7 from the parallel minor, IV7 from dorian, bIImaj7 from phrygian). Half the time one chord between the first and the new ending is coloured as well: a seventh or ninth with the key’s own notes, or a suspension whose notes are in the key. answer says what it did (answered, ending on the minor fourth, borrowed (iv), chord 7 coloured (vi7)).

The Markov generator walks a 7 by 7 table of transition weights between scale degrees, one for major and one for minor keys, written by hand around functional harmony: tonic to subdominant to dominant to tonic, plus the stepwise and third moves pop and EDM use. A progression starts on the tonic (three times in four) or the sixth degree, never repeats a chord immediately (its weight is cut to a tenth), and is accepted only when its last chord leads back to its first with a weight of at least 1; otherwise it tries again, up to 64 times. The chords are the diatonic chords of those degrees, extended to sevenths or ninths by the genre’s ext (a major chord whose seventh is minor becomes a dominant seventh, and a chord whose ninth is not in the key, such as the fifth of a minor key, stays a seventh).

Substitutions change one chord in a way a musician would, and say what they did, for the song’s history (the examples are on i VI iv VII in A minor):

substitutionexample
a chord a third away (up a sixth or up a third, in the scale)chord 2: VI -> iv (third relation)
richer or plainer: a triad gains the key’s own seventh or ninth (on the fifth of a major key a dominant seventh, never a major one), an extended chord loses itchord 1: i -> i7 (extended)
the chord before becomes the secondary dominant of this onechord 3: iv -> IV7 (secondary dominant of VII)
modal interchange: the same root with the opposite thirdchord 4: VII -> vii (borrowed from the parallel mode)
a suspension (sus2 or sus4) whose notes are in the key, never on diminished chordschord 2: VI -> VIsus2 (suspension)
swap two neighbouring chordsswapped chords 2 and 3
rotate the progressionrotated the progression by 2

generate uses them to derive progression B from A (and C, a chorus of its own, half the time), and evolution’s harmony_sub operator applies one at a time.

Rhythm

Lane templates. A drum lane’s habits are a LaneTemplate: a hit probability for every sixteenth (16 per bar, 32 for two bars), where 1 or more always hits; a velocity range; ghost, the chance of a soft extra hit on an empty step; rolls, the chance per beat of a trap roll; and vary, how often the last bar of a phrase deviates. generate samples one bar from it, repeats that bar over the 4-bar pattern, and sometimes swaps the last bar for a varied one (probabilities raised by 1.6 and halved at random), so the pattern loops like a programmed beat instead of shuffling every bar. Velocities follow the metrical weight of the step: the downbeat strongest, then beat 3, then beats 2 and 4, then the eighths, then the rest.

The house hat template reads like this, a pattern a person would program:

{"steps": [0.7, 0.3, 0.25, 0.35, 0.7, 0.3, 0.25, 0.35, 0.7, 0.3, 0.25, 0.35, 0.7, 0.3, 0.25, 0.5],
 "vel": [0.35, 0.8], "vary": 0.2}

Trap rolls replace a whole beat with a burst of thirty-seconds, sixteenth triplets, a half beat of thirty-seconds, or thirty-second triplets, with a velocity ramp up (six times in ten) or down. They fall mostly on the last beat of a bar and rarely on the downbeat.

Trigs. A hit may carry a Trig, what its step does beyond striking, as a drum machine’s does. arrange plays a lane’s pattern round by round over each section (lane_notes):

  • When. A step’s condition counts the times round from the section’s start (Cond::plays), and its chance is drawn for each time round from a generator seeded by the song, the lane, the section, the time round and the step. So a song sounds the same in every render, and different from bar to bar.
  • How. A step that plays becomes its strokes (Trig::strokes): a flam’s grace stroke the flam’s milliseconds before at half the velocity, then the ratchet’s strokes spread evenly over the sixteenth, their velocities ramping up to the hit’s or down from it by three quarters at most.
  • The sound. Its pitch goes on the strokes’ notes. Its nudge, decay, tone and pan go with them as a Lock, and render adds the nudge after swing (swing moves only notes exactly on an off-beat sixteenth). A synthesized drum’s decay and tone are its own settings, rendered and cached as another sound; a sample is cut shorter by a falling curve and blended towards itself low-passed at 2 kHz (darker) or away from it (brighter). The pan is a balance.

A lane’s own time. A time round of a lane lasts its period: its own length in sixteenths (at most its pattern’s; else its pattern’s bars), divided by its speed. lane_notes plays the pattern’s hits up to that length, their times divided by the speed, round after round over the section, so a lane twelve steps long against the others’ sixteen is a polymeter, and conditions count its own times round. A lane’s own swing goes on its track (Track.swing), and render uses it for that track’s notes, its chokes and the duck curves it drives, in place of the song’s.

Grooves. A Groove is a timing in beats and a velocity factor for each of the sixteen sixteenths of a bar (rhythm::groove names claudius’ own; the song keeps others in Blueprint.grooves). Groove::apply moves a stroke exactly on a sixteenth of the song by groove_amount of its position’s timing, and scales its velocity by groove_amount of the way to its accent; strokes off the grid (32nds, triplets, a ratchet’s inner strokes, a flam’s grace stroke) keep their place. A lane in a groove plays straight unless it has a swing of its own, so the song’s swing doesn’t add to the groove’s on the sixteenths it leaves where they are.

Euclidean rhythms spread k onsets over n steps as evenly as possible (rhythm::euclid, computed with the (i * k) % n < k formula, which gives the same patterns as Bjorklund’s algorithm up to rotation). A lane with "euclid": [5, 16] gets a random rotation and a sparse variant with half the onsets.

Builds. snare_roll plays quarters, then eighths, sixteenths and thirty-seconds, rising in velocity, on the snare (or the clap) over the last half of a build.

Swing delays every off-beat sixteenth: within each eighth, the second sixteenth moves from halfway to swing of the way through (0.5 is straight, 0.66 a triplet feel). It is applied when notes are rendered, so the blueprint stays on the grid.

Measures for the critic and analysis: syncopation (Longuet-Higgins and Lee: an onset on a weak position followed by silence on a stronger one scores the difference in metrical level) and density (onsets per beat).

Drummers

A pattern loops; a drummer ends phrases. Each genre has a drummer (theory::drummer), and in a section with fills it ends the section’s phrases as that genre’s drummers do. At the end of four bars it plays one of its turns, small and on a lane or two, and at the end of eight bars and of the section one of its fills (up to the beat of silence before the next section, when there is one; a build ends on its roll instead). Each is a chance, as often as the drummer plays them, and it never plays the same one twice running when it knows another. A turn or fill is drawn once per phrase from seed ^ hash("drummer") ^ section index and played the same on every lane, so the kick and the snare of a break trade where they should and the hats stop together.

Turns and fills are written lane by lane, in cells that end where the phrase does:

stepwhat sounds
X, x, oa hit: accented, played, a ghost note
h, m, l, fa hit pitched high, mid, low, on the floor, as a drummer goes down the toms
.a rest: what the lane played there is left out

A cell is in sixteenths, unless its steps follow 3: (eighth-note triplets), 6: (sixteenth-note triplets) or 8: (thirty-seconds), and a < at its start plays them louder and louder: <8:xxxxxxxx is a beat of thirty-seconds rising, a trap hat roll. A fill names its lanes by what they play, and plays on the song’s lane that plays it or the nearest it has: a snare fill on the clap, or the rim in reggae’s kit; toms on the congas or the percussion, or pitched on the snare in synthwave’s, as its drum machine’s toms are. A fill whose lane the song has nothing like isn’t played. While it plays, the lanes it leaves alone play on, or the drummer’s hands leave the hats and the ride (the toms down the kit), or every lane stops (a beat of silence for the tag).

drummergenresturnsfills
boom_bapboom bap, alt hip hop, chipmunk soul, gangsta rap, hip hopa kick pushed onto the last sixteenth, a kick double on three, a ghost dragged into the backbeatkick and snare trading eighths, the snare three times on four, the beat stopped after the kick on three, a beat of silence
traptrap, cloud rap, emo rap, rage, plugg, phonk, crunk, hyperpopa hat roll in thirty-seconds, hats in sixteenth triplets, a kick skipsnare triplets over triplet hats, a snare roll in sixteenth triplets, a beat or two dropped out
drillUK, NY and Chicago drillhats in triplets, hats skipping in sixteenth triplets, a kick slidesnare flams late in the beat, a kick and two triplet snares, a beat dropped out
househouse, deep house, tech house, filter house, electro house, progressive house, slap housea clap on the last sixteenth, the kick out for a beat, the open hat lifteda clap roll, the kick out for two beats, a conga run
technotechno, dub techno, hard techno, melodic technothe kick out for a beat, a percussion skipthe kick out for two beats or a bar, a soft clap rising
trancetrance, big roomthe kick out for a beat, a clap on the last sixteentha snare roll through the bar, eighths into sixteenths, a roll with the kick out
hardhardstyle, gabberthe kick out for a beat, the kick doubled on the last beatthe kick rolled in sixteenths, the kick in triplets, a snare roll through the bar, the kick out for two beats
clubJersey clubthe kick in triplets on the last beat, the snare doubledthe kick in triplets for two beats, a snare roll in sixteenth triplets, a beat of silence
dnbdrum and bass, jungle, breakcoreghost notes after the backbeat, the kick on the anda snare rush, a break edit, a thirty-second stutter
reggaereggaethe rim into the next bar, the open hat on the anda triplet roll into the drop, toms down in triplets
dembowreggaeton, baile funkthe timbal’s sixteenths, the rim pushed aheada timbal roll, a stop on the last beat, a snare rush
afroafrobeats, amapiano, afro housea conga pickup, the shaker out for a beat, the rim into the next bara conga run, the kick out under the log drum, a talking drum
garageUK garage, grimea snare skip, a kick skip, a rim skipa shuffled snare run, a beat of silence
halftimedubstep, future bassthe kick doubled, a ghost snaresnare triplets, a rush, a stutter, a beat of silence before the drop
rockart rock, neo-psychedeliathe snare doubled, the kick pushedtoms down the kit, the snare into the toms, a bar of snare and toms, sixteenths on the snare
funkfunk, g-funk, new jack swingghost notes around the backbeat, kicks on the and and the a, a dragsixteenths accented in threes, four on the snare, toms
disconu-disco, dance popthe snare on the last sixteenth, the open hat on the andsixteenths on the snare, four on the snare, toms
jazzylo-fi, jazz rap, neo-soulghost notes, a lazy kick on the and, the hats out for a beata soft drag, a soft roll, a beat of silence
synthwavesynthwavethe snare doubled, the kick pushedtoms down the kit, the snare into the toms, sixteenths on the snare
breakbeatbig beat, trip hop, IDMghost notes after the backbeat, the kick pusheda break edit, a rush, a stutter, a beat of silence
rnbR&B, 90s R&B, alt R&Bhats in sixteenth triplets, a ghost before the onea drag, snare triplets, a beat of silence
steadyambient, and a genre of your ownthe kick out for a beata roll, triplets, a rush

The drummer is the one of the genre the song’s backbeat lane (its snare, else its clap) plays as, else the song’s: drums generated from another genre bring its drummer with them, and lane("snare", #{ genre: "funk" }) gives a song funk’s fills. A fusion’s drummer is its last genre’s, which plays its drums.

Bass lines

A bass part is written in one of the genres’ idioms or in one of the motifs below (bass::write).

bass::bassline writes a one-bar motif once per part and transposes it onto every chord, which is how a producer writes a bass line: one groove, followed through the changes. The motif’s intervals are relative to the chord’s bass note, and some are resolved against the sounding chord (its third, its fifth), so the line fits every chord. The root of each chord is the one nearest the previous root, unless that strays more than 7 semitones from the middle of the part’s register.

stylethe motif
sustain, reesethe root held for the whole chord
pulsequarter notes
root8eighths on the root, sometimes an octave jump at the end
octaveeighths alternating root and octave
offbeatthe off-beat eighths of house, sometimes a pickup on the last sixteenth
rollingthe three sixteenths after each beat, around the kick
syncopatedone of five sixteenth grooves, with octaves, fifths and thirds
kick_followa note on every kick of the kick lane’s main pattern, held to the next, with occasional octave or fifth jumps and slides: the trap 808
glidethe same, long, gliding up an octave or to the fifth into the end of each two-bar phrase: a trap hook’s 808
drillthe same, moving through the key’s tones over the root (its third, fourth, fifth, seventh, octave), sliding from note to note
acidsixteenths on a pentatonic, with rests, accents and slides, snapped to the key

A style the writer does not know plays sustain.

Bass idioms

An idiom (idiom::Idiom) is the way a genre’s bass players play, as they would: a few bars a player plays over a chord (its cells), the bars they end a phrase on (its turns), how much of each step they hold a note for, and how often they vary the details from bar to bar. A take plays one of the cells, answers it with another in the second bar of a four-bar phrase half the time, and ends every phrase on a turn, so that a line has phrases instead of one bar over and over. A cell is a bar of steps, sixteen sixteenths (or 12 or 24, in triplets):

stepthe note
., -a rest; the note before going on
R, rthe chord’s root, its bass note; softly
L, 8the root an octave down, an octave up (the other way where that does not fit the register, and the fifth that way where neither does)
3, 5, 7the chord’s third, fifth and seventh above the root (the key’s seventh on a chord with none)
2, 4, 6the key’s second, fourth and sixth above the root
Aan approach: a semitone under the note after it, or over it coming down, or from the other side when that is the note before (an enclosure)
Wa walk: the key’s step from the note before towards the note after, or the semitone between them
xa dead note: short and soft, on the pitch before
', ~before a note, an accent; after one, a slide into the next

Reggae’s one drop, for one, is .... R-.R -.5- 8-.7: nothing on the one, the root on beat two and before three, the fifth around the drop, the octave on four and the seventh leading down to the next bar. The details a take varies, each with a chance of its own: a dead note in an empty step after a note, a root off the downbeat moved an octave, the last note before a new chord turned into an approach to it, the new chord’s first note pushed an eighth ahead of its bar, a note off the beat left out, a slide into the next note. Notes are played harder on the downbeat, the beats and the eighths than in between, and one at a time, each ending where the next begins unless it slides into it. Each chord’s root is the one nearest the note the line comes to it from, low enough in the register to leave room for the octave above it (within an octave of the register’s bottom at least, so that every root has a place).

A take’s cells come from the high half of the part’s seed and its details from the low half (and the progression), so a variation of a take keeps its rhythm and changes what it plays around it, and a new seed is another take.

idiomhow it playsgenres
one_dropnothing on the one, roots, fifths and octaves around the drop on three, room betweenreggae
steppersa note on every beat, roots, fifths and octavesreggae
slapthe one hit hard, octaves popped on the offbeat sixteenths, dead notes betweenfunk
funkfingerstyle sixteenths: syncopated roots, fifths and octaves, ghosted, pushed into the changesfunk, G-funk, new jack swing, nu-disco
discoroot and octave in eighths, walking up into the next chordnu-disco, filter house, dance pop
garageskipping: long and short notes off the beat, octave jumps, swungUK garage
dembowthe root on the three-three-two of the tresillo, held under the kickreggaeton
afrosmooth and syncopated, on the tresillo’s pushes, gliding into the next chord earlyafrobeats, afro house
log_drumshort pitched hits off the beat, jumping octaves and fifths, bending now and thenamapiano
walkinga note on every beat, chord tones and walks, a chromatic approach into each changejazz rap, lo-fi, boom bap, neo-soul
neo_soulbehind the beat and melodic, passing tones and ghosts, sliding into the chordsneo-soul, R&B, alternative R&B
souleighths through the chord tones, pickups into the changeschipmunk soul, boom bap
rnbsmooth syncopated sixteenths, sevenths and octaves, slides into the next note90s R&B
gfunkthe Moog bass: laid back and syncopated, sliding up to the octave and backG-funk, gangsta rap, alternative hip hop
boom_bapthe root held from the one, a pickup into beat three, long round notesboom bap, hip hop, jazz rap, gangsta rap
lofisparse and behind the beat, a fifth on the and of two, an approach into the changelo-fi
two_steplong notes on the kicks of the two-step, the one and the and of threedrum and bass
jungle_duba deep sub moving in half notes under the break, reggae’s roots and fifthsjungle, breakcore
halftimelong notes and short restarts around the snare on threedubstep
dubdeep and held, with room around itdub techno
house_organshort syncopated hits, three, three and two, around the four on the floorhouse, deep house, electro house, filter house
deepwarm and longer, off the beat, the fifth at the end of the bardeep house, afro house
techrubbery short sixteenths between the kicks, a groove more than a linetech house
new_jackpunchy swung sixteenths, octaves and fifthsnew jack swing, 90s R&B
grimesparse square-wave stabs, a lot of roomgrime
trip_hopslow and heavy, the root held, a late second notetrip hop
big_beatdistorted, syncopated eighths and sixteenths with the octavebig beat
rockeighths on the root, a fill up through the fifth into the next chordart rock, neo-psychedelia
drivesixteenths on the root, accents on the beats, up to the octavesynthwave

Leads, arpeggios and chord parts

Leads play one of the genres’ lead idioms, or motif (melody::lead), which is built like a hook: a one-bar motif played in an A A’ A B phrase every four bars.

  1. The rhythm: 2 to 9 onsets in a bar, depending on density, drawn with weights that favour the strong sixteenths (or, for a syncopated lead, the off-beat ones), the first always on the downbeat.
  2. The contour: steps in the scale, in one of four shapes (an arch, falling, rising, zigzag), with a leap of a third or fourth now and then, always followed by a step back the other way, and kept within a range of 12 scale steps.
  3. The phrase: bar 2 (A’) repeats the motif two steps higher (one step lower in the second half of an 8-bar phrase), bar 4 (B) is a sparser answer whose last note is held, landing on the motif’s home note (the middle of the register, snapped to the scale) at the end of 8 bars and two steps above it otherwise.
  4. Each note is snapped to the key, and notes on strong beats (beats 1 and 3, or a note held a beat or more) move to the nearest chord tone of the chord sounding then. Notes outside the register are folded back in by octaves.

Arpeggios (melody::arp) voice each chord in close position at the bottom of the register, spread it over two octaves, and walk it up, down, updown, random or pinky (the top note alternating with the others), one note every rate beats.

Chord parts (melody::chord_part) voice every chord with voice leading and play it in a rhythm: sustain, half, stabs, offbeat, pump (eighths), syncopated or charleston; or in one of the genres’ comping idioms.

Comping idioms

The chord parts of a genre comp as its players do (comp::comp): idioms built as the bass idioms are, cells and turns in phrases, a take’s cells from the high half of its seed and its details from the low half, but written in chords. Each chord is voiced once, leading from the one before, and a step plays it:

stepwhat sounds
C, cthe chord, every voice (softly)
T, Bits top voice; its bottom voice
1 to 6one voice, counted from the bottom (the top one, of a chord with fewer)
U, Dthe chord strummed up from its bottom voice, down from its top, a few hundredths of a beat apart
xa muted strum: short and soft
., -, 'a rest; what sounds before going on; an accent on the next step

A take varies a soft chord into an empty step after a hit, leaves a hit off the beat out, pushes a new chord’s first hit an eighth ahead of its bar, and on the last sixteenth before a new chord plays that chord a semitone up, slipping into it, as gospel and funk players slide into their changes.

idiomhow it playsgenres
house_pianoshort stabs off the beat, three, three and two around the kickhouse, deep house, tech house, UK garage, amapiano, dance pop, progressive house
gospelchords pushed ahead of the beat, short and long, slipped intoneo-soul, jazz rap, funk, nu-disco, afrobeats, amapiano
lofi_compone chord on the one, another late in the bar, room betweenlo-fi, jazz rap, boom bap, trip hop
trap_keysthe chord held from the one, its top voice picked out above ittrap, the drill genres, hip hop, cloud rap, plugg
rnb_keyssmooth extended chords, pushed into the next, a passing chord slipped inR&B, 90s R&B, G-funk
balladthe chord broken from its bottom voice to its top and back, let ringart rock
bubblereggae’s organ: soft chords on the eighths, the offbeats pressedreggae
skanka short chord chopped on every offbeatreggae, afrobeats
scratchfunk’s chicken scratch: muted sixteenths, a chord hit hard on the backbeatfunk, nu-disco
strumdown on the beats, up on the offbeats, in eighthsneo-psychedelia, emo rap
palmthe power chord palm-muted in eighths, let ring to end a phrasepop punk
chugthe power chord’s root palm-muted in sixteenths, the whole chord hit hard off the beatnu metal
highlifea bright picked pattern through the chord’s upper voicesafrobeats, afro house
arpeggiothe chord’s voices one at a time, up and backemo rap, neo-psychedelia
legatostrings: each chord held, bowed again in a phrase’s last barneo-soul, G-funk, trip hop, ambient
ostinatostrings: one voice after another in short driving eighthsthe drill genres, art rock, gangsta rap
pizzicatoplucked strings: short notes through the chord, room betweengrime, UK drill
disco_stringsstabs off the beat, and a run up through the chord into the next phrasenu-disco, chipmunk soul
tremolostrings: the chord bowed in fast soft sixteenths, for tensionambient, trip hop
brass_stabsa horn section’s stabs: short, hard and syncopatedbig beat, crunk, new jack swing, Chicago drill, baile funk

Lead idioms

A lead plays its genre’s way of writing a top line, in the same notes as the bass idioms (idiom::line) in the lead’s register: its tones are each chord’s root, third, fifth, seventh and octave and the key’s steps above the root, so a riff follows the changes as a producer’s does, and its phrases end on a turn. A cycle of a lead is four bars at least, the progression played again until it is. A new seed is another take; a variation keeps its cells and draws its octaves, slides, approaches and pushes again.

idiomhow it goesgenres
gfunk_whinea high portamento synth gliding between long notes, from the fifth up to the octaveG-funk, gangsta rap
trap_bellsa dark motif in eighths, the fifth and the third round the root, an octave now and thentrap, plugg, cloud rap, rage, hip hop, hyperpop
drill_melodya piano or a flute bouncing in triplets, dark and slidingUK, NY and Chicago drill
afro_flutea bright call pushed ahead of the beat and answered, room betweenafrobeats, amapiano, afro house
dembow_hookthe melody on the dembow’s tresillo, three, three and tworeggaeton, baile funk
synth_leadlong notes leaping an octave, falling home at the phrase’s endsynthwave, trance, neo-psychedelia, dance pop, drum and bass, progressive house, slap house, hardstyle, melodic techno
trance_leadgated eighths up the chord to the octave and back, a falling run to end the phrasetrance, electro house, big room, progressive house, hardstyle
organ_riffshort notes off the beat, syncopated round the kickhouse, deep house, nu-disco, UK garage, amapiano
disco_hookbright octaves and chord tones in eighths, a run down to end itnu-disco, dance pop, future bass, hyperpop
horn_riffshort and punchy, the root and the fifth with rests between, answeredboom bap, funk, jazz rap, reggae, big beat, crunk, new jack swing, baile funk
reggae_hornsa long, lazy line answering the singer, from the fifth down to the rootreggae, jungle
riffeighths and sixteenths round the root, leaping an octavegrime, electro house, rage, dubstep, big beat, crunk, big room, progressive house, slap house, hardstyle, hard techno, gabber, hyperpop, jersey club, baile funk
garage_chopa chopped vocal: short stabs skipping off the beatUK garage, house, deep house, future bass, slap house, jersey club
lofi_melodylazy and sparse, on the sevenths and ninths, slipping into the next chordlo-fi, jazz rap, neo-soul, trip hop, 90s R&B, alt hip hop, breakcore
rnb_runslong smooth notes, and a run down the scale at the phrase’s endR&B, 90s R&B, alt R&B, neo-soul, new jack swing, G-funk
rock_leada guitar’s eighths up the chord and back, a bend into the rootart rock, neo-psychedelia, emo rap
ambient_linea note now and then, held long, an octave awayambient, cloud rap, plugg, alt R&B, art rock, emo rap, trip hop, drum and bass, jungle, IDM, afro house, melodic techno, breakcore
techno_stabone note, hypnotic, off the beat or every three sixteenths against it, a fifth now and thentechno, hard techno, gabber
phonk_cowbella Memphis melody in sixteenths on a pitched cowbellphonk
piano_riffthe 90s’ dark piano: the fifth hammered, falling to the third and the rootgangsta rap, hip hop, trap, Chicago drill, boom bap, alt hip hop, breakcore

Sounds for parts and drums

compose::draw_sound chooses a part’s sound. It first draws one of the part’s own presets with compose::part_sound(entry, rng): for "piano|epiano" that plays the first alternative that exists (a synth preset, or an instrument an installed pack answers to), and falls back to the pluck synth. It always draws the variation of the last synth alternative first, whether or not that is the sound it returns, and varies any other synth from a fork of the generator; instruments draw nothing. So the generator’s main stream advances the same way with or without sample packs, and installing packs changes the sounds of a song without changing its notes.

Then, from a fork of its own, it draws whether the part keeps that sound: the genre’s palette for the role gives the chance it does (core), else a kind by its weight (palette.rs). What it draws is what its genre has a place for, first of all the synths that fit the genre’s parts of the role (compose::fitting_synths): the presets those parts name (for "vibraphone|mallet", the mallet) and the others of their families (presets::FAMILIES: the two electric pianos, the soft leads, the analog basses …), any of the synth pads for a pad, or the palette’s own synths where it lists them. A bell, a whistle, a chip tune’s square, an 808 and an acid line are families of one, and no kind of instrument stands in with one the genre does not name, so a genre that names none of them plays none. Nor does it play the presets that date a song to the 80s (presets::DATED: the FM tine piano, leads, basses and mallets, the square and pulse-width leads and pads, the string machine and the chip) beyond those its parts name, unless its palette for the role is retro: grime keeps its square lead and UK garage its FM bass, while a hip hop song draws none of them.

  • synth: one of those synths, varied widely (compose::widen: the filter, envelopes, detune, vibrato, FM, drive and glide each moved up or down by half again at most, now and then a voice more or less in the unison, or a soft octave above it). A part’s own synth is varied too, by half as much.

  • an instrument category (strings, brass, mallets, electric piano …): any installed instrument of it whose recorded range holds most of the part’s register (within 5 semitones of its outermost samples), whose articulation suits the role (a pad sustains: no pizzicato, no one-shot, no piano; a lead is one player, not a section; chords on strings, brass or woodwinds are the section’s; a bass starts low enough), and whose pack’s licence lets music made with it be published as one likes: packs without a licence, and share-alike or non-commercial ones, are only chosen by hand. The instruments of an era gone (palette::dated: an FM piano, a CP-80, a Pianet, and General MIDI’s synth pads, strings, brass, leads and basses, the polyphony of an old sound card) play only where the genre names them or its palette is retro, and General MIDI’s others (its upright piano, its guitars) only where nothing else of their kind is installed. With no such instrument installed, a synth stands in: one of those synths that stands in for the category (an FM electric piano for electric piano, a mallet or a marimba for mallets, a brass patch for brass, the whistle for woodwinds), else, for a category that does not pierce a mix, one made for the role (the clavinet for a keys part’s guitar, the vocal lead for a lead’s voice); else none, and the category is not drawn.

    The categories whose sound pierces a mix, mallets, woodwinds and brass (palette::PIERCING), play only where the genre plays one of their kind itself: where one of those synths stands in for them, or the instrument is one the genre’s parts name ("sax|brass_lead": an installed saxophone; compose::named_instruments). No genre plays the whistle, so an installed flute, oboe or harmonica plays only where a part names it. An instrument whose category holds more than one character plays only where the synth it sounds like does (palette::character): a glockenspiel, tubular bells or a xylophone where the genre plays the bell, a vibraphone where it plays the mallet.

No two parts of a song play the same sound (palette::identity): a draw leaves out what the others play, and a part whose own sound is another’s draws from the palette. The genre’s own parts weigh it all: a lead keeps its own sound three times in ten in every genre, an acid line always (its core is 1), trap’s 808 nineteen times in twenty.

Drum kits work the same way: the kit is drawn from a fork, and kit_sound maps lanes to the kit’s drums (kick to bd, hat to hh, perc to rim, …), so a missing kit leaves the lane’s synthesized voice in place. Then each lane, from a fork of its own, plays a kit of its own with the genre’s kit_mix chance: any installed kit whose licence lets music be published freely and that has the lane’s sound, or its synthesized voice, so a song’s kick, snare and hats can come from different machines. Apple Loops one-shots follow the same rule: each lane draws the chance of using one, and picks it, from a fork of its own (dr.fork(lane)), and draws that chance whether or not there is a library. The drum stream that writes the patterns advances the same way either way, so a seed gives the same drum patterns on every machine, and Apple Loops change only which sounds play them. The generator snapshot tests still run without a library, so that they describe the generator and not what is installed.

A kick with tune_to_key has its fundamental moved to the tonic or the fifth of the key, whichever lies nearest its drawn tuning within the lane’s range, so the kick and the bass agree.

Patterns and the script engine

Scripts are Rhai with two families of functions: patterns in Strudel-style mini-notation, and song edits. This page is about how they work inside: what a pattern is and how it is queried, the budgets that keep a pattern from running away, the sandbox, and how a song prints as a script that runs back into itself. The language reference describes what they do for the person writing them.

filewhat it holds
pattern/mod.rsthe pattern tree (Node), queries, the work budget, Pattern with its code
pattern/mini.rsthe mini-notation tokenizer and parser, and its limits
pattern/notes.rsfrom pattern events to notes: sounds, note names, scale degrees, chords and voicing
script/mod.rsthe engine: run, eval_pattern, the sandbox limits
script/patterns.rsthe pattern functions and methods registered with Rhai
script/song.rsstarting a song (song, blank), its settings, prog, bars_per_chord, drum and track
script/mix.rspart, drum_sound, mix, mute and solo, remove, master
script/form.rssec, form, section, layer, and the checks on sections
script/sounds.rssound names: drum voices, presets, pack instruments, files, and the role each gets
script/steps.rsdrum step strings, both ways
script/print.rsto_script: a song as a script

A pattern is a tree

mini::parse turns a string into a Node, and methods wrap nodes in more nodes:

nodemeaning
Silence, Atom(value)nothing; one event per cycle with a word or a number
Seq([(node, weight)])each cycle divided among the children by weight (a b, a@3 b)
Stack([node])children at once (a, b)
Alt([node])one child per cycle, in turn (<a b c>)
Fast(node, factor), Late(node, cycles), Rev(node)time scaled, shifted, reversed within each cycle
Every(n, offset, node, other)other on cycles where cycle % n == offset (every, lastOf)
Degrade(node, p, seed), Choose([node], seed)events dropped at random (?, degradeBy); one child picked at random per cycle (a | b)
Ply(node, k)every event split into k
Struct(values, structure), Mask(node, mask)timing from one pattern and values from another; events kept where the mask is true
Ctrl(node, key, param)a per-event control (gain, velocity, legato, add, transpose, sample index) read from another pattern
Sometimes(node, other, p, seed), Keep(node, p, seed)the events a coin leaves alone, plus other, the transform of the events it picked; Keep is what hands the transform only the picked events

A Pattern is a node behind an Arc, plus its Kind (what its values mean: sounds, notes, scale degrees, chords or plain values), the track settings set on it (.s(), .bank(), .room() …) and repr, the script code that built it. Patterns are immutable: every method returns a new one.

Queries

query(node, b, e, out) appends the events of node whose onset lies in [b, e), in cycles, one cycle being one bar. An event (Ev) is a whole span [b, e), a value and its controls. The nodes compose by transforming the query window on the way down and the events on the way back up:

  • Seq visits each cycle the window touches, gives each child its slice of the cycle, queries the child in the child’s own time (scaled so that the slice is one cycle), and maps the events back.
  • Alt with k children sends cycle c to child c % k, as that child’s cycle c / k. So <a <b c>> plays a b a c: the inner alternation advances only on its own turns.
  • Fast(f) queries [b·f, e·f) and divides the events’ times by f; Late(t) queries [b − t, e − t) and adds t.
  • Rev queries each cycle whole and reflects every event inside it, so an event that ended at the end of the cycle starts at its beginning.
  • Struct takes the true events of the structure and, for each, the value the values pattern has sounding at that onset (sample_at, the last event whose span contains it). Mask and Ctrl read the other pattern the same way.
  • sometimes(f) builds Sometimes(node, f(Keep(node)), p, seed). Keep passes the events whose hash is below p; Sometimes returns the original events whose hash is at least p and every event of the transformed copy. A transform that keeps time (gain, add, ply) therefore gets exactly the events the original side dropped. One that moves time (fast, late) asks Keep in its own time, so its picks follow that time instead.

Two properties follow, and tests/pattern_laws.rs checks them with generated patterns:

  • Windows do not matter. Querying [0, 1), [1, 1.5) and [1.5, 3) gives the same events as querying [0, 3). Nothing is cut at a window edge, because only onsets count; an event that started before the window is not returned at all. This is where claudius differs from Strudel, which returns fragments of every event overlapping the window (Patterns and time shows where you hear the difference).
  • Randomness is stable. Degrade, Choose, Sometimes and Keep decide with hash01(seed, onset), a hash of the event’s onset time and a seed, instead of a random stream, so the same pattern gives the same events in any window, in any order, every time. Seeds come from the code: the parser seeds a small generator with a hash of the mini-notation string, and sometimes and degrade hash the pattern’s repr. Two tracks with identical code make identical choices; change one character and they differ.

Pattern::try_events(b, e) runs a query and sorts the events by onset. Each track is placed section by section with notes::place, which queries cycles 0 to the section’s length and puts them at the section’s start: every section plays its patterns from their first cycle.

The work budget

A query is recursive, and a few characters of mini-notation could ask for a lot. Three limits keep it in reach, each the same on every machine and in every test run, since none of them is a time:

  • Speed. *, /, fast, slow and ply take a factor above 0 and up to MAX_SPEED (256), checked when the pattern is built, so s("bd*100000000") fails while it parses: '*' takes a number above 0 and up to 256, not 100000000.
  • Work. Every call to query, every cycle a node visits and every sub-event Ply makes spends one unit of a thread-local budget, MAX_WORK (4,000,000) per try_events call. A long sequence sped up a lot runs it out, such as a thousand rests and a bd played *256.
  • Events. Every event a query makes (an atom’s, a Ply copy, a Struct value) counts against a second budget, MAX_EVENTS (262,144), and running out also ends the work. This is the one that bounds memory, since the events gathered are kept until the query returns: speed-ups inside speed-ups, such as s("[bd*256]*256") at 65,536 hits a bar, stop here.

When a budget runs out, the query returns what it has, try_events notices, and the call fails, naming the event budget first:

track 'x': this pattern is too dense to play: it makes more than 262144 events
track 'x': this pattern is too dense to play: it needs more than 4000000 steps of work

Both are far beyond anything musical: a dense 64-bar drum pattern needs thousands of events. The worst case the limits allow, s("[bd*256]*256"), stops at the event budget with the whole claudius script process at about 134 MB, and the parse-time refusal of s("bd*100000000") at 33 MB. Pattern::events is the same query returning nothing when a budget runs out, for callers that only look (such as listing a pattern’s sound names).

track() adds a second limit on the result: it places 64 bars of the pattern, and more than MAX_NOTES_PER_BAR (1,024) notes per bar on average fails with track 'x' plays N notes per bar; the limit is 1024.

Mini-notation

pattern/mini.rs is a tokenizer and a recursive-descent parser. The grammar, as it is implemented, is written out in Mini-notation; the parts that matter to someone changing it:

  • Tokens. Words take letters, digits and # : . _ ' - ^; a number followed by letters is a word (808, 3am). ~ is a rest, and so is a - not followed by a digit; _ on its own lengthens the previous step.
  • Structure. stack handles , (layers) and | (random choice) around seq, which handles steps, _ and !. step reads one atom or group ([ ], < >, and { }, which is parsed exactly like [ ]), then its modifiers: *, /, @, ! (with or without a count), ? (with or without a probability) and (k,n,r).
  • Limits. The source is at most 4,096 characters (MAX_SOURCE, counted in characters, not bytes), brackets nest at most 64 deep (MAX_DEPTH), a step repeats at most 256 times and a euclidean rhythm has at most 256 steps (MAX_STEPS), * and / take factors up to 256 (MAX_SPEED, shared with fast, slow and ply), and a sequence has at most 1,024 steps. Each limit has its own error message, because a fuzzer finds these first.
  • Errors say what was expected and where: expected ']', found the end, unexpected ')', '/' takes a number above 0 and up to 256, not 0.

The mini_notation fuzz target feeds arbitrary text to parse and queries whatever parses; the script target does the same for whole scripts. See Testing.

From events to notes

notes::place turns a pattern’s events into notes on the song’s timeline, by the pattern’s kind:

kindmade byan event becomes
sounds(), sound()a note at pitch 60 played by the sound named in the event; bd:3 or .n() picks a variation
notenote()a pitch from a note name (c3, eb4, octave 3 when left out) or a MIDI number
degreen()a scale degree in .scale() (default: the song’s key) and .octave() (default 3)
chordchord()a chord from a symbol (Am7), a numeral (VI), or prog / prog:B (the song’s progression at that bar of the section), voiced with voice leading in .voicing(lo, hi) (MIDI 52 to 74 by default), arpeggiated across the event with .arp(), or reduced to its bass note with .root()
plainseq()numbers, read as MIDI pitches when the pattern plays

Start and length come from the event’s span, four beats per cycle; legato scales the length (never below 0.02 beats); velocity or gain set the velocity (0.9 for sounds, 0.8 otherwise); add adds semitones to notes and scale steps to degrees, and transpose always adds semitones. A word that is not a note, a degree or a chord is an error naming the word, except a prog chord when the progression has no chord there.

track(name, pattern) places 64 bars to learn which sounds the pattern uses, resolves each label once (script::resolve_sound: a .bank() kit, a drum voice, a synth preset, a pack instrument, an Apple Loops cut, or a file), and stores the code with the resolved sounds as a PatternTrack. The track’s role comes from .role(), or from its one sound (bd is a kick, 808 a bass), or from its kind and median pitch (chords are chords, anything with a median under MIDI 52 is a bass, the rest a lead). The song model covers how the arrangement plays it.

The engine and its sandbox

script::run(code, blueprint, library) builds a fresh Rhai Engine for every run, registers the pattern functions and the song functions (song::register_song, which also registers those of mix.rs and form.rs), and runs the code. run_with is the same with the folders a shared session may read, which the server passes. The song functions share an Rc<RefCell<Ctx>> holding the blueprint being edited, the Apple Loops library, the log and those folders; each edit borrows it, changes the blueprint, and returns. A script that edits without starting a song gets a blank house song first. When the script ends, run checks the song’s size and returns the new blueprint and the log. When it fails, nothing is returned but the error, and the caller still has the old blueprint: the session swaps blueprints only on success.

Scripts come from people, from assistants and from files, so the engine assumes nothing about them:

limitvalueset by
operations5,000,000set_max_operations
running time10 san on_progress callback that checks the clock
call depth64set_max_call_levels
expression depth128, 64 inside functionsset_max_expr_depths
string, array, map size200,000 characters, 10,000 items, 1,000 entriesset_max_string_size and friends
modulesnonea DummyModuleResolver, so import fails
evaldisableddisable_symbol("eval")
filesnone, except audio named in .s()no file functions are registered; resolve_sound checks paths with config::read_error against the session’s folders

print() and debug() go to the log, not to stdout, which in claudius mcp carries the protocol. The same limits apply to eval_pattern, which evaluates a pattern track’s code with only the pattern functions registered every time the song is arranged.

How a pattern remembers its code

Every constructor and method appends to repr: s("bd*4"), then .fast(2), then .gain("1 0.7"). Strings are re-quoted with escapes, numbers printed by fmt_num (integers plainly, other numbers with at most four decimals). Methods that take a closure (every, lastOf, sometimes and its relatives, off, superimpose) need the closure’s code too, which Rhai does not give back. So apply_fn calls the closure twice: once with the real pattern, to get the result, and once with a placeholder pattern whose repr is x, to learn what the closure does to it. The second call returns, say, x.add(7), and the method prints |x| x.add(7):

blank("house");
let up = 7;
track("lead", n("0 2 4").scale("A:minor").superimpose(|x| x.add(up)).sometimes(|x| x.fast(2)));

prints as

track("lead", n("0 2 4").scale("A:minor").superimpose(|x| x.add(7)).sometimes(|x| x.fast(2)));

with the variable replaced by the value it had. A closure that inspects its argument instead of transforming it would print what it did to the placeholder, but no pattern method gives a closure anything to inspect.

Printing a song

script::to_script(blueprint) writes, in order: a header naming the title, genre and seed; title, tempo, key and swing; humanize when it is not 0; every progression; bars_per_chord when it is not 1; every variant of every drum lane as a step string; every generated part as a part() line with its style, preset, register, density and seed; every pattern track’s code as it was written; the form, one sec() per section with the methods that differ from that kind’s defaults; and a mix() line for every track whose mix differs from the mix it would have without one. Songs as scripts shows the output.

The guarantee is that running the printed script on the same song changes nothing. Each part of the printer has a partner on the reading side that keeps it true:

  • Numbers. f32s and f64s print integers plainly and everything else with Rust’s shortest representation that reads back as the same value, so swing(0.5257842) is exact.
  • Drum steps. A step string can only say X, x, o or a digit, so it rounds velocities: hits_to_steps writes X from 0.85 (STEP_ACCENT), o below 0.5 (STEP_GHOST) and x between, and reading gives back 1.0, 0.8 and 0.45 (a digit is tenths). The studio’s accent and ghost marks use the same two numbers, as claudius_api::{ACCENT, GHOST}. drum() therefore compares the string it is given with the string the lane’s current hits would print as, and keeps the exact hits when they match. The resolution is 16 steps per bar when every hit is on a sixteenth, else 32, else 48, printed after the string.
  • Parts. part() with the preset the part already has keeps its patch, so the generator’s variation of a preset and evolution’s tweaks survive.
  • Sections. sec() fills in the same defaults the printer leaves out (energy by kind, progression B for breaks, the sparse variant for intros and outros, build for builds, fills for drops, grooves and hooks), and "*" stands for every track exactly when a section has all of them.
  • Seeds. A part’s u64 seed prints as a signed 64-bit integer, Rhai’s integer type, and reads back as the same bits.
  • Pattern tracks. The code is printed verbatim and resolves to the same sounds in the same environment.

The tests hold the printer to it: songs_print_as_scripts_that_change_nothing generates songs in five genres and compares the blueprint before and after running its script, field by field, and printed_patterns_read_back_the_same does the same for generated patterns. A change to the printer or to a song function that breaks the guarantee fails them.

What a script cannot say is not printed: drum voices and kits, synth patches beyond the preset name, Apple Loops and flipped samples, effect chains, the master, the transitions. Running the script on another song leaves those as that song has them. Songs as scripts lists them for users.

Rendering, mixing and mastering

render::render(project, options) turns an arranged project into a mastered stereo file. It works the way a mix engineer does in a DAW, in a fixed order, and everything it does is decided by the project: there is no hidden state and no randomness that is not seeded from the project’s seed and the track’s name.

Everything inside claudius runs at 48 kHz (earshot’s rate) on planar stereo f32 buffers (audio::Stereo). A file at another rate is converted as it is decoded, through a windowed sinc (16 taps a side under a Hann window, cutting below the lower Nyquist). A conversion between two rates comes back to the same positions between input samples (160 of them from 44.1 kHz), so audio::resample_rate works out each one’s weights once and counts the positions in whole numbers. It decodes a 3.6-minute song ten times as fast as weighing every tap anew, which reading at any step (resample_step, the sampler’s varispeed) still does, and agrees with it to a rounding of a 32-bit float.

 per track, in parallel (rayon)
 ┌──────────────────────────────────────────────────────────────────────────────────────────┐
 │ notes / clips ──▶ source ──▶ insert chain ──▶ gain to the role's target ──▶ sidechain ──▶ pan │──┐
 └──────────────────────────────────────────────────────────────────────────────────────────┘  │
        ┌────────────────────────────────────────────┬───────────────────────────────────┘
        ▼                                            ▼ sends (reverb, delay)
  bus: drums │ bass │ music │ fx                  returns: convolution reverb, ping-pong delay
  (each bus chain, in parallel)                   (wet only, ducked 30 % by the kick)
        └──────────────────────────┬─────────────────┘
                                   ▼
                        sum ─▶ premaster LUFS ─▶ master chain ─▶ finalize (gain search,
                                                                 soft clip, limiter, trim)
                                                                         ▼
                                                    master, trimmed after its tail, 0.5 s fade

The length of a render

A render buffer is the song’s length plus 3 s of tail, plus the longest tail of any track’s insert chain (a reverb’s decay, a delay’s echoes until they fall 60 dB), capped at 6 s. At the end, the master is cut where it falls below −80 dBFS for good (never shorter than the song) and faded out over 0.5 s. A project over 512 bars or 20 minutes, or with more tracks than model::check_tracks allows, is refused before anything is allocated.

Sources

Each track plays its notes or clips through its Sound:

soundhow it plays
drumthe voice is rendered once from its parameters and cached for the process, keyed by the sound, the pitch and the seed; other pitches are resampled from it like a sampler
samplethe file is decoded once (and cached on disk, see Files), sliced to start..end, faded, and played like a drum, pitch relative to root
synththe synth engine renders the notes
instrumentthe sample-pack player renders the notes (Sample packs)
fxeach note renders a transition effect of the note’s length: riser, downlifter, impact, reverse_crash, sweep_up or sweep_down; risers are tuned to the key’s tonic
loopthe loop is warped to the tempo and key, then each clip copies it in, re-sliced by chop when set, with fades of at least 1 ms in and 2 ms out; a take’s clips (once) play it from their offset to its end and not again, warped between silences instead of wrapping

Details that make it sound played rather than printed:

  • Swing moves every off-beat sixteenth late when notes are turned into sample positions, so the blueprint stays on the grid and one number changes the feel of every part.
  • Feel moves each note by its track’s late_ms (a lane’s or part’s, every hit alike) and, with humanize, by a drift (Timing::feel). The drift is a 1/f noise over the song’s sixteenths (Voss and McCartney’s: ten octaves of Gaussian draws, each held twice as long as the one before, summed and scaled to unit variance), so a hit moves with the ones around it and wanders over up to 32 bars. It is what Hennig et al. measured in players (PLOS ONE, 2011) and what their listeners preferred to independent jitter. Its standard deviation is 15 ms × humanize × a role’s share (kick 0.5, snare and clap 0.8, hats 1, other percussion 1.2, parts 0.6), capped at three. The drum lanes take 60 % of theirs from a stream they share (one player) and the rest from their own. Every draw comes from the song’s seed and the track’s name at that sixteenth, so a render, a choke’s cut and the kick’s duck all see the same onset. Velocity varies by ±5 % × humanize.
  • Velocity of a one-shot scales its level by velocity^1.6.
  • Choke groups stop a ringing hit at the next onset of any track in the same group, with a 4 ms fade (the open hat stops when the closed hat plays). Pack instruments get the same cut times.
  • Samples on melodic roles stop at the note’s length plus 50 ms, so legato() shapes them; on drum roles they play to the end.

The auto-mixer

A producer balances by ear: the kick here, the bass a little under it, the pad well back. claudius does the same with a meter. First the gain is staged, as an engineer stages it into a chain of plug-ins: a track with inserts or a drive whose sound is more than 6 dB from its role’s target (below) is brought to 6 dB from it before them (Song::finish; at most 30 dB up, and a recording’s residue, under −45 LUFS, not up at all, so that the mix still hears it as residue and raises it no more than 12 dB). A compressor’s threshold and a saturator’s drive then work on it as they were set to: a pad made 20 dB hot is not driven into distortion, nor a quiet recording left under its compressor. A sound made within 6 dB of its role’s target goes in as it was made. After its inserts and its drive (a tanh saturator drive_db hard, when it has one), each track’s active level is measured: the 80th percentile of its momentary loudness (0.4 s blocks every 0.1 s) over the blocks where it is audible (above −50 LUFS). Momentary blocks hear each hit about as the ear does. A 3 s window would hear a clap on two and four with the silence between its hits, 3 to 4 dB under how loud its hits are, and an impact or a reverse crash 5 to 8 dB under, so a mix balanced on it played every sparse track louder than its target. The track is then scaled to:

target = role target + genre's offset for the role (mix.levels) + the track's level_db

with the gain clamped to −40..+30 dB, and to +12 dB for a recording that plays under −45 LUFS: what a stem or a filter left of what it took out (a hiss, a smear of drums), which raised to its role’s level would only be heard as that. The critic then says it is quieter than its level. The role targets, in LUFS while the track plays:

roletargetroletargetroletarget
kick−12.5bass−14.5riser−19
snare−13.5chords−18impact−16
clap−14.5keys−17downlifter−22
hat−17.5pad−21.5reverse−21
ohat−18.5lead−18drums (loops)−14.5
shaker−21.5arp−20.5vocal−15
perc−19.5top−20sample, synth−18
ride−20.5crash−20texture−27
tom−18anything else−19

So level_db is a level relative to where the role belongs, not a fader position, and mix("pad", #{ level: -3 }) means “3 dB quieter than a pad usually sits”. Genres shift roles with levels: trap pushes the bass up 4 dB and the hats 2.5 and pulls the kick down 1 dB, lofi lifts the keys 2 dB. The report and the studio’s mixer show each track’s measured level and the gain it got.

The low end. Loudness is K-weighted, which hears the lows little: a sub at a bass’s target carries far more energy than a lead at a lead’s, and two of them, a bass and a kick, can be most of a mix’s energy and all of what its limiter fights, the rest buried under them. So the mix then weighs its low end as the critic does: each track’s energy under 60 Hz (the sub) and from 60 to 250 Hz (the low band) at the gain it got, measured once with its sound (render::energies). Where the mix’s share of either band comes nearer the most its genre’s masters have (mix.bands, the critic’s range) than 3.5 dB for the sub and 1.5 dB for the low band (the master’s compressor and limiter lift them a little), the louder in that band of the bass and the kick comes down a dB at a time (render::low_end), the bass by 9 dB at most and the kick by 4, until it is within it. A track that carries less than a third of the band is left alone, since what else booms there (a pad, an impact) is no reason to take the bass away. So the kick gives way in house and techno, whose kick carries the sub, and the 808 in trap. The report gives what was taken off as low_end_db (in gain_db already), and the critic’s balance check leaves it out: it is the bands’ to judge.

Sidechain

The kick drives one duck curve for the whole song: at each kick onset the gain falls to zero over 3 ms, then recovers along 1 − (1 − x)² over duck_release beats (0.25 in trap and drum and bass, 0.45 in future bass, which pumps the hardest). A track with duck d is multiplied by 1 − d × (1 − curve), so duck: 0.55 on the bass pumps it hard and duck: 0.2 on a lead only breathes. The reverb and delay returns are ducked by 0.3 too, which keeps the low end clear on the kick.

Buses and returns

Tracks go to one of four buses, drums, bass, music and fx. Each bus runs its chain: the genre’s (house compresses the drums 2:1 from −12 dB and highpasses the music at 110 Hz), the arrangement’s filter automation on music and bass, and the three inserts every song gets (width with mono low end on music and bass, light saturation on drums). The buses run in parallel.

Each track’s post-fader signal also feeds the two returns in proportion to its reverb and delay sends:

  • Reverb is a convolution with an impulse response generated in code: three bands of decorrelated noise (below 500 Hz, 500 Hz to 4 kHz, above 4 kHz) decaying at different rates, so damping makes the highs die faster, plus seven early reflections in the first 70 ms. The input is cross-fed 20 % between channels so a hard-panned source fills both sides, and the wet signal is high-passed at lowcut and low-passed between 9 kHz and 5 kHz depending on damping, because a noise tail reads as hiss up there. The impulse is seeded, so a reverb sounds the same every render.
  • Delay is a tempo-synced feedback delay in beats, ping-pong when asked, with a lowpass and a 180 Hz highpass in the feedback path, so repeats darken and do not build up low end. The return keeps only the repeats.

Mastering

The buses and returns sum to the pre-master, whose integrated loudness goes into the report. The master chain from the genre runs next (house: a 25 Hz highpass and a +1 dB shelf at 10 kHz, a gentle 1.6:1 compressor, tape saturation), and then finalize brings the result to the genre’s LUFS target under the ceiling (−1 dBTP unless master() changes it):

  1. Each pass applies an input gain, a soft clipper (2× oversampled, linear to 70 % of the ceiling minus 0.1 dB, then a tanh curve that never passes it, which shaves drum transients the way mastering engineers clip before the limiter), and a lookahead brickwall limiter at the ceiling minus 0.5 dB (1.5 ms lookahead, 50 ms release).
  2. If the true peak still pokes over the ceiling, the pass trims the output to 0.05 dB under it.
  3. The integrated loudness of the result is measured, and the next gain comes from a secant step on (gain, loudness), with the slope clamped to 0.15..1.5 and each step to ±6 dB. It stops within 0.15 LU of the target or after seven passes.

The critic flags a master more than 1 LU from its target or over its ceiling; the pipeline test asserts both on every CI run.

genretarget
dnb−8.5 LUFS
techno, trap, future bass−9 LUFS
house−10 LUFS
synthwave−10.5 LUFS
deep house−11 LUFS
lofi−12.5 LUFS

Loudness and peaks

loudness.rs implements ITU-R BS.1770: K-weighting with the 48 kHz coefficients, momentary (0.4 s) and short-term (3 s) blocks from prefix sums of the weighted power, integrated loudness with the absolute gate at −70 LUFS and the relative gate 10 LU below, loudness range (the 10th to 95th percentile of short-term loudness, gated 20 LU below), and the active level above. A test checks it on the standard’s reference: a −3 dBFS 1 kHz sine on both channels reads −3.0 LUFS.

fx::true_peak_db measures true peak by 4× oversampling with a windowed sinc, evaluated only around samples within about 4.4 dB of the sample peak, where inter-sample overs live.

Effects

Every effect is plain data, so blueprints store, mutate and diff effect chains. In JSON an effect is tagged by fx: {"fx": "compressor", "threshold_db": -12, "ratio": 2.0, "attack_ms": 12, "release_ms": 120, "knee_db": 6}. Parameters that can move are Params: a number, or a curve of [beat, value] points, interpolated per sample.

effectwhat it is
gaingain in dB (automatable)
eqRBJ biquad bands: lowpass, highpass, bandpass, notch, peak, low and high shelf, allpass
filtera resonant filter with automatable cutoff: a zero-delay-feedback state-variable filter, or a saturating 4-pole ladder
compressorstereo-linked feed-forward compressor, soft knee, gain reduction smoothed in dB
limiterthe lookahead brickwall limiter
saturatea 2× oversampled waveshaper: tanh, tube, tape, hard, fold
bitcrushbit depth and sample-and-hold
reverb, delayas on the returns, for inserts
chorus, flanger, phasermodulated delays and allpass stages
widthmid/side width, with the side removed below mono_below_hz
tremolo, auto_pantempo-synced
gatea rhythmic volume gate (trance gate) from a list of step gains
transienta transient shaper (a fast and a slow envelope split attack from sustain)
tape, vinylwow and flutter with saturation and a lowpass; crackle and hiss
tape_stop, stutter, reverseedits on a region of beats: a slowdown to a halt, a beat repeat, a reversal
tunea voice moved onto the notes it means (voice::tune, below): the notes read against the song’s key and chords, which arrange sets as the tuner’s harmony in beats, and moved by TD-PSOLA (dsp/psola.rs)

The synth engine

synth/voice.rs renders subtractive and two-operator FM voices. A Patch has:

  • oscillators (sine, saw, square, pulse, tri, noise), band-limited with polyBLEP, each with a level, an octave and semitone offset, and a unison stack (voices, detune in cents, stereo width) with slow random pitch drift per voice (analog);
  • a sub oscillator an octave down, a noise level, and an optional FM modulator (ratio, index, its own decay and sustain, and a fast-decaying ratio-14 “tine” for electric-piano bark);
  • a filter (state-variable lowpass, highpass, bandpass or notch, or the ladder) with an envelope depth in octaves, key tracking and velocity sensitivity;
  • amplitude and filter ADSRs, a pitch envelope (the drop that makes an 808 thump), an LFO (free or tempo-synced) to vibrato, cutoff and amplitude, glide, drive, and velocity sensitivity.

Polyphonic patches render every note as its own voice, in parallel batches of 96. Mono patches (basses, acid, leads) render one voice that follows the notes, retriggering its envelopes unless notes overlap and the patch has legato or glide, in which case it slides. Envelopes, pitch and filter coefficients update every 16 samples, with amplitude interpolated across the block so there is no zipper noise.

The 50 presets in synth/presets.rs (Synth presets lists them) are each tagged with the roles they suit, at least six for every role, and say what they are in a few words (presets::about): the table’s words for each, which a test keeps the same, and which the studio shows over a preset’s name. The styles say what they play the same way (compose::style_about: an idiom’s about, or the words of a motif, a chord rhythm or an arpeggio). A part holds a full copy of its patch, which the generator varies (compose::widen: a little for a genre’s own sound, more for one drawn from its palette) and evolution tweaks (cutoff, resonance, release, drive, detune). No preset after the first twenty may share its name with an instrument in the packs’ registry, as a preset hides an instrument of its name.

Drum voices and transition effects

synth/drums.rs renders 13 voices in the spirit of the 808 and 909 circuits: kick, snare, clap, closed and open hat, ride, crash, tom, rim, shaker, cowbell, snap and perc. They are pitch-enveloped sines, clusters of detuned square waves for metal, and shaped noise. All of them share one set of nine parameters (tune, decay, tone, punch, snap, drive, pitch envelope, pitch time, room), each with a range per voice, so mutation can explore every voice the same way. Every hit is rendered at −1 dBFS peak.

synth/fxsounds.rs renders the transitions: a riser (noise swept up through a resonant bandpass, with a detuned saw climbing two octaves), a downlifter (the reverse), an impact (a sub boom and a noise burst), a reverse crash that ends exactly on the downbeat, and noise sweeps up or down.

claudius sounds renders all of them, and every preset playing a phrase, into out/sounds/.

Stems

With stems on, each track’s buffer is kept after its gain, sidechain and pan, before the buses and returns: dry stems, as a DAW bounces tracks without their sends. A song folder gets them as 32-bit float WAVs (song::write_folder, from make --stems, render --stems and a save with stems), since a track can peak above full scale before the master’s limiter. Each is as big as the song’s WAV and a third again, so they come only when asked for, and write_folder first asks the disk for room for the folder’s audio, with 256 MB to spare (config::room_for). A render the studio asks stems of writes 24-bit copies to the server’s render cache, which serves them at /api/stems/{version}/{track}.wav and keeps the latest render’s only.

Speed

A render’s cost is mostly the synthesized and sampled melodic tracks, the reverb convolution, and the master’s search, which runs the master stage up to seven times. On the machine these docs were written on, a full four-minute house song renders in about 11 s. CLAUDIUS_DEBUG=1 prints the time of every track and stage; this is a 64-bar house sketch made of synthesis:

render: track hat in 0.01 s
render: track kick in 0.02 s
...
render: track bass in 1.29 s
render: track chords in 1.50 s
render: track arp in 1.51 s
render: tracks + buses + returns in 3.20 s
render: master chain done at 4.12 s (-9.87 LUFS)
finalize: input -9.87 LUFS, gain -0.13 -> -10.72 LUFS (tp -1.05)
finalize: gain +0.59 -> -10.19 LUFS (tp -1.05)
finalize: gain +0.85 -> -9.96 LUFS (tp -1.05)
render: finalized at 6.22 s

The tracks render in parallel, so the slowest track sets the pace of the first stage; the three finalize lines are the gain search converging on −10 LUFS.

A session renders again only the tracks an edit changed (render::render_kept). It keeps each track’s sound through its effects and drive from the render before, with the level the auto-mixer heard in it, under a key made of everything that sound comes from:

  • the track itself, but for what the mix does after its drive (its level, pan, sends, duck and bus);
  • the song’s tempo, swing, humanisation, seed, key and chords;
  • the render’s length, the onsets that choke the track, and the size and time of any file it plays.

A level, pan or send, the master, or another track’s notes render no track again. Only the stages after the tracks run: levelling, buses, returns and the master. The mix levels, ducks and pans each kept sound as it sums it into its bus and sends, in the order a fresh render does, so what comes out is the same to the sample (a test checks both).

A kept sound is held in blocks of 4096 samples, without the blocks that are silent all through. A song’s tracks rest much of it: 40% of the blocks of a deep-house song are silent, more than half of trip-hop’s and lo-fi’s, and 64% of trap’s, so they take about half the memory a sound held whole would. The mix skips a silent block, which would add nothing, and reads any stretch back to the sample, a playhead window’s too. In the web demo, a level change on one track renders again in about 13 s where the whole song takes 31. Installing packs forgets what was kept, since an instrument may sound otherwise.

Where there are no threads, in a browser, the tracks are made elsewhere and kept instead. Kept::stale lists the tracks a render would make anew, with the key each will be kept under; render::track_sound makes one, in another worker; and Kept::keep keeps it, so the render only mixes. The demo’s engine shares a song’s tracks out among copies of itself this way (see The demo). A test checks that tracks made so render the song as it would have rendered alone.

A synth that plays its notes apart (not a mono one, whose voice glides from note to note) can be made in parts too. render::track_part renders the notes that sound in a stretch of the song (voice::render_range), each as a render renders it, and adds them from silence in the order a render adds them. So every sample of a part is the one a render makes there, and render::track_joined puts the parts side by side and runs the track’s effects. render::part_bounds places the stretches so that the notes beginning in each sound about as long, joins a stretch no note sounds in to the next, and says what share of the work each part has: a part renders whole every note that sounds in it. A test checks a track made in three parts against the track made whole.

Hearing an edit at once

render::render_window renders a stretch of the song as the whole song’s render has it there.

  • The tracks come from what is kept; a track the edit changed is rendered whole first, as a whole render would.
  • The buses, returns and master run from early enough that every effect has settled as the whole song’s would have: the longest tail of their chains, and a second, and back to the start of any tape stop, stutter or reverse on them.
  • They also run a quarter of a second past the window’s end, for the limiter’s lookahead and the lag of tape and the true-peak filters.
  • Every effect knows where its buffer lies in the whole song (fx::Ctx::start and total), so its automation, LFOs, gates, bitcrush hold and vinyl surface are where they would be. A whole render starts them at 0, as before, and comes out the same to the byte.

The one thing a window cannot know is the master’s loudness: its gain and true-peak trim are measured over the whole song (finalize). A window holds them as the last whole render settled them (Settled). With those held, a window is within about 2×10⁻⁷ of the whole song’s render (−135 dBFS, a rounding or two of a 32-bit float), in house, lo-fi, synthwave and trip-hop alike (a test checks it). An edit that makes the song louder or quieter is levelled again by the next whole render.

A server mixes windows of the song for the studio’s live mix (design 0023): each render leaves it the kept tracks, shared (Kept::share), and what it settled, and App::window mixes the stretch the studio asks for from them, as the song is now, unless an edit changed a track’s own sound or the song’s length. The desktop studio plays each window in the render’s place from just after its playhead, faded in and out over 5 ms against what plays beneath it, one window after another up to four seconds ahead, until the next render comes.

The demo’s engine makes windows too (Host::live_window): the studio says where its playhead is and whether it plays with each command, and while it plays, a change to the mix is heard by windows and the whole render waits until the studio stops asking for them, since a page’s worker is one thread and that render takes about 10 s for a song of four minutes. Otherwise it uses render_window to preview an edit where the person is listening: an edit to a song heard whole is first the last render with the twelve seconds from the playhead on rendered again and crossfaded in. That arrives in about 0.6 s in the browser, and the whole song follows. A song whose length an edit changed (its tempo, its form) gets its first bars first instead, as a new song does.

cargo bench -p claudius measures generating, arranging and rendering 8 bars, and records results in target/criterion.

The critic and the ears

After every render, judge::judge(project, rendered, ears) answers one question, is this song any good, with evidence of three kinds, plus a fourth when earshot’s models are loaded:

componentwhat it looks atweight
mixmeters on the master (loudness, true peak, tonal balance, stereo width, mono low end), and each track’s level against its role’s0.30
arcthe energy arc: does loudness follow the arrangement’s energy, is the drop louder than the break0.20
theorythe score itself: the lead, the bass, voice leading, the form0.20
genrethe ears: does it read as its genre rather than the genres it is confused with, or stock background music0.15
productionthe ears: does it read as professionally produced rather than as a typical flaw0.15
aestheticsthe ears, with Audiobox Aesthetics: how much listeners would enjoy it, and how well it is produced, as a model of their ratings hears it0.15
refsthe ears, with reference tracks: how typical it is of them0.15
timethe recordings on its tracks (a remake’s pieces, loops, takes): does each keep the song’s tempo and beatcuts the total
noisethe master: are its notes buried in noise, bitcrushing or heavy clippingcuts the total

Each component scores 0 to 1. The total is the weighted mean of the components present, times 100, so a verdict without ears is out of the same 100. Then the total is cut, by stock music (below), by time, a recording out of the song’s time leaving it as little as 35 % of itself, and by noise, music buried in it leaving it as little as 25 %. 0006 A critic with ears records why the critic is built this way.

The verdict

This is the verdict.json of claudius make --genre deep_house --seed 7 --short, with the measures cut short:

{"total": 86.41901839224477,
 "scores": {"arc": 0.9449047645757822, "genre": 0.7125, "mix": 0.9315307700243037,
            "production": 0.5925, "theory": 1.0},
 "measures": {"lufs": -10.98185847420735, "true_peak_db": -1.0499999523162842, "band_presence_db": -28.6,
              "drop_minus_break_lu": 3.5, ...},
 "issues": [{"severity": 0.4366487862341189, "target": "band:presence-",
             "what": "dull 4-8 kHz: hats, claps and snare lack bite (presence -28.6 dB, healthy from -26)"},
            {"severity": 0.13392813023001673, "target": "band:air+",
             "what": "fizzy top end (air -16.2 dB, healthy up to -17)"},
            {"severity": 0.05999999999999996, "target": "genre",
             "what": "sounds more like 'techno music' than 'house music'"},
            {"severity": 0.052000000000000046, "target": "production",
             "what": "sounds about as much like a hissy recording as a professional mix: noise-built sounds (hats, shakers, risers) and long reverbs are the usual cause"}],
 "ears": {"genre_query": "house music", "genre_z": 3.71, "best_alt": "techno music", "best_alt_z": 3.86,
          "production_z": 1.7, "worst_flaw": "a low quality recording with hiss", "worst_flaw_z": 1.33,
          "sounds_like": ["techno music", "tech house music", "house music", "drum and bass music"],
          "p_real": 0.537, "audioset": [], "ref_typicality_z": null},
 "summary": "86/100 (arc 0.94, genre 0.71, mix 0.93, production 0.59, theory 1.00). Fix first: dull 4-8 kHz: hats, claps and snare lack bite (presence -28.6 dB, healthy from -26); fizzy top end (air -16.2 dB, healthy up to -17); sounds more like 'techno music' than 'house music'"}

An issue is a problem in words, a severity from 0 to 1, and a target: where in the blueprint a fix lives. Issues are sorted worst first, and the summary names the first three after “Fix first”. The targets are a small vocabulary that people, assistants and the evolution loop all read:

targetmeaningwhat evolution tries more often
masterloudness or true peak of the master
band:<band>+, band:<band>-too much or too little energy in a bandlevels of the tracks that live in that band, drum sounds and kits, patches, space, pan, an equalizer on one of them, effect settings
width+, width-too narrow, too wide or phasey, or a low end that is not monothe same, without the equalizer: a widening effect on harmony, or one taken off
level:<track>+, level:<track>-a track louder or quieter than its genre makes itthat track’s level, turned the way back
sound:<part>a part plays a sound its genre has no place forthat part’s preset and patch, a stacked sound’s layers, effect settings
formthe arc, or a section out of its phraseslayers, section flags, drum variants, section lengths, build-ups, a track more
form:short, form:longshort or long for its genrea section played again or left out, a section longer or shorter (form::change), section lengths the way the song should go
form:introslow to get under waythe intro shorter, or left out
form:same, form:sectiona stretch heard as one section, too longof neighbours alike, the second with a part more or less or on the other progression; the longest section shorter
form:peaks-, form:peaks+the hook never comes back, a drop genre’s song never drops, or the peak comes far too oftenthe peak and its way in again; a later one left out
part:<name>a part’s writingthat part’s seed, style, density and register
genreit reads as another genre, or unlike the referencespresets, styles, drum patterns and sounds, kits, tempo, progressions, a track more or fewer, drum trigs
productionit reads as one of the flawsas for the bands, with effects moved or taken off in place of the equalizer
time:<track>the recording on a track keeps a tempo of its own, or wanders off the song’s beat

Mix

Loudness and peak. More than 1 LU from the master’s target costs 0.1 and raises an issue of severity 0.3; a true peak more than 0.1 dB over the ceiling costs 0.15 (severity 0.5). The loudness range is measured and reported but not scored.

Tonal balance. The master’s power spectrum (Welch, 8192-point frames, mono) is split into six bands, and each band’s share of the energy above 20 Hz is compared with a healthy range for a modern electronic master. The ranges are built around a spectrum whose energy per octave is flat from 40 to 150 Hz and falls about 3 dB per octave above:

bandrangehealthy share
sub20–60 Hz−14 to −4 dB
low60–250 Hz−7 to −1 dB
lowmid250 Hz–1 kHz−12 to −4 dB
mid1–4 kHz−18 to −8 dB
presence4–8 kHz−26 to −15 dB
air8–16 kHz−30 to −17 dB

A genre whose masters part from these sets its own ranges in its profile (mix.bands): trap and UK drill let the sub reach −1 dB of the whole, since their 808 carries most of the song’s energy, and let the mids and highs above it fall lower than usual (mid from −22, presence from −31, air from −35).

Outside its range, a band costs 0.12 × severity, where severity is the distance in dB over 6 (at most 1), and the issue says what is likely wrong: too much sub (boomy): lower the bass / kick, or highpass the music bus, muddy 250 Hz-1 kHz: too much pad / chord body, no air above 8 kHz: hats and cymbals too quiet or too dark.

Width. The correlation between left and right over the whole master: above 0.96 is nearly mono (−0.08), below 0.15 too wide / phasey (−0.1). Below 150 Hz the correlation must stay above 0.9, or the low end is not mono (−0.08), which matters for club systems and vinyl.

Balance. Every track should play at the level its genre makes it at: its role’s target, the genre’s offset for the role, and the level the genre gives the track itself, such as trap’s clap 4 dB under its role or deep house’s transitions 3 dB under theirs (compose::made_level). The auto-mixer sets each track to that level and measures it the same way, on its hits. Engineers who mix the same song set its lead within about 1.5 dB of one another, so a track within 3 dB of its level is a choice. Further away, it costs 0.2 × severity, where severity is the distance beyond those 3 dB over 6 (at most 1). The issue names the track and the way to turn it: chords is 9.0 dB louder than the chords level: it covers the rest, target level:chords+. The master’s meters cannot hear this. A song with one track 9 dB too loud can keep every band in its range.

Arc

A producer shapes energy across a song: a breakdown drops back, a build rises, the drop hits. The critic measures each section’s loudness as the median short-term loudness (3 s blocks) inside it, leaving out its first 1.5 s and last 1 s so transitions do not count, and compares that with the energy the blueprint gives the section:

  • the score starts at 0.5 + 0.5 × r, where r is the correlation between energies and loudnesses across sections (arc_correlation), and an r under 0.5 raises loudness does not follow the arrangement's energy;
  • the loudest drop or hook should be 3 to 7 LU louder than the quietest break (drop_minus_break_lu); under 3 LU costs up to 0.3 and raises the drop is only 2.1 LU louder than the breakdown (aim for 3-7): thin the break or push the drop.

A song with fewer than two measurable sections scores 1. Each section’s loudness is kept in the measures as section_<n>_<name>_lufs, numbered in the arrangement’s order (section_05_drop_lufs), and the MCP tools print them as one loudness by section line: the critic compares only the drop with the break, and these let a person or an assistant compare any two.

Theory

The critic reads the project’s notes, not the audio, so these checks are exact:

checkmeasureissue when
the lead stays in keylead_in_key, the share of lead notes in the key or in the chord sounding with themunder 95 %
the lead lands on chord toneslead_chord_tones_on_strong_beats, on beats 1 and 3under 60 %
the lead is singablelead_range_semitonesover 19 semitones
the lead moves by stepslead_stepwise, and the share of leaps over a fifthmore than 20 % leaps
the bass plays the rootsbass_roots_on_changes, the share of chord changes where the bass hits the chord’s bass noteunder 70 %
chords move smoothlyvoice_leading_<track>, the average movement per voice per chord change, for every chords, pad and keys track but one of power chords alone, which move as one shapeover 4.5 semitones
the form holds a listenerlength_s, intro_s, sections_alike, peaksas Form says
every part plays a sound its genre has a place forthe rules the genre’s own draws follow (compose::has_place, Sounds for parts and drums)a part that does not: chords plays synth patch 'whistle', which house has no place for, target sound:chords

The theory score is the mean of a score per check that applies: a song without a lead or bass is not marked down for them. A part whose sound has no place in its genre adds a check it fails outright, a 0 to that mean.

Form

The form checks are one of the theory checks, and like them read the whole song, even when the evolution loop renders only a preview of it (judge::judge_whole). They hold a song to its genre’s own forms (GenreProfile::forms, at the genre’s tempos), loosely. Liking music follows an inverted U over how familiar and how complex it is (Chmiel & Schubert 2017), and the songs that rose highest in the Billboard charts were neither the most typical of their peers nor the least (Askin & Mauskapf 2017): a song is held to its genre’s ways, with room around them. And the checks look only at what listeners have been found to hear of a form, which is less than its order. Reordering the sections of unfamiliar pop songs left how predictable and how likeable people found them largely as it was: they listen section by section (Rolison & Edworthy 2012), as they do to a Mozart symphony (Karno & Konečni 1992). What they hear is each section as it comes, and where it gives way to the next, by a change of timbre, loudness or register (Deliège 1987).

checkmeasureissue whentarget
its lengthlength_sunder the genre’s shortest form over 1.5, or over 1.5 times its longest and over 5:30: 2:00 long, where trance's forms run 3:26-3:35form:short, form:long
its way inintro_s, where the first section that is not an intro startsafter twice the genre’s longest intro (16 bars at least): the song takes 1:09 (32 bars) to get under way, where ambient's intros run 8 bars at mostform:intro
its phrasesevery section a multiple of 4 barsany other lengthform
what is heard as one sectionsections_alike: neighbours with the same texture, the tracks that play (a take in every section it sounds through), where in the bar each drum strikes and the chords (the transitions mark a boundary, and are left out)neighbours alike, or one section, longer together than 1.5 times the genre’s longest section and 32 bars: drop and drop2 play alike, 64 bars heard as one section where trance's longest is 32form:same, form:section
its peakspeaks, its hooks and dropsa hook that comes once where the genre’s forms bring theirs at least twice; a song of a drop genre that never drops; more than two over the most the genre’s forms haveform:peaks-, form:peaks+

An issue costs the form’s score 0.1 to 0.3, the more the further off the song is, and a song without a genre is held to 90 s to 5:30 and its phrases. Why each check is as it is:

  • Its length. A genre’s forms are its shapes at its tempos, and its records run shorter and longer than they do, so the critic allows half again either way, and finds 5:30 long for none of them. The check catches a song cut to a sketch or run on far past its genre; inside that the length is a matter of taste.
  • Its way in. A quarter of the songs streamed on Spotify are skipped within their first five seconds, and skips rise again just after a section changes (Montecchio, Roy & Pachet 2020). The intros of the US top ten shortened from about 20 seconds in the mid-1980s to about 5 by 2015, though an artist’s more popular songs did not have the shorter ones (Léveillé Gauvin 2018). So the check catches only a way in far longer than the genre’s: genres differ, a DJ track or an ambient one taking its time, and the bound is twice the genre’s own longest intro. A quiet first verse is the song begun.
  • What is heard as one section. Dance music adds, changes or removes a layer after 2, 4, 8, 16 or 32 bars (Solberg & Jensenius 2016). Neighbours that change none of what marks a boundary sound as one section, so they are measured as one: 32 bars of a chorus played twice is a chorus, 64 bars of a drop played twice is a long time with nothing new. Notes are not compared: the arranger writes each section’s afresh, and a new melody over the same texture does not make a new section.
  • Its peaks. Repetition is what makes a hook: a song repeated within itself is easier to take in, and songs whose lyrics repeat more reached the top of the charts sooner (Nunes, Ordanini & Valsesia 2015). In a drop genre the drop is what the break routine builds to, and the part listeners respond to most, in their skin conductance and in their own words (Solberg & Dibben 2019). A song of verses alone, in a hook genre, is a form of its own and is not marked down.

Not checked: the order of the sections, which listeners hardly hear, and how surprising the music is against how predictable, which is what pleasure in it follows (Cheung et al. 2019), but chord by chord rather than section by section.

Time

A recording that plays at another tempo than the song, or drifts off its beat, sounds wrong at once: its drums flam against the song’s, its chords change off the bars. The mix, the arc and the theory cannot hear it, and neither can the ears: CLAP sums up ten seconds at a time as a description, and a house song with a sample a few percent slow still reads as house. So the critic measures it, on the audio of each track that plays a recording (a loop or a take: a remake’s original, its hook and passages, a break, a flip), as the renderer makes it, before the mix (render::kept_time, kept with the track’s sound and reported with it as time):

  • its onsets: the spectral flux of the track where it rises over its own mean around it (an eighth of a second each way), each by how much;
  • how tightly they gather at one place on the song’s sixteenths, on_grid: the length of their mean on a circle one sixteenth round, weighted, from 0 (anywhere) to 1 (all at one place);
  • the same on the sixteenths of every tempo from 0.7 to 1.4 times the song’s, a quarter of a percent apart and then a fiftieth around the best: the tempo they gather on most tightly, own_bpm, and how tightly, own;
  • drift_ms: how far each four bars’ place on the song’s sixteenths lies from the whole’s, the most of any whose onsets gather there at least half as tightly as the whole’s do (a fill, a riser or a wash gathers at no place, and the place its leftover points to would read as wander).

Onsets rather than beats tracked, because a beat tracker slips by half a beat on a guitar or a voice and would take its own slip for the recording’s. A recording whose onsets gather on no grid near the song’s tempo (own under 0.15: a pad, a voice alone) is not judged. Nor is a track with the vocal role: a few syllables, looped, line up by chance on a tempo a whole number of whose sixteenths fit the loop (33 or 28 of them in a two-bar phrase), and a sung phrase keeps the time the rest of its recording keeps, which is judged. Then:

issuewhenseverity
'original' keeps a tempo of its own, about 126 BPM, against the song's 130: the recording on it is off the song's timeon_grid under half of own, at a tempo more than 0.5 % from the song’s(0.7 − on_grid / own) / 0.4
'break' drifts off the song's beat, by up to 60 msdrift_ms over 40 (a band playing live, its bars each made one length, wanders 30)(drift_ms − 30) / 40

Each severity is scaled by how clearly the recording keeps a grid ((own − 0.15) / 0.15, at most 1), and time is 1 less the worst. The total is multiplied by 0.35 + 0.65 × time, so a recording clearly off the song’s tempo leaves a song at most 35 of its points, whatever else is right. The measures keep time_<track>_on_grid, _own, _own_bpm and _drift_ms for each recording judged; a song with none to judge has no time score, and its total is as it was.

A remake’s recording declared 3 % off its tempo, as a misread tempo would leave it, is found keeping 126.2 BPM in a song at 130, its verdict 32 where it was 91; 0.7 % off, 129.1 BPM, the same. The same remake with its tempo read right keeps 130.01, its on_grid its own.

Noise

The meters on the master cannot hear noise: a song bitcrushed to three bits and clipped 30 dB keeps its loudness, its bands (broadband noise fills them all evenly, which reads as balanced) and its arc, and the arc and the theory do not listen at all. Without the ears, as in the web demo, such a song scored 96, as it did clean. So the critic measures it on the master, with or without the ears (body_flatness): the spectral flatness (the geometric mean of the power spectrum over its arithmetic mean: 0 for a pure tone, 1 for white noise) from 300 Hz to 3 kHz, where a song’s notes are and where hats and cymbals, noise themselves, mostly are not, frame by frame, its median over the frames within 20 dB of the loudest (body_flatness in the measures). Notes stand out of that range as peaks; noise, a bitcrusher or a hard clipper fills it in. It takes one 4096-point frame in each run of four (dsp::fft::spectrogram_drawn), which one drawn from the run’s number, so that no tempo lines the frames up with its beats; their median is the median of all the frames to a hundredth, at a quarter of the work. A frame whose range holds less than a ten-thousandth of its power (a kick, a sub or a bass alone) is left out: it has no notes there to bury, though an empty range reads as flat as noise.

Over 123 of claudius’s songs across the 66 genres (four of each genre near the line), a genre whose sound is clean reads 0.01 to 0.19: techno the highest, with its hats and rides, then tech house, IDM and lofi with its vinyl crackle. A genre whose sound is distorted reads up to 0.24 (pop punk, then nu metal). Lofi crushed to two bits reads 0.28, a song bitcrushed to three bits and clipped 30 dB 0.35, a song under a loud hiss 0.57. The flatness counts as noise from 0.22 (0.28 in a genre whose accepted flaws hold the clipped recording, 0.34 for a file judged with no genre, whose own may be a wall of distorted guitars), all of it 0.14 above that, and the total is multiplied by 1 − 0.75 × noise, with the issue noisy: the notes are buried in noise ..., target production. The crushed song scores 29 without the ears and 11 with them, where it scored 96 and 37.

The ears

The ears are earshot, ported to Rust in crates/earshot with CLAP and the AudioSet tagger running as ONNX models; its README documents the port and its parity with the Python original. ears::Ears wraps it for claudius.

One embedding. The master is downmixed to mono the way the models were calibrated (ffmpeg’s −3 dB per channel) and embedded once with CLAP: a song up to 10 s long is one window; a longer one gets 10 s windows every 5 s, the last flush with the end, at most six spread evenly, averaged and renormalised. Every question below is answered from that one 512-dimensional vector, which is why the ears add only about a second to a verdict.

Calibrated scores. A raw CLAP similarity between audio and a text means little on its own: some texts match everything. earshot calibrates it against its vocabulary of 322 terms:

u = cos(audio, text) − text · m      m: the mean embedding of earshot's reference recordings
z = (u − mean of u over the 322 terms) / their standard deviation

A z says how much better this text describes this sound than the vocabulary does on average; earshot calls 2.5 plausible and 3 strong.

Genre. Each genre profile names what the ears should hear (query, "house music" for house and deep house) and the genres it is most often confused with (alts: "techno music", "minimal electronic music", …). Every genre is also measured against five readings of stock library music: inspirational corporate background music, upbeat corporate pop music, playful children's piano music, cheerful ukulele music and chiptune video game music. A song that sounds like an advert’s background music has failed its genre, however clearly it beats its neighbours. The genre score rewards a high genre_z and a margin over the best alternative, stock music included:

genre = 0.5 × clamp((genre_z − 1) / 2.5) + 0.5 × clamp((genre_z − best_alt_z + 1) / 2)

An issue is raised when an alternative beats the genre, sounds more like 'techno music' than 'house music', or when genre_z is under 2.5, sounds only faintly like 'house music' (the nearest other reading: 'techno music'). Its severity is the larger of (2.5 − genre_z) / 2.5 and (best_alt_z − genre_z) / 2.5. The issues leave the z values out; the ears line of the command line and the MCP tools prints them.

Stock music also cuts the whole verdict. When the strongest stock reading is plausible (stock_z of 2.5 or more) and within one z of the genre’s, the total loses up to 40 % of itself, in proportion:

stock share = clamp(stock_z − genre_z + 1)        total × (1 − 0.4 × stock share)

The issue, with the stock share as its severity, says sounds close to stock background music ('inspirational corporate background music'): too clean and polite for 'trip hop music'; when a stock reading beats the genre outright, the sounds more like issue says it instead, with that severity. stock_share is among the measures.

Production. The best of two descriptions of a professional track (a professionally mixed and mastered music track, a high quality studio recording) against the best of six flaws (a cheap synthesized beep, hiss, clipping, a computer-generated tone, low-bitrate artefacts, a phone recording):

production = clamp(0.5 + (production_z − worst_flaw_z) / 4)

with an issue when the difference is under 0.5. The issue names the flaw in a few words and where it usually comes from in a song of claudius’: sounds about as much like a hissy recording as a professional mix: noise-built sounds (hats, shakers, risers) and long reverbs are the usual cause. It says “more like” only when the flaw leads by more than 0.5. Its severity is (0.5 − difference) / 2.5: a near tie is a faint reading, about 0.2, so the issues that name a change come before it, and a flaw that leads by 1.5 reaches 0.8.

A genre can list flaws that are its sound in accepted_flaws, and its production reading leaves them out: lofi accepts the hiss and the phone recording, since vinyl crackle, tape hiss and a lowpassed drum bus are the style.

Aesthetics. Meta’s Audiobox Aesthetics (Tjandra et al. 2025) learnt from listeners trained to rate recordings of speech, sound and music on four axes, each from 1 to 10: how much they enjoy it (content enjoyment, CE), how useful it would be to make something of (content usefulness, CU), how many things it is made of (production complexity, PC) and how well it is recorded and mixed (production quality, PQ). On natural music its ratings correlate with theirs, recording by recording, 0.89 for production quality and 0.75 for enjoyment (the paper’s Table 7); on a set four fifths of it made by music generators, 0.59 and 0.66 (Table 4), since it learnt from no generated audio. earshot runs it on three ten-second windows of the master spread across it, which takes about two seconds. The critic scores two of its axes, enjoyment and production quality, each from 0 at the model’s average recording (the means it was trained to, CE 5.07 and PQ 6.58) to 1 a little above what professionally produced records rate (a chart hit’s enjoyment 7.3, the production of GarageBand’s own produced beats 8.0 to 8.25):

aesthetics = mean of clamp((CE − 5.07) / (7.5 − 5.07)) and clamp((PQ − 6.58) / (8.3 − 6.58))

A genre whose sound is a flawed recording’s (its accepted_flaws hold the hiss, the clipping, the low bitrate or the phone: lofi, boom bap, trip hop, big beat, gabber, hyperpop and others) is held to its enjoyment alone, since its dust or its distortion is what the production quality marks down. Each axis under half raises an issue of severity 0.8 × (0.5 − score): the listening model expects listeners to enjoy it 5.3 of 10, where records they like rate about 7.5: a stronger hook or groove, and its genre's own sounds, usually lift it (target genre), and the listening model rates its production 6.6 of 10, where professional records rate about 8.3: a clearer, more balanced mix and recorded instruments usually lift it (target production). All four readings are among the measures (aes_ce, aes_cu, aes_pc, aes_pq). Of 24 of claudius’ 32-bar previews in 12 genres, the model rated the enjoyment 5.3 to 7.4 and the production 6.5 to 8.3, drum and bass the lowest on both and afrobeats, house and trance the highest; GarageBand’s produced beats rate 6.7 to 7.1 and 8.0 to 8.25.

References. With --refs and at least two reference tracks, the song’s typicality among them (the mean cosine to its five nearest references, as a z against the references’ own spread) scores clamp((z + 3) / 4), and an issue is raised under −1.

What it sounds like. sounds_like lists the four vocabulary terms that describe the master best, leaving out the quality and production categories, for people to read.

Held-out evidence

Some readings are reported and never scored: p_real, earshot’s estimate that the audio is a real, produced recording rather than something synthesized in code (in the command line’s verdicts, the mean over eight 4-second windows spread across the song, where earshot would read all of them), the AudioSet tagger’s top six labels over three 10-second excerpts (with --tags), and Audiobox Aesthetics’ content usefulness and production complexity. Optimising against a model can please the model without making the music better, which is earshot’s own warning. Keeping some evidence out of the score leaves a way to notice when evolution is gaming the scored parts: the scores rise and the held-out readings do not.

Where the critic is weak

The critic measures; it does not have taste. A high total means no measurable problems and a confident genre reading, not a good song.

  • The mix, arc and theory checks are what the generator aims at: the mixer sets each track to its level, the arranger writes the arc, the composer writes in key. So a song claudius makes meets most of them by construction, and they say most when something has been changed by hand or by evolution. No listener has checked yet that a higher total is a song people prefer.

  • The ears’ genre and production readings compare the audio with descriptions (CLAP). Published audits of such judges find their scores follow how well the audio matches its description more than how good it is. They tell a song that sounds like its genre from one that does not, but they do not rank good songs. Nor do they hear time: a song whose sample plays against its drums reads as its genre as well as one whose sample keeps time, which is why time measures it on the tracks themselves instead of asking a better-trained CLAP.

  • time judges the recordings that keep a grid. A voice, a pad, or a recording too sparse to gather on one is taken at its word, and so are notes, which play where the song puts them.

  • Audiobox Aesthetics is the one reading trained on what listeners said, and it agrees with them less on generated music than on recorded music. Its 1 is set by a handful of professional records, and evolution, which optimises it with the rest, could find what pleases the model and not listeners; the axes it holds out are there to show that.

  • earshot was validated for matching sound effects, not music. House, tech house and techno sit close together for it, and fully synthesized songs read only marginally “professionally mixed”; songs with sampled instruments read better.

  • The healthy band ranges are one target for nearly every genre: only the 808 genres set their own. A lofi track is meant to be darker than they allow, so it gets no air issues that are style, not fault.

  • judge on an arbitrary file without its project.json has no sections and no notes: the arc scores 1, the theory checks only the length, and the length is estimated at 120 BPM.

  • The evolution loop renders a preview of each candidate, 32 bars around its first drop or hook, so its mix, arc, time and ears are the preview’s, and a change outside it is judged by its notes and its form alone.

  • The form checks hold a song to its genre’s forms, which are claudius’ templates of the genre rather than measurements of its records. They count the sections named hooks and drops, so a song whose hook is a riff running through its verses has none to count.

Judge finished songs by ear too.

Evolution and analysis

Two parts of the engine work on whole songs at once. Evolution (evolve.rs) searches for a better song by editing blueprints the way a producer revises a track and keeping what the critic prefers. Analysis (analysis/) reads a song from audio, so that a new one can be written on its skeleton.

Mutation

evolve::mutate(blueprint, genre, library, issues, rng) returns a changed copy and a sentence saying what changed. It picks one of 36 operators, applies it, and keeps the result if the blueprint actually changed; otherwise it tries another, up to 12 times, and as a last resort writes every part again with new seeds (rewrote every part).

leveloperatorswhat one does, in the words it logs
harmonyharmony_sub, harmony_newharmony A: chord 2: VI -> iv (third relation); a new progression from a style of the key’s family
drumsdrum_edit, drum_regen, drum_sound, drum_kit, drum_trigdrums (main): added a hat hit at beat 2.75, removed, nudged by a sixteenth, or re-accented; a new pattern from the lane’s template; a one-shot from the library or a nudge of one synth parameter; every lane onto another kit; a step’s trig (below)
partspart_seed, part_style, part_preset, patch_tweak, part_register, part_density, rack_layerbass: rewrote the part; chords: style stabs -> charleston; a preset from the genre’s list; cutoff, resonance, release, drive or detune of a synth patch; the register moved by 3, 5 or 12 semitones; a lead’s density; a stacked sound’s layer 2.5 dB louder or quieter at most, or a crossover between its layers moved a third of an octave, both layers that meet there with it
instrumentstrack_add, track_removepad in, on synth patch 'warm_pad': a part its genre writes that the song left out, playing where the genre’s forms play it, or one layer of those a more layered song plays (compose/layers.rs: a pad, a counter-melody, an arpeggio, a double of a part, a clap, a shaker or a percussion line), kept only if a section plays it; shaker out of the song: a part or drum lane that only colours it, never one every song of its genre has
mixmix_level, mix_send, mix_duck, mix_pan, spacemix: bass -1.3 dB (now -1.3); a reverb or delay send; a part’s sidechain depth; the pan of anything but kick, bass, snare and clap; the reverb’s decay or the delay’s time
effectsfx_tweak, fx_add, fx_remove, fx_eqkeys: filter cutoff 2400 Hz, one setting of an insert effect moved a little (a cutoff, a rate or a decay by up to a third, a mix or a feedback by a tenth); an insert effect the track takes, set as the genres set theirs (drive on the kick and bass, drive or a sharper attack on the other drums, a chorus, phaser, tremolo or tape on harmony, a delay, chorus or drive on a lead); one of those taken off again; pad: -2.1 dB at 400 Hz, the band a band issue names, cut or lifted on a track that lives in it
formform_layer, form_bars, form_flags, form_variant, form_change, form_buildform: lead out of break; a section 4 or 8 bars longer or shorter (4 to 48); a fill, gap, impact or filter sweep switched; a section’s drum variant; form: verse2 and chorus2 again after chorus2, form: intro left out, form: drop2 on progression B, unlike drop (below); form: build builds classic -> drop_out, or harder or gentler
feeltempo, key, swingtempo 128 -> 126 BPM within the genre’s range; key A minor -> C minor (tonal loops follow); swing nudged
samplesloop_swap, loop_chopanother Apple Loop for a loop part; break: slice 6 plays slice 3, a sampled break or phrase re-chopped as the sampler chops one (half-beat slices, every fourth where it was), in a genre that chops them, or a slice back in its own place

Every operator stays inside what the genre allows: styles and presets from the genre’s lists, tempo within its range, levels within −12 to +9 dB, pans within ±0.7. Nothing widens the low end: the kick and the bass take drive, never a chorus, a widener or a delay.

drum_trig programs one step of a lane as a drum machine’s trig, never the kick’s: a hat, shaker, ride or percussion hit that is not an accent plays by chance (50 to 90 % of the time), a hat rolls in two to four strokes only in a genre whose hats roll, a snare or clap is flammed (12 to 30 ms) or laid back (by up to 0.15 of a sixteenth), a percussion hit is tuned, and any hit is made brighter, darker, shorter or longer; a quarter of the time a step that has a trig plays plainly again.

drum_kit moves every drum lane onto another installed kit: the genre’s kits first, then tr909, tr808, tr707, muldjord and uzu, never the kit the song is already on. When the song is on a kit, one time in four it goes back to the synthesized voices instead. It logs drums: played on the tr808 kit or drums: back to the synthesized voices.

Issues steer the choice. All operators start with weight 1. For each of the verdict’s four worst issues, the operators that address its target are multiplied by 1 + 4 × severity: a band:sub+ issue of severity 0.5 makes the level, drum sound, kit, patch, space, pan, equalizer and effect-setting operators three times as likely. mix_level goes further and, three times in four, turns the track the band issue points at the right way (too much sub turns the kick or bass down), and fx_eq works only on a band issue; the part operators pick a part an issue names seven times in ten. A width- issue has fx_add widen harmony (a chorus, an auto-pan or a widener), a width+ one has fx_remove take a widening effect off, a sound:<part> issue brings in the rack and effect operators too, and a genre issue the instrument and trig operators.

The form is revised toward its issue. form_change makes one change of form::change, aimed at the verdict’s worst issue with the form, or at anything when it has none (the critic’s form checks say what each issue means):

issuechanges tried
form:shorta section to the next length its kind takes; the last verse and its hook played again where a third would go, or in a drop genre the last drop with the break and build into it; the last peak twice; a bridge
form:longa section to the next shorter length; the intro or the outro shorter or left out; a section heard earlier left out again, with the build into it
form:introthe intro shorter, or left out
form:sameof two neighbours alike, the second without one of its parts, with one of the next peak’s, or on the other progression; a bridge, or a lift into a hook
form:sectionthe longest section shorter
form:peaks-, form:peaks+the peak and its way in again, or the last peak twice; a later peak left out

A revised form keeps three sections at least, a peak, builds that lead into peaks, sections that rest on a track sure to play, names of their own (a second verse2 becomes verse3) and the section a take starts from. A length issue also turns form_bars the way the song should go.

Every mutation appends its sentence to the blueprint’s lineage, so a song carries its own history.

Crossover

evolve::crossover(a, b) makes a child from two parents in one of two ways, half the time each: the drums and form of one with the harmony and parts of the other, or the drums of one with everything else of the other. Both keep a coherent song, because the harmony and the parts written over it travel together.

evolve::run is a (μ + λ) search: every candidate ever judged stays in the pool, and each generation’s parents are the best population of all of them.

initial songs ──judge──▶ pool
                          │  each generation:
                          │    parents = best `population` of the pool
                          │    children: pick a parent (biased to the better ones),
                          │              crossover with another parent (20 %),
                          │              then 1 or 2 mutations steered by the parent's issues;
                          │              skip any blueprint already seen
                          │    judge every child in parallel (rayon) and add it to the pool
                          ▼
                     every candidate, best first
  • Previews. A candidate is heard on its build-up and first drop, not the whole song: preview_window takes the first drop or hook and up to 16 bars before it, preview_bars (32) in all, and the rest of the song is cut away with Project::slice. A whole song takes seconds to render; a preview a fraction of that, so a generation of eight children takes 10 to 40 s with the ears. The mix, the arc, the time and the ears are the preview’s, and the notes and the form the whole song’s (judge::judge_whole), so a section added, left out or lengthened outside the preview counts all the same.
  • Duplicates are skipped by hashing each blueprint’s JSON, so the search never judges the same song twice.
  • Parents are drawn with min(random(n), random(n)), which favours the better half without ignoring the rest.
  • Stopping. A cancel flag is checked before each generation.

Each candidate records its id (g2-1: generation 2, child 1), its parent, what changed and its score. The command line writes them all to evolution.json and renders the best in full; the session keeps the best only if it beats the song it started from.

The studio’s Variations (the mutate command and MCP tool) is a single generation without crossover: count children of the current song, one or two mutations each, steered by the current song’s issues, judged on the same 32-bar previews, and the best kept if it beats the current song’s preview score.

Reading a song

analysis::song::analyze(audio, tempo_range) reads a whole mixed song the way a producer does before remaking it: tempo, downbeat, key, the chord of every bar, sections with their energy and what plays in them, drum habits per sixteenth, swing and a bass style. It uses no models: everything is signal processing in analysis/.

filewhat it does
onsets.rsonset strength as log-compressed spectral flux, optionally in a frequency band; peaks above a moving median; onsets refined to where the energy starts rising: the first millisecond above a tenth of the loudest, from a hop before the peak frame’s window to a hop after it (log flux peaks when an attack first comes into the window, at its end)
beats.rstempo from the onset envelope’s autocorrelation, its grid’s fit to the onsets and the kit’s backbeat, beats by dynamic programming (Ellis 2007), then a constant-tempo grid, or the beats a band plays when they drift off it, and the downbeat
chroma.rspitch-class energy, keys by Krumhansl-Kessler profiles, chords by template matching
melody.rsa take’s melody as notes, read by voice/ (below)
structure.rsthe sections, as the song’s own: where each starts, which play the same music, what each is, where a build resolves
song.rsthe rest: each section’s energy and what plays in it, the phrases sung, progressions, drum steps, swing, and to_blueprint
groove.rsthe groove of a recording’s drums (below)
drums.rsa beat’s hits, played or beatboxed, named kick, snare or hat and folded into lanes (below)

Tempo. The onset envelope adds the full-band flux to twice the kick-band flux (30 to 160 Hz), because in dance music the kick marks the beat. The peaks of its autocorrelation (helped by the autocorrelation at twice the lag), from 55 to 200 BPM, are the tempos it might be, each also at twice and half its tempo. A syncopated kick or a dotted rhythm repeats at four thirds or two thirds of the beat about as strongly as at the beat, so a peak alone is no answer: of each tempo the tracker asks how well its grid lies on the onsets, its beats, eighths and sixteenths at the phase that suits each stretch of 16 beats, weighted 1, ½ and ¼, against the envelope’s mean (salience). A tempo a third or a quarter off the music’s puts most of its grid between the onsets; one at twice or half of it lies on them nearly as well as the music’s own. Of the tempos whose grid lies within 5 % of the best one’s (25 % when the drums are heard apart from the rest), it keeps the one nearest the tempos songs are played at, a prior centred on 110 BPM (or on the middle of the range a genre gives) with a spread of 0.6 octave, whose kit plays a backbeat (backbeat): in a cycle of two beats, the snares on the second and the kicks on the first, less the snares on the first and the kicks on the second, from the drum hits heard (below). A kick on one and a snare on two and four give most; at twice the tempo the snare falls with the kick, at half of it between the beats. With the drums apart (the ears’ stems), the backbeat counts for much (e^(3·backbeat)), and it is what keeps a slow song from being heard at twice its tempo; in a whole mix, where a chord or a bass note is heard as a hit as often as a drum, for little (e^(0.5·backbeat)). On claudius’s own renders of 14 genres from R&B at 62 BPM to drum and bass at 175, three songs each, the whole mix is heard at its tempo 34 times in 42 where it was 21, and the drums apart 38 times; on 20 other genres, two songs each, 31 in 40 against 26 for the mix, with three tempos a third or more off rather than seven, and 31 for the drums apart as before. What it still hears at twice or half are the songs listeners differ on too: R&B and reggae under 80 BPM at twice, the trap and drill family at 70, where their snare on the third beat is a backbeat. In a whole mix the dynamic programming lets a beat last 0.9 to 1.1 of the tempo’s: a band strays a few percent from its tempo and comes back, which fits, while the looser range a kit heard apart still has (half to twice) followed a syncopated riff or bass line struck harder than the beat for a few bars and slipped a beat into the count, sliding every bar line after it across the beat (five times in Men at Work’s “Down Under”). Beats tracked by dynamic programming jitter by a frame and insert or skip beats through breakdowns, but music made in a DAW keeps one tempo, so the tracker then fits a constant grid around the slope of a line through the tracked beats (finer than the median gap between them, which is a whole number of 5.3 ms frames: 117 or 118 at 96 BPM, nearly 1 % apart), trying every tempo within 0.5 % in steps of 0.005 BPM and every phase, and keeps the one that lands on the most onset energy.

A band’s tempo. A band speeds up and slows down, and a grid of one tempo drifts off it: a band that goes from 92 to 98 BPM over 80 bars is several beats away from any one tempo by the end. So the tracker also keeps the beats as it played them: the tracked beats with a skipped one put back and one slipped in left out, each moved onto the line through it and the eight beats on either side (which takes out the jitter and keeps the drift). When somewhere 16 of them in a row sit more than an eighth of a beat off the grid, all one way, and they land on 5 % more onset energy than the grid does, those are the beats (Grid::steady false) and the tempo is their middle one. The bars (Analysis::bar_starts) are every fourth beat from the downbeat, back to the start of the recording at the first bar’s length; everything measured bar by bar (the chords, the loudness, the drum steps, the swing) is measured over each bar as the band played it, and every piece cut from a recording is cut on those bars and made one tempo (Analysis::cut, warp::flatten): each of its bars stretched to the recording’s mean bar, in one stream through Signalsmith Stretch, so that the renderer’s warp to the song’s tempo lands every bar on the song’s. A recording that keeps one tempo is cut as it was.

Downbeat. Of the four beat phases, the downbeat is the one with the best mix of its cues, each scaled to its best phase: a change of harmony across the beat (chroma a bar before against a bar after, weight 1.5), the biggest level jumps (sections start on downbeats, 0.75), and kick strength (0.5); in a whole mix also the kit’s backbeat (1.5), the kicks on the bar’s first and third beats and the snares on its second and fourth, less the other way round. Harmony leads because level jumps also come from pre-drop gaps and risers, and kick strength from rolling basses. The backbeat tells a bar’s one and three from its two and four where the chords change a push ahead of the bar, as pop, rock and reggae often do (a phase and the one two beats on score alike: the other cues tell one from three). On the beat benchmark’s held-out half (557 songs of MTG-Jamendo against librosa’s beats, 668 of people’s loops from the Freesound Loop Dataset against their own grid), the narrower range and the backbeat together keep more of a song’s bars in step (+0.015 of them, +0.058 when it is played drifting as a band does) and put more of a loop’s bar lines on its downbeats (from 0.185 to 0.267), with no measure worse.

Key and chords. Chroma comes from FFT bins close to an equal-tempered pitch, so drums and noise smear less into it. The key is chosen among the four best Krumhansl-Kessler fits of the loudness-weighted average chroma, by its fit plus how many bar chords it explains diatonically, how often its tonic chord appears, and how much bass sits on its tonic. Each bar’s chord is matched against triad and seventh templates, with a pull towards the key’s diatonic chords, using a bass chroma read in the second half of each of the first three beats, where the kick has decayed and a sidechained bass has swelled back.

Sections (structure.rs, design record 0022). Each bar is heard as its harmony (the pitch classes of each of its four beats), its timbre (twelve cepstral coefficients of its spectrum), how loud and how bright it is, its kit (its drums apart, else how strongly its hits strike over the bar), its bass, and how much of it a voice sings (the words cuts hears in the vocals, over the bars round each so that a breath between lines is no change). A section starts where how the bars sound stops being like it was (Foote’s checkerboard novelty over the similarity of every pair of bars, at 4 bars and at 2), where the chords a passage plays change (whatever their order), where a run of bars that comes back 8 bars or more later starts or ends (a diagonal stripe in the harmony’s similarity, which marks both verses’ starts however unlike the bars within each are), and where the voice, the kit or the loudness comes in or goes. Each change is scaled to the song’s clearest but never by more than a real change measures, so that a loop’s noise is no boundary. Of every way to cut the song, dynamic programming keeps the one whose boundaries are most novel, less a cost for each, under a preference for sections of 8 and 16 bars that never forbids another length (17 bars stays 17 where the boundary is clear), the bars counted as a phrase’s: a bar over 3.2 s (a slow song, or one heard at half its tempo) as two, one under 1.6 s as half. Sections that rise together, bar by bar, into a louder one are one build. With the stems apart, what the voice sings, beat by beat, counts as much as the chords in the stripes and in the letters of two sections both sung: a song on one loop of chords tells its verse from its chorus by the tune. Sections whose chords, tune and sound go on alike (the chords moved up to two semitones, as a last chorus may be) share a letter, by average linkage.

What each is. In a song a voice sings a quarter of at least, the chorus is the music it sings again and again that is loudest and sung most, ends the singing and does not start it; the verse is the other music it sings again and that leads to the chorus; a pre-chorus comes between; a post-chorus is loud music no one sings right after a chorus; a bridge is sung once, after two choruses or after one and 8 bars long; the intro and the outro play before the voice and after it, and an instrumental or a break between. Without the stems the voice is not heard, and a song is taken as sung wherever it plays fully. A track no one sings in (the stems apart and the vocals all but silent) is named by loudness: drops are the loudest sections with the kit and the music they play, a build comes before a drop, the intro before the first and the outro after the last, a break is quiet or has no kit, a groove the rest. Each section’s energy is its loudness scaled between the quietest and loudest sections, from 0.3 to 1, a groove’s 0.72 for all of them when they are within 1.5 dB of each other. A section builds over its last bars where they rise, bar by bar, into a louder section, which resolves the build where it starts, and a piece of a section is cut at its first bar’s line, or before it in the quiet before its first phrase where that is sung before the bar.

On JamendoLyrics, 78 songs whose lyrics are timed line by line and written in stanzas (examples/eval_structure.rs), 60% of the stanzas that start other music are heard within a bar of a section’s start, against 14% for the 4-bar blocks this replaced, and on 60 recordings of SALAMI the boundaries within 3 seconds of the annotated ones score an F-measure of 0.49 against 0.36; naming the chorus is the weak part (53% of the choruses heard as such from the mix, 51% with the stems apart, and 38% and 32% of the other stanzas taken for one). The record has the numbers in full.

Progressions. In the loudest drop, the chords are tested for repeating every 2, 4 or 8 bars, and the cycle that agrees most becomes progression A; when the chords come in pairs, it becomes one chord per two bars. Progression B is read the same way from the longest break or intro.

Drums, swing and bass. The kick, snare and hat onset envelopes (by band) are sampled at every sixteenth of every bar in the sections with a kick and energy of at least 0.6, averaged, and turned into lane templates: a step that hits in almost every bar becomes certain, weaker steps become probabilities. Swing is the median position of hat onsets in the second half of each eighth. The bass style is guessed from the kick’s step profile: rolling when ten or more sixteenths are busy, offbeat when the off-beat eighths carry more than 55 % of the on-beat weight, sustain when at most two are busy, syncopated otherwise.

Hearing a groove

analysis::groove::hear(audio, bpm) measures where each sixteenth of a recording’s bar lands and how hard. Everything rests on the grid, and a groove measured against the wrong sixteenths means nothing, so a tempo that is known (given, an Apple Loop’s in GarageBand’s catalogue, or 92bpm in the file’s name) is only tuned, within 3 %. Otherwise the song analysis guesses one, which on a short loop is often off by 3:4 or 4:3 or a few percent (on twelve of Apple’s drum loops it was right for four), and the drums’ onsets choose:

  • The tempos tried. The guess and its octaves, and for a recording of 40 seconds or less the whole bars it lasts (half a bar, 1, 2, 4, 8 or 16), which give a loop’s tempo exactly. Less likely, and winning only when they fit clearly better: 3:4, 4:3, 2:3 and 3:2 of the guess, and 3, 6 or 12 bars. Over a bar or two a guess tuned freely fits anything near, so in a recording of 12 seconds or less one within 3 % of an octave of the length is dropped.
  • How well each fits. Each is tuned in steps of 0.01 % to where the onsets sit nearest its sixteenths: the mean squared distance, in sixteenths, weighted by loudness, with the grid’s phase where the distances balance. The on-beat and the off-beat sixteenths are measured each from where they land on average, so a swing costs nothing; otherwise a loop swung at 62 % fits the grid of triplets half as fast again better than its own.
  • The tempo. The slowest that fits about as well as the best (a grid twice as fine always fits at least as well).
  • The downbeat. The beats are the sixteenths of four that the loud onsets fall on, and the downbeat is the beat with the most energy under 120 Hz.

On fourteen of those loops this finds the tempo of nine of the thirteen it can read (one has too few hits). Three of the others come out an octave off, which is where the drums sit on sixteenths either way. Telling which octave a drummer counts takes knowing a snare from a kick, which the onsets alone don’t. With the catalogue’s tempo, all thirteen are right.

Each onset is then set against the sixteenth nearest it. Each of the sixteen positions takes the median of its onsets’ distances from the grid (a position with fewer than two keeps no timing), clamped to 0.12 beats, and their mean loudness against the recording’s, clamped to 0.4 to 1.3, as its accent. The beats are put back on the grid by the mean of their timings, so a downbeat found a little early or late doesn’t move the whole groove.

Hearing drums

analysis::drums::hear(audio) names the hits of a beat, played on a kit or beatboxed, and fold sets them on a grid (a take’s, from its first beat at the song’s tempo; a file’s, from groove::beat) and folds the times round into a pattern of 1, 2 or 4 bars.

  • The onsets. Those of the whole sound and of its top over 5 kHz, which finds a quiet hat under a kick’s tail, merged within 25 ms (a kick’s body arriving after its click is the same hit).
  • What each adds. Every band at its strongest in the 50 ms after the onset, in 20 ms windows (a period of the lowest kick), less its level in the 20 ms before: the tail of the hit before is not part of this one. Of that, the shares under 150 Hz, in a drum’s body (150 to 800 Hz) and over 5 kHz. An onset that doubles none of the whole sound, its low band or its high band is a ripple inside a sound, and one 30 dB under the loudest hit is breath or the room.
  • Naming. Three clusters of those shares, started amid the quarter of hits that lie most low, most in the middle and most high, so a stray sound can’t take one. Each is named by where its middle lies, and kept only if that is near its kind: a kick’s 0.12 under 150 Hz, a hat’s 0.2 over 5 kHz with next to nothing in the body, a snare’s 40 % between. Otherwise the recording lacks that kind (a loop of kicks alone still makes three clusters), and its hits are named alone: a quarter under 150 Hz is a kick, a half over 5 kHz (or a fifth, with nothing in the body) a hat, the rest a snare. Those thresholds come from the shares of about 2,400 hits in GarageBand’s single-drum loops. A snare whose noise lies over 5 kHz more than from 800 Hz to 5 kHz is a hat: an open hat, which a snare’s and a clap’s noise lies the other way round from.
  • A second sound. A hit that adds to another kind’s band far more than hits of its own kind do there (a quarter of them add less) is that kind too: half what that kind’s own hits add, or, when every one of them lies under other hits (open hats on the kicks), three times what its own kind adds. A kick that adds from 800 Hz to 5 kHz half what the louder snares (the loudest quarter) add there, beyond what kicks usually do, has a snare or a clap on it, as house claps on the kick’s two and four; a rim on the kick adds about a third of that.
  • Folding. A step hit in at least three quarters of the times round is a hit; one hit in a quarter to three quarters plays with that chance (a trig’s prob). Its velocity is its median level against the loudest of its kind, to the power 0.6.

Measured on kits, against 15 mixes of a kick, a snare and a hat loop from GarageBand at one tempo (each loop’s own onsets the truth): kicks 89 % precision and 95 % recall, snares 68 % and 56 %, hats 91 % and 59 %. The hits missed are mostly quiet hats under other hits and snares layered with a sub, which add as much under 150 Hz as a kick does. On beatboxing, against 20 four-bar beats built from the recordings of a published beatbox dataset (Mehta and others, 2022; maxardito/beatbox on Hugging Face), one performer’s kick, snare and hat each, hits are found nearly all the time (98 to 100 % recall). The kicks are the weak kind, at 49 % precision: a beatboxed snare’s release, 12 to 27 dB under it and a sixteenth later, is heard as a kick, and telling it from a ghost note a sixteenth after a hit would take more than level. Snares are at 65 %, hats at 87 %.

Writing a new song on it

analysis::song::to_blueprint(analysis, genre, seed, ...) generates a song in the genre at the analysed tempo and key, then replaces its skeleton with the analysis: progressions A and B and their chord length, the swing, and the form, one section per analysed section with its length rounded to whole 4-bar phrases, its energy, and layers chosen from what was heard (the kick when there was a kick, hat-like lanes with hats, bass and chords by energy, the lead in drops and breaks). Intros filter in, sections before a drop build with a gap, drops after something else get an impact, quiet sections use the sparse drum variant. The kick, snare, clap and hat lanes get new patterns drawn from the analysed templates, and the bass takes the analysed style when the genre has it. The sounds and the mix come from the genre. claudius remake --skeleton and the remake command with sampled: false do exactly this, and the song’s history begins with remade from <file>: <tempo> BPM, <key>, <n> sections, progression <numerals>.

Its stems

With the ears, a remake first separates the recording into its vocals, its drums, its bass and the rest (crate::stems, Spleeter’s four nets through earshot::separate): about 8 s for a four-minute song, once, kept in memory and in the cache folder (stems/, the three recordings separated last, as 24-bit FLAC) by what the recording is. The nets come down the first time they are needed once the ears have been asked for (Ears::load); without them, or without the ears, nothing is separated and everything below hears the mix as before. The analysis then hears each thing in its own stem (analyze_with): the beats and the drum habits in the drums when a kit plays (a recording whose drums hold under a twentieth of its power has none, and its sections no kick or hats), the chords in the bass and the rest without the voice’s melody over them, the bass under each chord in the bass, and where the voice and the kit come and go among the cues for its sections.

Reworking it

A remake is a rework unless asked otherwise (remix::rework), which keeps the recording the song it is. With its stems apart, the rest of it above its bass, from its first downbeat to the end of its last bar, is a loop track, original, that plays once from the first section through all of them (a take’s from), through the genre’s treatment of a phrase it samples with a high-pass at 80 Hz; its drums and its bass are left to the genre’s. When it sings (its vocals hold a twentieth of its power, Stems::sung), its voice is another such track beside it, vocals, with the vocal role and a vocal’s mix (remix::voice_mix: high-passed at 100 Hz, compressed, with less reverb, delay and ducking than a sampled phrase, since its own room is in it, and 2 dB louder, the song’s own singer on the genre’s drums and bass), and original holds its voice only when it does not sing (and is left out when the rest holds under a fiftieth of its power, a voice over a beat). Without the stems the recording is split into what sustains and what strikes (fft::harmonic), and what sustains is the loop, with the high-pass at 150 Hz at least, which leaves the low end to the genre’s bass and kick. The song generated in the genre at the recording’s tempo (rework_tempo: from the length of its bars, doubled when that is nearer the genre’s range, two bars of the song to each of its own, or halved, one to two of its own, when that is nearer and the recording holds each chord two bars, three pairs in four, since a bar of the song plays one chord; so that the loop is not stretched) and in its key then takes the recording’s skeleton exactly: one section per analysed section, as long as it was heard, its kind and energy, the layers of the genre’s section most like it (of its kind, else the nearest in energy) that play under a recording (drum lanes, the bass, the break and the textures, not chords, keys, pads or leads, which would play against its own and against it where a chord was heard wrong), a progression per run of its bars’ chords at one chord a bar, and the recording’s swing. Parts the sections do not play are left out. The recording’s sections are brought halfway to the middle of their levels (sections_levelled: by 9 dB at most, the gain moving over the last beat before a section; a section 30 dB under the loudest is a rest and is left as it is), since the genre’s drums keep one level. The history says reworked from '<file>': all <n> bars of it, ....

Flipping it

With flip, a remake is a new song on the recording’s sound (remix::remix): the recording without its drums (its bass and the rest, with the stems apart, its voice left to the sampler’s phrases, unless the bass and the rest hold under 15 % of its power, remix::BACKING, when its vocals stay in; else what sustains of it, fft::harmonic) and its drums (its drum stem; else what strikes), cut into the pieces a producer would take from it, on the bars it plays. A hook a voice sings in (the recording sings, and its voice was not taken out) is offered at its own pitch only, and not re-chopped (remix::own_key: the genre’s pitch narrowed to none and its chop to 0), wherever a way of playing it so meets the genre’s tempo, unless the genre’s producers speed their singers up (speeds_voices, chipmunk soul’s). In a genre whose phrase says how far under its range it plays a record at the record’s own speed (under, trip hop’s 0.25), such a hook is stretched by a tenth at most (remix::SUNG_STRETCH, to the range’s nearest edge; where nothing stretches, as in the web studio, the song takes the nearest of the hook’s own tempo, half or twice it, just outside the range instead, which a sampler meets at the voice’s own pitch): further than that, the song plays at the hook’s own tempo, half or twice it, the fastest of them under reaches below the range (remix::sung_tempo: a pop record of 125 BPM as trip hop at 62.5), with the genre’s drums in place of the recording’s, which would play on at twice the song’s tempo. Its pieces are chosen by the scores the Sample window offers pieces by (kinds::cuts_of): its hook (remix::hook_of, a loop of the hook of eight bars, else four or two, from the hook’s sections), another passage as long (passage_of, from none of them) and its drums (break_of, a drum break of the lengths a break takes), each the best on take 0 and drawn among the near-best for any other seed, as another take is; where no loop of the hook can be cut (no chord rings in it), the hook falls back to the first bars of the section with chords that pulls most toward being one (hook_bars). The hook without its drums is offered to the sampling pipeline as the phrase a song is built on (sampling::apply, through a library that holds only the recording’s pieces and the libraries’ one-shots, loops and textures), with the other passage as the phrase’s second passage and the drums as the break where the genre samples one. So the song takes the hook’s key and chords and a tempo the genre plays, the recording’s own or a multiple of it (sampling::meets). A flip of it follows: as many bars as the hook of half beats, each from another bar of the recording on the hook’s chord at that place, each bar brought to the hook’s level (bar_gains, by 18 dB at most, a rest left as it is), in the intro, the breaks and the outro where the other passage does not play. Then the sampler brings in its sung phrases, from the recording as the remix heard it (sampler::sample_from: its stems and its analysis, not separated or analysed again). A recording with no section with chords long enough falls back to the skeleton, and the reply says so. The song’s history says what came from where: remixed from '<file>': its hook (bars 33-36) without its drums; ....

Rebuilding it

With rebuild, a remake is the song itself made again on claudius’s sounds (rebuild::rebuild), so that each note can be changed. What it heard comes first (rebuild::played), and the song is written from that alone (rebuild_with, which the tests feed with what they say was heard):

  • The form is the recording’s sections, each its own kind, length and energy, its drum variant named after it, and on a progression of its own (A, B … one to a section, unlike a rework’s one to each run of chords), its bars’ chords at one a bar. A part’s written notes are kept per progression and tiled from a section’s start (arrange::tile), so a progression to each section is what lets every section play its own notes. The tempo is the recording’s own (Analysis::cut_bpm), its band’s speeding up and slowing down taken out: a time in it is a beat of the song through its bars (Analysis::bar_at, bar_start).
  • The drums are the hits analysis::drums::hear finds in its drum stem. Each section’s are folded into a pattern of its own (fold, four bars or as many as the section has), written into the genre’s kick, snare (or clap) and hat lanes as the section’s variant (script::put_hits), with a trig’s chance where a step plays only some of the times round, at sixteenths and in the recording’s swing (the genre lane’s own speed, length, swing and groove undone). Each lane is as late or early as its hits on the beats are on average, which no swing moves (late_ms, within 3 ms none, 40 ms at most). Without a drum stem, the drum habits of the busiest sections (kick_steps …) play wherever the kick is heard.
  • The bass and the rest are the notes of their stems as Basic Pitch hears them (transcribe::notes, through earshot::notes), the bass from 30 to 500 Hz with notes of 80 ms and more (a pickup a sixteenth long is under Basic Pitch’s own 128 ms at 120 BPM), the rest from 55 Hz to 4.2 kHz with 100 ms. A stem’s notes 18 dB under its loud ones (the tenth loudest) are another instrument’s bleeding into it, which the model hears as surely as the stem’s own (rebuild::own). A note an octave, a twelfth, two octaves or two and a third or a fifth over one it starts with, which the model is half as sure of again, is that note’s overtone. The bass plays one note at a time (of notes struck together the surest, or the lower of two nearly as sure, each cut where the next starts); the rest plays chords and all. Both are set on the sixteenths, their velocity from how sure the model is, and each section’s are written for its progression, the part in the sections it plays in, on the genre’s bass and keys (or chords) part’s sound and mix. Without the ears, the genre’s bass and chord parts write their own on the recording’s chords, where its bass and harmony are heard.
  • The voice, when it sings (Stems::sung), stays on vocals as a rework’s does, and its melody (analysis:: melody::transcribe, in its key on the sixteenths) is written out on a lead, melody, that plays in no section.

Its history says what it heard: rebuilt from '<file>': its 4 sections bar for bar, on its chords; its drums struck as it strikes them, each section's folded into a pattern of its own (113 on clap, 232 on hat, 243 on kick); its bass as 214 notes on bass; the rest of it as 866 notes on keys. Against a render whose notes are known (the cookbook’s house song), 99 % of the rebuilt kicks and 98 % of its hats land on sixteenths it strikes, missing none, and two thirds of its claps; the bass notes are 87 % right (pitch and sixteenth) and 93 % found, the rest’s 67 % and 71 %.

Where it goes wrong

Analysis is best on steady electronic music with a clear kick, and approximate everywhere. Reading claudius’ own D minor deep house song back:

118.0 BPM (pulse clarity 0.55), Bb major (confidence 0.43), swing 0.50, 52 bars from 0.00 s
  progression A: iii7 Imaj7 vi7 vii  |  B: Imaj7 Imaj7  (1 bar(s) per chord)

The tempo and the first downbeat are exact. The chords of A (Dm7, B♭maj7, Gm7, Am) are the song’s own (Dm7, B♭maj7, Gm7, Am7) in the right order, named in B♭ major, the key of the song’s sixth degree, with the seventh of the last one missed. Progression B, read from a 12-bar break, came out as two bars of B♭maj7, the first of the song’s four chords. The usual failures are these: half or double tempo (a genre’s tempo range fixes most), a relative or neighbouring key, a progression rotated when the first downbeat lands a beat or a bar off, and sections merged when their energy is close. CLAUDIUS_DEBUG=1 prints the downbeat cues per phase.

Hearing a melody

voice/ reads a voice, one note at a time: its pitch, the notes it means, and how its singer sings. analysis::melody::transcribe(audio, key, options) uses it to turn a take’s melody into notes for take::melody (the transcribe_take command), and voice::assess and take::assess (assess_voice) to say how it is sung.

  • Pitch (voice/pitch.rs). The take is mixed to mono, low-passed twice at 3 kHz and decimated to 8 kHz, which leaves a voice’s fundamental and its first harmonics. YIN (de Cheveigné and Kawahara 2002) reads a pitch from 50 Hz to 1 kHz every 10 ms, over a 50 ms window: the first dip of the cumulative mean normalised difference under 0.15, refined between samples by a parabola, and its depth is the frame’s clarity. A frame more than 35 dB under the take’s loudest is unvoiced, whatever its pitch, and a frame more than four semitones from the median of its five neighbours (an octave or a harmonic jumped to) takes the median. Each voiced frame’s period is then found again at 48 kHz, within 3 % of YIN’s, as the lag that differs least from itself over 20 ms, which reads a held pitch to a cent. pitch::rough skips that, for the sampler’s look at whole songs.
  • Where the notes are (voice/intent.rs). A hidden Markov model over the notes the take may be singing (pYIN’s note tracker in Tony, Mauch et al. 2015, works the same way): each note has an attack state, which reaches a semitone or so for scoops and slides and costs half its likelihood, and a hold state, read from the pitch’s median over 150 ms, which keeps a note’s edges and loses its vibrato; silence is a state of its own. A frame without a pitch is likelier in silence (0.9) than in a note (0.1), and a rise of more than 3 dB within 30 ms speaks for an attack. A hold is left at 2 % a frame, an attack settles at 20 %, and silence starts a note at 3 %. Viterbi gives the states; a note runs from where the path enters its attack to where it leaves the note or attacks it again, and notes under 70 ms are dropped. A note is settled from the first of three frames within 30 cents of its median, and its place is the median after that.
  • Which note each one is. A singer puts a note off by so much for the whole of it, so frames, which would make any small error certain, do not decide it. A chain over the notes does: each note is read once, from its place, as a normal around where this singer puts each candidate (Voice::bias_at) with their scatter (Voice::spread_at), and a note follows the one before by the song’s weights (1 for a tone of the key, 1.6 for a tone of the chord under the note, 0.12 for any other) and the step (0.8 for the same note, falling by e for every 5 semitones beyond the first); after a silence of more than a second the step counts for nothing. Viterbi names the notes and forward-backward gives each its sure. The wider the singer’s scatter, the further the song moves the line between two notes: in C major, from anyone’s 30 cents, a note is read as F up to about 70 cents above it.
  • The singer (voice/singer.rs). fit learns a Voice from notes heard against the notes meant. Notes 0.75 semitone or more off were another note, missed, and do not count. Where they sing is a least-squares fit of three values, at the bottom, the middle and the top of the range, interpolated between, each leaning on in-tune singing by a tenth of a note; how widely is the scatter left around that at each place, leaning on anyone’s 30 cents by half a note. The settling is the median, and the vibrato the median of the notes of 400 ms or more whose detrended pitch swings 4 to 8 times a second by 5 cents or more (an autocorrelation peak over 0.3). Voice::hit is the chance of a note within so many cents, from that normal.
  • Learning from the singing alone. voice::assess reads the notes with anyone’s voice, fits the singer to them, and reads them again with that voice, twice. A take is read with the song’s key and the chords under it from where it starts (intent::Scale::song).
  • The grid. Each note’s start and end go to the nearest sixteenth, measured from the middle of the frames’ windows. A note in the song’s key keeps its pitch; one outside it goes to the key’s tone nearest where it was sung (unless chromatic), and its velocity follows its loudness. Two notes on one sixteenth keep the longer, and a note ends where the next begins.

The notes go into the new parts’ notes, by the progression of each section the take covers. Written notes may run over several cycles of their progression, and arrange repeats them only after the last cycle they reach. On the way, take::styled can make them harmony, octaves, chords, a bass line, an arpeggio or a pad. It counts by the key’s scale steps (Key::step), so a third above or a triad under a note stays in the key.

Checking a voice

voice::check::Check is a pitch check: six phrases of four notes in a random major key between two notes, each a random walk on the scale, a step of one or two degrees seven times in ten and a leap of three or four otherwise, at 90 BPM, a beat a note. A phrase takes ten beats: its four notes, a beat’s rest, four beats to answer in, a beat’s rest. Check::hear reads each answer from 200 ms before its first beat to the next phrase, with anyone’s voice in no key (what was sung, not what should have been), and lines the notes up with the phrase’s by the least cost: a note sung for a note played costs how far off it was (a semitone and a half at most), a note not sung 1.2, a note that answers none 0.8. It tries the phrase two octaves down to one up and keeps the octave that costs least, and fits the voice (singer::fit) to the notes as meant in the singer’s octave. A note reached by three semitones or more is a leap.

Tuning a voice

voice::tune::tune moves a voice onto the notes it means, as the tune effect, claudius tune and the tune command do. It reads the notes (intent::decode with the singer given, or voice::learn from the voice itself) and works out a move for every frame, in semitones:

  • Towards the note. A frame’s centre is the mean pitch of the frames around it within 90 ms, inside its note, which takes out a vibrato; frames more than 1.5 semitones from where the note is held (a slide, an octave misheard) count for nothing and move as the frames around them. Of how far the centre is from the note, the singer’s bias goes whole; of the rest, a share humanize² / spread² stays (all of it when the singer scatters less than humanize), so the tuner moves a loose singer in and leaves a precise one.
  • When. The move comes in as 1 - e^(-t / speed_ms) from the note’s start, so a slow tuner leaves the scoop into a note, and strength (a Param, by beat) scales it.
  • The vibrato. vibrato below 1 takes that share of the swing around the centre out as well.
  • Between notes, the move goes in a straight line from one note’s to the next, and a three-frame mean smooths it.

The voiced stretches (voiced frames, with gaps of up to two) are then moved by TD-PSOLA (Moulines and Charpentier 1990, dsp/psola.rs). Marks go a period apart, each where the voice looks most like it did a period before (the best normalised correlation within a sixth of a period), so that every grain is cut at the same point of its period. Each output mark takes the grain at the input mark nearest it, two periods long with Hann halves as long as the periods either side, and the next output mark comes the input period on, over the ratio. Laid back where they were cut, the grains add up to the signal itself; moved, they are divided by how much of them overlaps. The first and the last period of a stretch are crossfaded from and back to the signal, and frames without a pitch pass as they are. The grains keep their spectra, so the voice keeps its formants. A move by the same grains, resampled, would shift the formants instead, which is how a voice can later sound larger or smaller.

The tests sing to it (voice::sing): three harmonics with a 5.5 Hz vibrato, breath noise, a 30 ms glide into each note and breaths where asked. Their melodies come back with every pitch and onset where it was sung, a singer 60 cents flat comes back as the notes meant once the voice is known, and a singer flat at the top only is learnt as flat there.

Sample packs

crates/claudius-packs turns freely licensed sample libraries, published in a dozen different layouts, into instruments the engine can play by name. It is a library (used by the engine, the server and the CLI) and the claudius-packs binary. Sample packs is the user’s side; this page is how it works.

filewhat it does
registry.json, catalog.rsthe curated packs: what each contains, its licence as read from the source, how to fetch and map it
install.rsbuilds a pack’s index from its registry entry (sources, key-split composites) and installs it; removes packs
install/from_sfz.rs, install/from_names.rs, install/from_map.rsinstruments from SFZ files, from file names, from Strudel maps
fetch.rsHTTP: GitHub listings, parallel resumable downloads, archives, WAV to FLAC
sfz.rsan SFZ reader
strudel.rsStrudel sample maps and the github: shorthand
notes.rsnote names, velocity and round-robin markers in file names, drum name synonyms
model.rsthe installed index format (index.json)
resolve.rsnames to instruments: aliases, banks, kits
decode.rsdecoding at the file’s own rate, and the process-wide sample cache
resample.rsband-limited interpolation for pitch and rate
player.rsrendering notes with an instrument
lib.rsthe public API: packs, install, remove, resolve, instrument, credits_for, add_sample_map

The registry

registry.json is embedded in the binary. Each pack records:

  • what it is (title, description, categories) and what was left out for size;
  • its licence (licence, licence_url), the credit line exactly as it should appear (attribution), whether the licence requires it (attribution_required), and licence_note: what the licence text says and where it was read, quoted, so a reviewer can check it without re-reading the source;
  • whether it is in the default set, opt_in with a warning, or lazy;
  • where it comes from (fetch): a GitHub repository at a pinned commit, or an archive URL with a prefix to strip and the archive’s size and sha256;
  • flac, to convert WAV downloads losslessly, and bank aliases (909, rolandtr909);
  • its instruments, each built from one of four kinds of source.
instrument sourceused forthe registry entry says
an SFZ filepianos, orchestra, basses, the acoustic kitthe .sfz path; optionally keep_layers (velocity layers to keep, widened to cover every velocity), keys, exclude, an octave correction for mappings at written pitch, kit (drum name to keys) or kit_auto (one variant per key range)
file namesthe drum machinesa glob (bd8/*.WAV), each file its own variant, first the file for variant 0, or vel, a regex whose group is the velocity layer (the 909’s accent(\d+))
a Strudel mapuzu, the lazy opt-in packsthe map’s URL at a pinned commit, keys to leave out, and map_base when the map’s _base names a branch of another repository
other instrumentsensemblescompose: key ranges taken from other instruments (strings: contrabass below MIDI 36, cellos to 57, violas to 64, violins above)

Instruments also carry playing settings: release, attack, veltrack (how much velocity changes the level), one_shot (play to the end whatever the note length), mono (a new note cuts the last, as on drum machines), retrigger (a repeated key fades the previous voice, as on a piano), unison (the choir is one sampled voice in a five-voice ensemble), and aliases.

Installing

install::install_spec builds the pack’s PackIndex and fetches its files:

  1. Sources. A GitHub source is read from raw.githubusercontent.com at the pinned commit; when an instrument is given as a file glob, the repository is also listed through GitHub’s tree API, which gives each file’s size. For an archive it downloads the file into the cache, checks its size and SHA-256 against the registry, unpacks it with the system’s tar (bsdtar reads zip, 7z and tar; GNU systems fall back to unzip and 7z), deletes any symbolic links in it, and strips the prefix. A Strudel map’s _base on a branch of the map’s own repository is moved to the map’s commit (strudel::pin_base), and every file of a curated map must be at a commit.
  2. Instruments. SFZ files are read with sfz.rs: #define and #include (including mid-line includes, which the sfzinstruments mappings use), the <control> <global> <master> <group> <region> inheritance chain, and default controller values; install/from_sfz.rs turns each region into a Zone. File-name sources (install/from_names.rs) are parsed with notes.rs, which reads note names (C4, Db2, Tidal’s As4), velocity and dynamic markers, and round-robin markers out of names. Strudel maps go through install/from_map.rs, and compose instruments are assembled from the others in install.rs.
  3. Files. Every file the zones use gets a path inside the pack (files/..., sanitised so .. cannot leave the pack folder) and a download URL, or a copy from the unpacked archive. Files no zone uses are dropped, and files on disk the new index does not reference are deleted, so updating a pack also cleans it.
  4. Downloads run on 8 threads. Each goes to <file>.part, resumes with an HTTP range request when a .part is already there, is checked against the expected size when the listing gave one (and against Content-Length always), and is renamed into place, so an interrupted install leaves only .part files and resumes on the next run. A Git LFS pointer is recognised and fetched again from media.githubusercontent.com. Failures are retried three times with backoff, except 4xx answers other than 429.
  5. FLAC. With flac, a WAV is encoded losslessly with flacenc as it arrives (float WAV becomes 24-bit).
  6. The index is written to index.json.tmp and renamed, so a pack is either installed or not.

A lazy pack stops after step 3 and records each file’s URL in its index; the player downloads a file the first time a note needs it. add_sample_map builds a lazy user pack from any Strudel map, taking the licence from the map’s _license or GitHub’s licence detection.

The index

<packs>/<pack>/index.json is a PackIndex: the pack’s metadata, its files (path, URL, size, whether to convert to FLAC), and its instruments. An instrument has one or more variants (the :2 in tr808:sd:2), and a variant is a list of Zones:

zone fieldmeaning
file, rootthe sample and the MIDI pitch it was recorded at (fractional for detuned regions)
lokey..hikey, lovel..hivelthe keys and velocities it answers
xfin, xfoutvelocity crossfades, with SFZ’s power curve so overlapping layers keep constant power
seq_len, seq_posround robin: the cycle length and this zone’s place in it
lorand, hirandrandom alternatives
gain_db, pan, offset, end, keytracklevel, balance, sample range, how much the pitch follows the key
loop_mode, loop_start, loop_endsustain loops
attack, hold, decay, sustain, releasethe amplitude envelope, when the zone overrides the instrument’s

The installed index is the only thing the player reads, so a pack can be built by hand: tests/offline.rs writes a pack of sine waves and an index, and plays it.

Names

resolve::resolve_in(installed, name, bank) turns a name into an InstrumentRef (pack, instrument, variant), in this order:

  1. with a bank, the bank’s pack (by name or alias) and the instrument in it, by name, alias or drum synonym; or a Strudel-style instrument named <bank>_<sound> in any pack;
  2. pack:instrument[:variant], or bank:sound when the first part is a Strudel bank;
  3. friendly aliases (ALIASES), each a list of candidates in order of preference, the first installed one winning: piano is salamander:piano, else splendid:piano, else freepats:upright_piano, else piano-lite:piano;
  4. bare drum names, in the first kit of KIT_PREFERENCE (tr909, tr808, muldjord, tr707, uzu) that has them;
  5. exact instrument names and per-instrument aliases, default packs first, then user packs, then opt-in packs;
  6. a drum synonym in any pack, a Bank_sound name, and finally a pack name alone (its first instrument).

notes::drum_canonical maps drum synonyms to canonical names (kick, kd, bassdrum to bd), which is how s("kick").bank("808") finds the 808’s bd. Resolution is cheap and runs every time a script names a sound; the installed indexes are cached per process (refresh() forgets them). set_disabled(true), which --synth-only calls, makes installed() return no packs, so every name falls through to the synthesizer.

The player

Instrument::render(notes, len) renders NoteOns (start and gate in output samples, a fractional pitch, a velocity) into a 48 kHz stereo buffer:

  • Zone selection (select): the zones that cover the key and velocity, with round robin counted per key (so repeated notes alternate samples) and random alternatives drawn from a hash of the note’s start, index and key, not a random stream, so the same notes always give the same audio.
  • Pitch is (pitch − root) × keytrack semitones. The source’s sample rate is folded into the same step, so a 44.1 kHz sample played a fifth up is interpolated once, not resampled and then pitched. Interpolation is a Kaiser-windowed sinc with 16 zero crossings a side, widened when reading faster than one source sample per output sample, so pitching up filters out what would alias.
  • Level. Velocity picks layers and, through veltrack, scales the level as (v / 127)^(2 × veltrack) (or a vel_curve). Each instrument is normalised once, so that the loudest zone nearest middle C peaks at −6 dBFS at full velocity; that keeps instruments from different libraries at comparable levels before the mixer balances them.
  • Envelope and loops. Attack, hold, decay, sustain and release, with sustain loops for zones that loop while the key is held. one_shot instruments ignore the gate.
  • Cuts. mono instruments fade the previous voice in 4 ms when a new note starts; retrigger instruments fade a repeated key’s previous voice over 120 ms; render_choked cuts every voice sounding at a choke time in 8 ms (the open hat under the closed hat).
  • Unison. An instrument with unison plays every note as several copies, detuned, panned and staggered by up to delay_ms, at 1/√n gain each: the choir is the solo voice five times, ±14 cents, 35 ms apart at most.
  • Speed. Voices render in parallel batches of 64 and are summed in a fixed order.

Decoded samples come from the cache in decode.rs: WAV through hound (keeping its loop points), everything else through claudius-decode, at the file’s own rate, with the silent tail trimmed and a short fade. The cache is shared by the whole process and bounded by CLAUDIUS_PACKS_CACHE_MB (3072): over budget, the least recently used samples that no voice holds are dropped until it is at 80 %. Concurrent requests for one file wait for a single decode.

Credits

credits_for(names) resolves the instrument names a song plays, collects their packs, and writes the packs that require attribution first, then the rest as courtesy credits, then a warning for packs with an unknown licence. A credit line is the pack’s attribution, its licence when the attribution does not already name it, and the licence URL. The engine calls it with the instruments of a project’s tracks, so a song credits what it used and nothing else.

Web editions

A browser has no folder to install a pack in. claudius-packs web <out> <base url> <pack>:<instrument>[=alias]... makes a web edition of installed instruments (web::edition): of each, its first variants, one velocity layer (two for a keyboard and a drum), its first round robin, a root every three semitones with its keys reaching halfway to the next, and a few seconds of each note (web::Limits), as Ogg Vorbis, with an index that is a pack’s like any other and URLs under <base url>/<pack>; and out/index.json naming the packs, and out/CREDITS.txt. Its index also says whether each instrument was recorded in mono (recorded_mono), which a song asks as it draws its sounds, before their files come. A process without the files on disk is handed the index (provide), so its instruments resolve as installed ones do, and then each file as its bytes (provide_file), decoded into the cache and kept there, since there is nothing to decode again; wanted says which files a set of instruments still needs. An instrument’s level is found from its file once that comes, so a sound asked for before it does is not held at a guess. The web studio’s demo plays the site’s editions so (The demo’s instruments).

Checking a pack

claudius-packs audition renders every instrument (an arpeggio and a held chord for pitched instruments, a few hits for drums, a beat for every kit with bd, sd and hh) and checks each pitched one for octave mistakes in its mapping: a correctly mapped harmonic sound has nothing at half its fundamental, and its fundamental is not tens of dB below the octave above. That is how a mapping at written pitch shows up; the registry corrects the ones it knows with octave (the piccolo, xylophone and glockenspiel, the growly bass, the solo voice, the drawbar organ). Tubular bells are skipped, since a chime has no partial at its nominal pitch.

Adding a pack

  1. Read the licence where the samples are published, and quote it in licence_note. A pack enters the default set only if its licence allows making and publishing music with it without conditions beyond attribution; 0007 Which samples we ship has the rules and the cases that were refused.
  2. Pin the source: a commit for GitHub (rev); for an archive its size and sha256 (shasum -a 256 <file>); for a Strudel map, its URL at a commit, and map_base at a commit when its _base names a branch of another repository. every_download_is_pinned checks the registry.
  3. Write the instruments, start with claudius-packs install <name>, and listen with claudius-packs audition /tmp/audition --pack <name>, fixing the mapping until the audition reports no problems.
  4. Check the names: claudius-packs resolve and aliases, and whether the new pack should be a candidate in ALIASES or KIT_PREFERENCE.
  5. Run cargo test -p claudius-packs, and the network test with cargo test -p claudius-packs -- --ignored.

Server, sessions and MCP

crates/claudius-server wraps the engine in a session that many clients share: the studio window, browser tabs, assistants over MCP and anything that speaks HTTP. 0005 One session, many clients records why there is exactly one.

filewhat it holds
lib.rsserve (on the caller’s runtime) and spawn (on a thread with its own runtime, for the native window), and what a taken port says
app/mod.rsApp and its Session: state, versions, waiting for changes
app/commands.rsevery Command: the edits (made by claudius-session), undo and redo, load and save, analysis
app/jobs.rsthe long jobs: render and judge, mutate, evolve, save, install packs
http.rsthe routes, the guard (host names, token), CORS, security headers
mcp.rsthe MCP tools, the backends they run on, the stdio and HTTP transports
mcp/raw.rsthe command tool’s check: a raw command against Command’s JSON schema (claudius-api’s schema feature), so that a field written wrong is answered with what the command takes rather than dropped

The session

An App holds one Session behind a mutex:

fieldwhat it is
versionbumped by every change to anything below
song_versionthe version at which the song last changed
bp, viewthe blueprint, and its SongView (built once per change, not per request)
historyevery change made to the song, as a log that only grows, and the undo and redo steps: whole blueprints with labels, at most 200 (claudius_session::history)
renderthe latest finished render’s RenderView and the paths of its stems
verdict, loudnessits verdict, and each track’s loudness in the master
busy, progress, job, rerenderthe running job, and whether a render was asked for meanwhile
pending_savesthe folders saves asked for during a job, all written from one render when the job ends
logthe last 200 lines

Four primitives keep it consistent:

  • lock() takes the session mutex for a moment, to read or swap state, never across a script or a render; a poisoned lock is recovered rather than propagated, since the state is valid after any panic in a job.
  • update(f) runs f on the session, bumps version, and sends the new version on a tokio::sync::watch channel, which wakes every long poll.
  • try_update(f) is update for a change that may be refused: when f returns an error it must have left the session as it was, and there is no new version, so nobody waiting on the state wakes for nothing. A failed undo or redo and a job refused as busy go through it.
  • The edit mutex serialises edits. Scripts take milliseconds to seconds (cutting a one-shot from an Apple Loop the first time, for instance), and two edits must not both start from the same blueprint.

Edits

Every edit works on a copy and commits only on success:

  • run_script(code) runs the script on a copy of the blueprint. If the copy did not change, the reply is the script’s log (or ran; nothing changed) and no undo step is made. If it changed, it is committed with a label for undo: the caller’s (tempo 124, mix bass: level: -2, duck: 0.6), or one made from the script’s first line.
  • The edits themselves live in claudius-session (edit.rs), which the browser’s demo shares. set_tempo, set_key, set_swing, set_progression, set_drum_pattern, set_part, add_track (drum() and drum_sound() for a lane, part() with a role for a part, after checking the name is one word and new), remove_track (remove()), set_notes (notes(), or clear_notes() without notes), set_mix, set_lane and set_trig are the script that says them (edit::script, every string through pattern::quote) and go through run_script, so the studio’s controls and scripts validate the same way and fail with the same messages.
  • The other edits (set_section, add_section, remove_section, move_section, split_section, toggle_layer, set_drum_step, set_fx) change the blueprint in place (edit::change), in edit_with, which also checks the song’s size and commits only when something changed.

commit records the edit in the history (History::commit: an operation in the log, the old blueprint and the label as an undo step, and no redo left), rebuilds the view, logs the message, and then after_change sets song_version to the new version and, unless the session runs with --no-auto-render, starts a render. Undo and redo swap whole blueprints between the stacks; a blueprint is tens of kilobytes, so 200 of them cost a few megabytes, and undo can never fail to restore exactly what was there.

The history

claudius_session::history, which the browser’s demo shares, keeps every change made to the song as an operation in a log that only grows (0012): its id (the session’s own random id and its Lamport time), the operation it was made on, when, what kind it is (an edit with the command that made it, an undo or a redo of an edit, or going back to before one, go_back), what undo calls it, what it changed in words (describe: “added the whistle track (lead), playing the synth whistle”; a section given another name, “renamed the drop section to chorus”, though its old name goes out of the list and the new one comes in), and what it changed in the song: each path of the blueprint’s JSON whose value changed, with the value before and after (diff). A path names the elements of a list of named things (/parts/@bass/mix/level_db) and keeps the list’s order as a value of its own (/parts/#), so a change to one track says which track it was, whatever happens to the others. The changes of every operation, applied in order to no song at all, make the song as it is (apply), and taken back in reverse they make it as it was.

Another song in the song’s place (a new song, one opened, a recording remade: commit_song) is one change of the whole song, at the empty path, and so is its undo or redo. A song’s own log begins at the edit that put the song as it is in its place: the latest such edit undo can still take back, so that every undo, redo and going back since replays with the steps it took, or the whole log when that edit is past undo’s reach. A save that copies the song’s takes into its folder repoints them, and records that as a moved operation, which changes neither undo nor redo.

Undo, redo and going back are operations of their own, whose changes take the song back or forward; nothing in the log is ever taken out or rewritten. Edits made together (together, which the palette sends for a request a person confirmed) are one operation. They are made one after another on a copy of the song (edit::together), under the edit lock so that no other edit comes between them, and the song they make is committed once. When one of them fails, none is made and nothing is recorded. The state lists the last 200 (State::history, the latest first), each with whether go_back can still take the song to before it: an edit among the undo steps. Saving writes the song’s own log into its folder (history.jsonl, one operation a line). Loading the folder replays it (History::open), so undo and redo carry on as they were. When blueprint.json was edited by hand since, the difference is an edit of its own (“changed outside claudius”), and a log that does not read or apply is a history begun anew.

Versions and waiting

state_after(since, timeout) returns at once when version > since, and otherwise waits on the watch channel until it is, or until the timeout. settled(timeout) waits until is_settled(): no job is running, and either there is no song, or the render is of the current song (render.version >= song_version), or auto-render is off and no render is pending. The HTTP API exposes both as GET /api/state?since=N and ?settled=1; the MCP tools wait on settled after every edit.

A render belongs to the song version it started from, so a client can always tell a stale render from a current one, even while the next render runs. Audio URLs carry that version (/api/audio/12.mp3), so a URL always means the same audio, until the session prunes it.

Jobs

Renders, mutations, evolutions, saves and pack downloads are jobs. A pack download that ends passes its outcome to claudius_server::REPORT, the hook through which claudius-cli counts it in its usage statistics, which send nothing unless the person turned them on (privacy). start_job (and, for install_packs, which needs no song, take_slot alone) takes the job slot through try_update, so a refusal (busy (rendering); try again when it is done, or cancel it) changes nothing, not even the version; it marks the session busy and spawn_job runs the job on a std::thread, catching panics (the job failed (internal error)). When the job ends, finish_job decides who has the slot next, in this order:

  1. waiting saves (pending_saves) take it straight away, without clearing the busy state, so nobody sees the session idle in between and settled waits for the save too; its render, of the song as it is then, also serves as the fresh render;
  2. otherwise the busy state is cleared and, if the render is stale (a render was asked for during the job, or auto-render is on and the song changed), a render starts 100 ms later;
  3. otherwise the session is idle.

That is also the debounce: an edit starts a render job that first sleeps 200 ms; edits arriving during the sleep or the render only mark the render stale, and the job’s end starts one more render for all of them. A burst of edits made while a render runs costs one more render, not one per edit, and the last render is always of the final song.

save(path) checks the folder against the file policy, writes blueprint.json and song.rhai at once (a write error is the reply), and then either starts a render job for the folder or, when a job holds the slot, adds the folder to pending_saves and answers saving to <folder>: blueprint.json and song.rhai now, the audio once the current job (rendering) is done. Every save made during one job gets its folder, all from the same render. If the job ended between the two steps, the save tries again to start, so it is never left waiting for a job that is gone.

render_job:

  1. takes the blueprint and song_version under the lock, and arranges and renders outside it, with stems when they were asked for or the render is for a save;
  2. judges the render, with the ears when the background loader has finished (the session loads CLAP only, not the AudioSet tagger);
  3. writes the master to <cache>/renders/<process id>-<session>/<version>.wav, and stems to <version>/<track>.wav as 24-bit WAVs;
  4. builds the RenderView: URL, length, loudness, section times, a 1000-point waveform, stem names;
  5. computes each track’s loudness in the master (its measured level plus its gain plus the master’s gain from pre-master to final);
  6. for a save, writes the whole song folder from this render with song::write_folder, the function the CLI uses, so the score in it is the song its audio plays;
  7. publishes the render unless a newer one already landed, logs rendered in 7.7 s: -10.1 LUFS, verdict 98.0 — ... and, for a save, saved <folder> or could not save <folder>: <reason>, and deletes renders older than the last ten.

mutate_job and evolve_job run the searches described in Evolution and analysis, reporting progress through busy, progress and one log line per candidate, and commit the best result as one undoable change. cancel sets a flag those two check between candidates and generations; renders do not check it.

Files

Settings::file_roots is the file policy: None for a claudius only you can reach, config::shared_roots() plus the --files folders for one started with --public, --host beyond loopback, or --files. readable(path) guards load, analyze, remake, add_take and sample_song with config::read_error, which scripts use for .s(path) too, so both refuse a path outside the roots with the same words whether or not it exists. config::write_allowed guards save and the folder a take is kept in (app/takes.rs), and opening a blueprint checks every file it plays. The security model discusses its limits.

Starting up

App::new creates its render folder, deletes the render folders of sessions that last wrote more than 12 hours ago, opens the Apple Loops library and the user library (unless --synth-only or --no-library), and, unless --no-ears, loads earshot’s models on a background thread, logging ears ready (<seconds> s): verdicts now include earshot's listening or why not. --synth-only also turns the sample packs off for the whole process (claudius_packs::set_disabled), before the session starts, so nothing resolves to a sampled instrument. The session answers from the first moment; verdicts made before the ears are ready have none.

HTTP

http::router(app, options) builds the axum router:

request ─▶ CORS ─▶ security headers ─▶ guard ─▶ routes: /api/..., /mcp, the web studio or the no-UI page
  • CORS is the outermost layer, so preflight requests are answered before the guard asks for a token. Allowed origins are http://localhost, http://127.0.0.1 and http://[::1] on any port.
  • Security headers go on every response, including the guard’s refusals: X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer, X-Frame-Options: DENY, Content-Security-Policy: frame-ancestors 'none'.
  • The guard refuses a Host that is not a loopback name unless the server is --public, then, with a token, accepts a matching Authorization: Bearer, claudius_token cookie or ?token= (which also sets the cookie, with Secure when X-Forwarded-Proto says https), comparing in constant time.
  • Commands must be application/json and at most 1 MiB, and run on spawn_blocking, since an edit can take seconds.
  • Audio and stems are served with tower-http’s ServeFile, which handles Range; an MP3 is encoded (claudius-encode) on the first request and kept.
  • The web studio is served from its dist folder with index.html as the fallback for any other path; without one, a short page says how to build it.

serve binds the listener, records the address it got as the session’s base URL, which the MCP tools put in front of audio links, and only then calls back with the address, so claudius serve never prints an address it did not get. spawn does the same on a thread with its own multi-threaded runtime, because claudius studio must give the main thread to the window. Both turn a taken port into port <port> is taken, by another claudius or another program (--port picks another). The server takes its token from Options; for claudius serve --public without --token, the CLI makes one first (new_token: 16 bytes from getrandom, in hex) and prints it with the address.

HTTP API documents the routes and types for clients.

The phone’s page

POST /api/phone starts a second listener (phone.rs) for playing from a phone: on every interface, on port 7879 or any free one, with a key of 16 random bytes. Its address names the computer as the network sees it, found by connecting a UDP socket towards a TEST-NET address, which picks the way out and sends nothing. It answers only the page (index.html, phone.js and phone.css, compiled into the binary) and its routes, all behind the key:

routewhat it gives the page
GET /api/song?after=Vwhat the page shows and plays of the song: its sections (with the tracks that play in each), drum lanes, tracks, the records the turntable can cut (claudius_api::records), and the sounds the keys can play; with after, once the song’s version is past V
GET /api/clockthe server’s time in milliseconds and the studio’s transport (POST /api/transport), for the page to keep its clock (the offset of the quickest of its last twelve round trips) and place what is played in the song
GET /api/hits/{lane}a drum lane’s hit (claudius::pads::hits: every lane struck in turn and rendered through the song’s mix and master, once for each version of the song)
GET /api/keys?sound=&low=&high=&step=notes of a sound, a slot of 1.5 seconds each, in one WAV (pads::notes)
GET /api/record?track=&bar=&bars=the record a scratch moves (scratch::record): one track, or the whole mix for track=*; a sample from the library for track=lib:... (scratch::sample_record), its first bars bars
GET /api/librarythe samples of the library the turntable can put on, for the song as it is (scratch::samples): each {track, label, kind, bpm, bars, speed}, track the lib:... a record and a scratch of it go by, and speed what plays it in time with the song (scratch::matched_speed); none without a library
POST /api/takea take, as add_hits, add_notes or add_scratch; any other command gets 403
POST /api/play{"playing": true, "at": 12.5} (at optional) or {"playing": false}: the phone asks the studio to play the song (from at seconds) or to stop it; the ask goes into the state’s phone.play with an id of its own, and the studio does it once (PlayAsk)

The page plays what it is sent itself and stamps what is played with its own clock moved onto the server’s, plus the delay of the phone’s output, so a take does not depend on how late the Wi-Fi carries it. The listener holds the session weakly, and stops when the session lets go of its stop signal, as DELETE /api/phone has it do. The session counts the phones that asked for the time in the last ten seconds, and the state’s phone says how many.

MCP

mcp::Studio is an rmcp server handler whose tools are methods marked #[tool]; their parameter structs derive JsonSchema, so the schemas clients see come from the same types, including each field’s doc comment. The handler’s instructions tell the assistant the typical session (look, edit with scripts, listen, undo what got worse, save) and that a person is listening.

The tools run on a Backend:

  • Local: the App in this process. Commands run on spawn_blocking; state and waiting call the App directly.
  • Remote: a claudius in another process, reached through its HTTP API with ureq: POST /api/command (600 s timeout, for jobs that start slowly), GET /api/state, GET /api/state?settled=1&timeout=N, GET /api/state?since=V&timeout=N (for wait_for_take, which sleeps until the state changes), /api/script and /api/sounds, with the token as a bearer header.

mcp::probe(base, token) asks /api/hello with an 800 ms timeout and returns a Probe: Claudius for a success whose body names "claudius", NeedsToken for a 401 whose body is claudius’ token refusal, Nothing for anything else. claudius mcp picks Remote on Claudius, fails on NeedsToken (the claudius at <url> asks for a token: pass --token or set CLAUDIUS_TOKEN (a wrong one is refused too)), and on Nothing fails when --url was given or runs Local with a web server of its own. claudius studio uses the same probe to open the window on a running claudius or to explain that it cannot send a token, and claudius doctor reports anything but Nothing as a claudius running on the port. The HTTP endpoint at /mcp always uses Local on its server’s App.

Two helpers shape every tool:

  • edit(command, listen) sends the command; on success, with listen, it asks for a render (a no-op when the render is current) and waits up to 240 s for the session to settle, then returns the reply and describe(state): the song summary, the verdict and the audio link.
  • job(command, timeout) remembers the log, sends the command, waits for the session to settle (240 to 300 s), and returns the log lines written since, the candidate scores of a mutation or evolution, followed by the description, or a note that the job is still running.

request_pitch_check and wait_for_pitch_check work the same way, with the session’s pitch_check; the answers arrive at POST /api/pitch-check, and the voice heard in them is the session’s from then on (kept in the file Settings.voice names, which claudius studio and serve set to voice.json in the settings folder), which a tune without a voice of its own sings as.

request_take and wait_for_take are the exception: the person records the take, which can take minutes. The first sets the session’s take_request and answers at once; the second waits on the state’s version, a change at a time, until the request is taken or cancelled, or for seconds, then says the person is still at it. A take sent with request=<id> (or notes with request) marks the request taken only when claudius keeps it (App::answer).

The transports: serve_stdio(backend) for claudius mcp, where stdout carries the protocol and everything else goes to stderr; and http_service(app, public), rmcp’s Streamable HTTP service with a local session manager, nested at /mcp. rmcp’s own allowed-hosts check is turned off for --public servers, since the outer guard has already decided.

Views

claudius-session’s views.rs turns the engine’s documents into the wire types. Most of it is direct, with two places that encode decisions:

  • A part’s presets (what the studio offers to switch to) are the genre’s entries, every alternative of an a|b entry that exists here, then the synth presets suited to the role, then the part’s own instrument and every installed instrument that can play it, as the generator’s palette judges (palette::suits: its register in range, an articulation for the role, a pack free to publish with), by its full name (vsco2:flute).
  • summary and verdict_text write the song and the verdict as the plain text the MCP tools return. They are the assistant’s eyes, so they list every section with its flags and layers, every track with its sound, mix and measured loudness, and up to eight issues with their targets.

The wire contract

claudius-api holds every type that crosses HTTP: State, SongView, RenderView, VerdictView, Command, Reply and the rest. It depends only on serde, so the web studio compiles it to WebAssembly. New fields get #[serde(default)], so an older studio still reads a newer server’s state and the other way round, and Command is a tagged enum ({"cmd": "set_tempo", ...}), so a client sending an unknown command gets a clear 400 instead of a silent no-op.

tests/session.rs runs a session through new songs, renders, scripts, solo, undo and redo, the file policy (with probes for files outside it), the HTTP guards, MCP over HTTP, and a save made during a render; it also pins claudius_api::{ACCENT, GHOST}, the studio’s accent and ghost marks, to the engine’s step-string thresholds claudius::script::{STEP_ACCENT, STEP_GHOST}. See Testing.

The studio UI

crates/claudius-ui is the studio: one egui application that runs as a native window (claudius studio, or the standalone claudius-ui program) and as a WebAssembly app in the browser, served by claudius serve at /. It is a client of the HTTP API and nothing else: it depends on claudius-api for the wire types, never on the engine. 0008 egui for native and web records why. The studio shows it from the user’s side.

The studio is still being finished; this page describes its structure, which is settled.

filewhat it does
lib.rs, main.rsrun_native, start_web, the claudius-ui program’s arguments; on a Mac the window’s content runs up under a title bar with nothing drawn or written in it (with_fullsize_content_view), so the top bar is the title bar: it leaves the window’s buttons their room (transport::window_buttons, AppKit’s 9 to 69 points, none in full screen), and its background moves the window and zooms it on a double-click, as the system’s setting for a title bar says (app::title_bar), as AppKit sends the clicks there to the studio
app.rsStudio, the eframe::App: state, layout, shortcuts, applying server state
net.rsthe connection: long polling, commands, the backend (a server or the mock)
edits.rsedits applied to a SongView, for optimistic updates
cmds.rsbuilders for commands that change a few fields
panels/one module per panel
audio/the player: rodio natively, Web Audio on the web; the take recorder: cpal and midir natively, Web Audio in the browser
mock/the built-in demo: the claudius engine in a Web Worker (in the app, on a thread of its own) (below)
music.rsthe theory needed to label things: keys, numerals as chord names, note names
claudius_api::wordsnot a file of the studio’s, but where its words come from: the names a script writes as a person reads them (sub_bass “sub bass”, tr909:bd “kick (TR-909)”), pan (“30% left”), the verdict’s measures with their units, effects and their settings, the drums’ patterns. What each preset, drum voice and style is comes from the engine, in SoundList’s about and styles; the studio shows the words beside the values and in tooltips, and a name a script writes under them
theme.rs, widgets.rsthe two looks, dark and light (DARK, LIGHT), and the person’s choice of them or the system’s (Look), which egui follows; each colour a Swatch named for what it is for (TEXT, PANEL, ACCENT, STRONG), the look’s own wherever it is drawn (theme::follow takes the look egui draws with at the start of every frame); one colour per role and section kind, which the light look draws at a clean middle shade of its hue (shade), so that a clip filled with it on white is a tint and not a grey, and writes as text darker still, until it reads (legible); what the arrangement draws on (CANVAS, white paper on the light look), what sits sunk in a panel (WELL: a fader’s track, a meter, the roll) and a field one types in (white on the light look) kept apart, as a light look needs them; tests that hold text to 4.5:1 or more on every panel of both looks, the light look’s coloured text and the LCD’s lines too, and keep each colour’s hue on the light look; the fonts (Inter for text, Lucide’s icons, in assets/fonts, cut down to what the studio shows), the icons, knobs, faders, meters, chips
mark.rsthe logo’s C, drawn at the size the header shows it, from the numbers cargo xtask icons draws the icons with
pick.rschoosing a file on the studio’s computer and reading it into memory
devplan.rsscripted runs of the studio, for checking the UI without a person: natively, and in a browser in a build with the plan feature
native.rsNative, what the native window may do on its computer beyond the server (connect assistants)
desktop.rsthe native window as the system’s apps are there: its title (the song’s), the media keys and Now Playing through souvlaki (play, pause, stop, next and previous by section, seek; the song’s title, genre and length, and its position again whenever it moves other than by playing on), and a notification (notify-rust) with the Dock or the taskbar asking for attention when a job of desktop::LONG (20 s) or more ends after another window came in front (desktop::step: a job’s steps are the job, a job after it one of its own), or an assistant asks for a take while another window is in front. It runs from Studio::logic, which eframe calls while the window is hidden too (and ui not), on a clock of its own, as the input’s time stands still then
tour.rsthe first-run tour: its cards, the parts of the studio they point at, and when it is done

The design system

The studio is built of a few parts, drawn as the agreed mockups draw them (the redesign began with Add a recording), so that each window looks and works like the others. The colours are theme‘s swatches, each named for what it is for (TEXT, PANEL, WELL, ACCENT); the parts are widgets’:

PartWhat it is forwidgets::
a dialoga window shown over the studio, which nothing behind it takes a click while it is open (New song, Publish): framed as a window isdialog
a dialog’s headthe top of a dialog as a window’s title bar draws it: a band with the title in the middle and a close button at its righthead
the primary buttonwhat a window is for (Create song, Open it, Play it as …): one a window, filled with the accentprimary
a window’s footunder what a window holds: a rule, then its buttons from the right, the primary first, then Cancel, then a word on what it doesfoot
a segmented controla choice of one of a few that changes what a window shows (New song’s From a genre, From a recording, From the microphone, From an example)segmented
a small segmented controlthe same at a control’s height, for a choice of one of a few in a row of the inspector or a tab’s bar (a section’s length, its drum pattern, the drums’ variant)segmented_small
an option carda choice of one way of several, each with its icon and what it does in a sentence (Add a recording’s ways to add one)option_card
chipsa choice of one or several of many short things (the tracks in a section, how often a phrase comes round)chip
a pilla short fact, not to click (a song’s genre, a tempo)pill
icon and tool buttonsthe transport and the toolbaricon_button, tool_button
a fielda label in the inspector’s column of labels, then what sets itfield

Text is 13.5 points (13 on a button, 11.5 small, 16 a heading); a control is 24 points high and a primary button 30; corners are 6 points on a control, 7 to 9 on a segment or a card, and 12 on a window. The keyboard reaches every part, and the part it is on shows a ring (focus_ring).

Layout

┌───────────────────────────────────────────────────────────────────────────────┐
│ transport: play, position, tempo / key / swing, score                          │
│ toolbar: new song, open, save · variations ▾ · improve ▾ · sounds ▾ · export ▾ │
│          undo / redo · status: the job, its progress and cancel, or up to date │
├───────────────────────────────────────────────────────┬───────────────────────┤
│ views: arrangement | signal flow | script (`Main`)     │ inspector: the        │
│ arrangement: section blocks, one row per layer with    │ selected section      │
│ a cell per section, the waveform and playhead          │                       │
├───────────────────────────────────────────────────────┤                       │
│ dock (with the arrangement): drums · instruments ·    │ verdict: scores,       │
│       notes · chords · mixer · sounds · and at the     │ issues, ears, bands    │
│       right: log                                      │                        │
├───────────────────────────────────────────────────────┴───────────────────────┤
│ status: connection, server, audio errors, volume, shortcuts                    │
└───────────────────────────────────────────────────────────────────────────────┘
panelwhat it editscommands it sends
arrangementsection order; a cell selected (its track, View::track, and its section, which the right panel’s track and section inspectors show); which layers play in which section (a cell’s double-click or Enter, or with the paint tool, View::paint, a click or a drag across a row); seeking; + Add a track, which opens the Add a track window (add_track_dialog, a card for each AddKind): a track in a style, a part of a role or a drum lane, named, its sound from SoundList (the role’s synths first by synth_roles, the instruments, or a lane’s drum voices and kit), or a recording, which opens the window it goes in by (a file chosen or a library search into Add a recording, Import::search_for; the Record window); a row’s menu: mute, solo, on or off everywhere, removing the track, and a take’s: how it is sung (shown in a window until closed), tuning it, its melody as notesmove_section, toggle_layer, add_track, remove_track, assess_voice, tune, transcribe_take
inspectorthe selected section’s name, length, intensity (its energy), chords, drum pattern (its variant), transitions (its flags) and the tracks playing in it; adding, duplicating, removingset_section, toggle_layer, add_section, remove_section, move_section
step sequencer (the Drums tab)one row per drum lane, one cell per sixteenth, one variant at a time; click toggles (velocity 0.8), drag paints, shift sets velocity, right-click offers presets; an accent dot and the “(accent)” and “(ghost)” labels follow claudius_api::{ACCENT, GHOST}, the thresholds of the engine’s step stringsset_drum_step, set_drum_pattern
recorda take recorded over the song from a count-in, played back, kept; latency measured; a take an assistant asks for; a pitch check: its phrases synthesised from State.pitch_check and played as the song a take records over, the answers sent to /api/pitch-check when the phrases endadd_notes, cancel_take_request, request_pitch_check, cancel_pitch_check
mixera strip per track, whole in the dock at its usual height: pan and the reverb and delay sends over the fader, duck and drive beside it, its level, mute and solo under it, its loudness from the latest render on its meter; the fader takes the height the dock has left and names the marks of its scale it has room for; the master’s strip stays at the right as the tracks’ strips scrollset_mix
parts (Instruments)style, sound, register (drag on a keyboard), density, reseedset_part
piano roll (Notes)a part’s cycle over a progression from PartView::cycles, on a grid of beats and pitches: click adds a note at the grid (1/16 to 1/2), a drag moves a note or, by its right edge, makes it longer, right-click takes it out; a drag edits a draft sent when let go, and a cycle the theory engine writes is written out by the first edit. The demo writes its cycles with the same code it plays them with (mock::synth::write_cycles) and plays a cycle written outset_notes
harmony (Chords)which progression each section plays; progressions as chord chips, from the key’s diatonic chords or as textset_section, set_progression
scriptone of the song’s three views (Main::Script), beside the inspector and the verdict: the song as a script, highlighted, Run with Cmd or Ctrl+Enter, errors marking their line, sounds to insert, the referencerun_script
soundsthe packs and every sound name; click one to put it on a partset_part
graph (Signal flow)the song’s lanes (panels::lanes, design 0025): each track, bus, return and the master a row the sound runs through, its source, its effects as blocks drawn as what they do (response_db, transfer_db, shaped give the curves), its strip and sends and where it goes, the strips lined up as a mixer’s (columns), zoomed around the pointer and panned (zoomed, fitted, clamped), a block moved, added, taken out or switched off where it is (moved, switched), the keyboard choosing blocks while the lanes have it; one of the song’s three views (Main::Flow, View::main, from the switcher panels::views), in the main area with the window to itself but for the toolbars; the inspector beside it edits the node chosen: a track’s mix, bus, sections and sound, an effect’s settings (each JSON field by its type, the rest as JSON text), a chain’s effects added from EFFECT_TEMPLATES, moved or taken out, the master’s loudnessset_mix, toggle_layer, set_part, set_fx, run_script (the master’s loudness)
verdictread only: the total, a bar per score, issues with their targets, the ears, the tonal balance
logread only: State.log, filterable

The keys of the studio’s actions are the catalogue’s (catalogue::ENTRIES’ keys: Space, Shift+Space, Home, L, N, Shift+N, R, Shift+R, I, T, P, C, B, G, 1 to 9 for the tabs, Cmd+O, Cmd+S, Cmd+Enter, Cmd+Z, Shift+Cmd+Z, Shift+V, Shift+E, Shift+F, Shift+Cmd+E, ?), which panels/keys.rs answers by doing what the palette does for the entry (palette::act), so a key, the palette and its button never do different things; a test holds every key to one egui reads, and no two entries to the same. keys::dialog lists them with the keys that move about (MOVING). The keys that move about are app.rs’s: the arrows (a section, a track), Enter and Delete (a cell), and Escape, which lets go of the control that has the keyboard, then closes the window on top (View::close_top: the one opened last, as View::note_opened keeps them in the order they opened, once a frame), then lets go of the track. None of them is taken while a field is typed in, and Space, Enter and the arrows are left to a control that has the keyboard (egui presses a focused control on Space or Enter, and the knob and the fader move on the arrows). The painted controls say what they are to AccessKit (widgets::accessible: a button, a toggle, a slider with its value) and draw a ring while they have the keyboard, as round as they are; whatever else has it, egui’s own controls and every area that takes a click, gets the same ring from widgets::focus_ring, which the app draws once a frame after the rest, on the control’s own layer and cut to what of it shows. eframe’s accesskit gives them to the system’s screen reader, and its web_screen_reader has a page speak what has the keyboard when Speak what has the keyboard is on (View::speak, kept in the settings). Cmd or Ctrl+K, or Cmd+P, opens the command palette (panels/palette.rs) from anywhere, a field being typed in too. Its actions are claudius-intent’s catalogue (catalogue::ENTRIES: each action’s id, its name, the words it is also found by, where it lives and its key), and the palette maps each id to what it does (run_of); a test holds it to every entry and every dock tab, so an action or a tab added without the other fails. As the words change, the palette asks which actions they find (Backend::find), and until the answer for those words comes, shows what they find by name (Finder::find without a model). The answer ranks by name and by meaning, with the embedding model once it is there (0011). A server answers it (GET /api/find, Host::find), its session holding the model (claudius_session::meaning, which downloads it the first time it is asked). The demo answers on the studio’s own thread (mock::meaning), since a search takes microseconds and its engine may be rendering for seconds: in the app with the session’s model, in a page with the site’s copy (studio/models/, which cargo xtask site --sounds makes), which the page fetches the first time. Words found by name before the model came are answered again once it has: the demo answers them again itself, and the palette asks a server again, a second apart, for up to a minute after they were typed. The answer also holds the changes made to the song that the words find (Answer::done, claudius_intent::find_among over the state’s history, the edits go_back can reach). They are found by name and by meaning like the actions, once the words that only ask to go back are taken out, and the palette lists them after the actions as Go back to before rows, which send go_back. The search fields of genres (New song’s cards, Change the genre, a track written in a style) and of sounds (a track’s sound, the script’s sounds) find by their words themselves at once, and ask the engine what it finds by meaning too (View::search, GET /api/search, claudius_intent::search), whose answer adds the names near what the words mean under near what you mean. The answer holds what the words ask of the song, too (Answer::proposed, claudius_intent::ask::propose on the state the engine has, built for both by claudius_intent::answer, which first reads a word typed with a slip as the word meant, claudius_intent::typos, never an English word, by SCOWL’s list of them, and says so in Answer::read_as): each reading a proposal with what it says it does (“Increase guitar’s drive from 20% to 95%”), what it does to each track, and its commands (0013). A question about the song (“what’s the bass volume”, claudius_intent::asking) is answered from the state instead (Answer::told, claudius_intent::tell), and the palette shows the answers first, as rows that send nothing; it proposes no change unless it says something is too much or too little (“is the bass too loud”). Where the readings propose nothing for two words or more, and they ask no question, the request model reads them (claudius_session::meaning::ask_model, 0014): a thread of its own downloads it the first time, reads the latest words it was asked about, and keeps what it read. Until it has read them, the answer says it is reading, and the palette shows Reading your words… and asks again (Palette::ask_again, every 0.3 s for up to 20 s). What it read is proposed as a request is, each proposal marked by_model. The demo asks it in the app, and has none in a page. The palette lists the proposals first, under What your words ask, and a history row a reading already goes back to before is left out. Its microphone (Palette::listen_or_stop, Palette::listening) records the default input (audio::record::Hearing: cpal in the app, the recorder’s worklet in a page) until a pause of 1.2 s after speech, a level above 0.02, or for 15 s at most, and sends the WAV file of it to be heard (Backend::hear: POST /api/hear to a server, claudius_session::hearing on a thread of its own in the app’s demo; a page’s demo has no microphone, Backend::can_hear). The words come back as Event::Heard, put right where claudius knows better, and are typed in as if they were typed (Palette::said) (0015). Until the input opens, the palette says Opening the microphone… rather than Listening…, since what is said before it hears is lost, and its 15 s begin when it opens. site/tests/palette.spec.mjs says a clip to it in Chromium through the plan’s palette and palette:say steps, and reads what it shows (palette: ...). A proposal’s row is known by what it says (do: and its words), and does its commands only while the answer is for the words typed (Palette::run). Edits go as one together, which the history records as one change named for what the row said, and which the studio shows at once, each edit as it shows it alone (edits::apply). Undo, redo and going back go as they are, each its own step (commands_of), as many as the state says there are (undo_steps, redo_steps). Enter does the action highlighted as the palette was last drawn, and an action picked with the arrows stays picked as an answer by meaning ranks the list anew.

The menus are built of widgets::menu_title (what the menu acts on, and what that is, faint), menu_group (the name of a group of items, in small faint capitals) and menu_item (an item with the key that does it too, faint on the right), so that a long menu reads as a few short ones.

State, commands and optimism

Studio keeps three copies of the server’s state:

  • state, what is on screen;
  • server, the last state the server sent, without local edits, to fall back on when an edit is refused;
  • pending, the newest state from the server, held back while something might be overwritten by it.

Every frame, the panels draw from state and push Commands into out. flush sends them, and for the edits it can predict (tempo, key, swing, progressions, sections, layers, drum steps and patterns, parts, mix) it first applies them to state itself with edits::apply, the same logic the mock uses, so a click in the sequencer shows at once instead of after a round trip and a render. When the reply comes back refused, the song falls back to server.

A new state from the long poll goes into pending and is applied only when it is safe: not while the user drags something (a fader, a section, a painted row of steps), and not while an edit is in flight or the state is older than a reply already received (Reply.version), for up to 3 s. Without this, a long poll answering between a click and its reply would flash the old value back.

The script editor follows the same idea: while its text has unsaved edits, new states do not replace it; it follows the song’s script again once a run succeeds.

The connection

net::Remote runs one long poll at a time: GET /api/state first, then ?since=<last version>, with a 45 s client timeout against the server’s 20 s. Each answer schedules the next. On failure it backs off 1, 2, 3, then 5 s, shows Cannot reach claudius at ... with how to start one (claudius serve, or cargo run --release -p claudius-cli -- serve in a checkout), Retry and Use the demo, and forgets its version and sound list, since a restarted server starts counting again. After the first state it asks once for /api/sounds and /api/hello (and for /api/hello again when a state says the ears have finished loading), and for /api/reference when the reference window opens.

ehttp runs requests on threads natively and with fetch in the browser, delivering results through a channel and asking egui to repaint. Natively the server’s address comes from the argument, CLAUDIUS_SERVER or http://127.0.0.1:7878; on the web it is the page’s own origin, or ?server= in the URL, or the mock with ?mock.

The native window has no way to send a token. claudius studio runs its own server without one; to use a token-protected claudius, open it in a browser with ?token=, which sets the cookie every later request carries.

What the window does on its own computer goes through Native, which claudius studio passes to run_native (connect::FromTheStudio in claudius-cli): reading the assistants’ configurations and connecting one, on a thread of its own so that a slow claude mcp add does not stop the window, keeping the answer about usage statistics that the tour’s last card asks for (privacy), and the updater (update.rs), whose state the studio reads each frame and repaints for while it downloads (updates). None of it goes over HTTP, so neither a page in a browser nor anything else that reaches the server can change those configurations; the web studio, which has no Native, lists the claudius connect commands instead.

Playback

When a new render arrives (render.version changed), the player loads it:

  • Native (audio/native.rs): fetches the 24-bit WAV (/api/audio/<version>.wav), decodes it with hound, and plays it through a rodio source that reads shared atomics for play, seek, loop region, position and volume, so the UI thread never blocks the audio thread. Play and pause ramp the gain over about 5 ms so they never click. The output device is opened once, when the window starts; if that fails the status bar shows audio: no audio output: ....
  • Web (audio/web.rs): Web Audio. The render is decoded once into an AudioBuffer and played by a buffer source through a gain; the playhead is where the source started plus the audio clock’s time since, through the loop. A seek starts a source again, fading in over the one before; so does a window of the live mix, written into the buffer with a 5 ms fade at each end.

A new render of the same song keeps the playback position (and the loop region, which the studio sets separately), so you can listen to a section while you edit it and hear each change land in place.

Recording

The Record window (panels/record.rs) records a take, holds it while the person plays it back (take::preview, the song with the take in it, through a player of the window’s own) or records it again, and sends the one they keep to POST /api/takes, in the app and in a browser alike. In the demo it goes to the engine (claudius_api::Listen::Take with the WAV), recorded over the render the player holds, and is kept in memory like the recordings below.

Add a recording (panels/import.rs, the + after the record button) holds a recording of the person’s own, chosen (pick::Want::Recording) or dropped anywhere on the studio (pick::read_dropped, unless Publish is open and waiting for artwork), and sends it as a take, to POST /api/takes like the Record window’s (the demo’s engine sniffs its kind from its bytes), or hands it to the auto-sampler (Listen with sample, its sections and every). As soon as it holds one it sends it to be heard (Import::next_to_hear, /api/analyze or the demo’s Listen::Analyze with recording), one at a time: what was heard comes back to the window that asked (Import::wants, by the file’s name) rather than opening the window of what claudius hears. The answer after it is the window’s by its name, hear_recording, which the app gives the answer to the window’s own request and the demo’s engine answers as (Listen::what), so another analysis that ends first is never taken for it (Import::hearing_answered). Each recording held is counted, so that what comes of one held before stays in the window unshown, and one chosen while another is heard goes once that one is answered. The window draws its sections over its waveform with its phrases marked, each played from the recording claudius kept (/api/listened/) or, in the demo, the file itself; the Sample window keeps what was heard in the recording it offers pieces of, for its timeline. The ways are cards, and where and how often are chips. Its search of the free libraries (Backend::search_library: /api/library/search, or in the demo claudius’ site, as the demo’s sampler asks it) lists LibraryHits, each heard in a player of the window’s own (Import::hear: a browser plays its URL; the app fetches it and decodes it as claudius does before it plays, so nothing heard before plays meanwhile, and the window says why one could not play). One chosen is fetched, to be heard as a file chosen is; with a claudius it is added by its id (add_take or sample_song with library:<id>, which claudius downloads and credits), and the demo hands the engine its record (found) with its audio, which credits it. Choose its phrases → asks for the auto-sampler’s pieces instead (sample_pieces by id, or /api/sample/pieces with the file, kinds phrase; Choose its pieces →, of the Pieces of it card, every kind) and opens the Sample window (import::pieces), which shows the state’s pieces once the answer to that request has come (the offer claudius held before is the last recording’s): each heard as it was cut and treated from /api/pieces/, ticked, drawn again (redraw_pieces) and put in the song (keep_pieces). In the demo the engine offers them (claudius_api::Listen::SamplePieces with the file), each piece in the state as a small MP3 in its URL (listen::mp3_url), which the app decodes, and a browser plays as a blob: URL: the site’s policy plays media from those only (media-src 'self' blob:). A take’s Trim…, in its track’s menu in the arrangement, opens a window of the same file that sends trim_take with the track’s seconds for its range.

A take an assistant asks for (request_take) is the state’s take_request. A new one that waits opens the window set up for it (Record::asked), and the take kept for it, or the notes played, carry its id (request in the take’s query, in add_notes), so that claudius marks it taken with its answer, which wait_for_take returns to the assistant. Not now sends cancel_take_request. A web studio opened at ?record=<id>, the link the assistant gives, opens on the Record window.

What a take is lives in audio/take.rs, for both:

  • What it is. What to record and what plays meanwhile (Plan), and the take (Take).
  • What plays and what is kept. What the output plays (fill), and the take cut where it starts (cut), as a float WAV (wav).
  • What went wrong. How often the input fell silent in it (hushed).

audio/record.rs records in the app; web_record.rs takes its name in the browser, with the same API.

audio/record.rs opens two cpal streams of its own. The player is paused meanwhile.

  • The output plays the latest render from the count-in on, resampled to the device’s rate, with a click on every beat of the count-in, and of the take too when asked (fill, a plain function the tests read).
  • The input sends the chosen channels to the window in chunks, and its loudest sample to the meter.

While the window is open and nothing records, a Listener keeps the input open for the meter alone, and closes it when a take starts, since some systems give a device to one stream at a time.

Each stream’s timestamps give its own latency: playback minus callback says when what the output plays is heard, callback minus capture when what the input hears was captured. A host’s streams need not share a clock’s origin, so the two are related through the system clock read in each callback. Of those estimates the earliest wins (a callback runs late, never early), after the first four, while the streams settle. The take is cut from where the section’s downbeat was heard, plus the window’s Latency for what the devices do not report (cut). It goes as a 32-bit float WAV at the input’s rate.

What the devices do not report can be large. On macOS cpal counts a device’s buffer, latency and safety offset, but not its streams’ latency (kAudioStreamPropertyLatency), where the built-in speakers and microphone report their processing: on a MacBook Pro, 14.5 ms and 50 ms. A take recorded through them landed 44 ms late; the reported figures would have made it 20 ms early. Since only a measurement gets it right, Measure measures:

  • The clicks. Plan::measure plays eight clicks (audio/latency.rs, a few cycles at 3 kHz) unevenly apart, with no count-in and no offset, and Recorder::lateness cuts what the input heard exactly as a take is cut.
  • Finding them. lateness high-passes the recording at 1 kHz. The lag from -100 to +600 ms where at least five clicks line up with something loud, scored by the quietest of the five, gives where to look; the first arrival near each click (the sound straight from the speaker, not a louder echo) gives its lateness.
  • Being sure. At least five clicks must stand four times above the room’s noise and land within 1.5 ms of their middle, and the answer is the middle one’s. Otherwise the window says why.
  • The result. The window sets Latency to what it found, and says through which output and input. A MIDI take has a Latency of its own: a loop through the microphone also counts the input’s latency, which a key pressed does not have.

The tests play the clicks through a simulated speaker and room: band limiting, echoes louder than the direct sound, a reverberant tail, noise, hum, clipping, lost clicks and a bang. Through a MacBook Pro’s speakers and microphone it found 45 ms twice, and a take recorded then landed within half a millisecond of the song.

A stream’s dropped buffer (Xrun), or a route that changed under it, does not end a take: the window says how often the take dropped audio. Any other stream error ends it.

A MIDI input (midir) records in place of an audio input:

  • Timing. Each note on and off is stamped with the system clock as it arrives, so it lines up with the song by the same estimate of when the output’s first frame was heard.
  • The guide tone. The messages also go to the output stream, where a small guide (Guide, a sine and a little of its octave, up to sixteen voices) plays them for a keyboard that has no sound of its own.
  • The notes. At the end, pair matches each note on to its off. A note on a pitch already sounding ends the one before, and a note still held at the stop ends there.
  • Sending them. The window puts the notes on the chosen grid in beats and sends them as add_notes, which makes a part of them.

A take that fell silent to the bit for 50 ms or more between sounds (hushed) says so with claudius’ answer. A microphone or a line in always hears some noise, so that is the input muted or gated, as the processing a system does to a microphone for calls does. Frames a browser lost, which Captured fills with silence, are dropouts, not that. A measurement that fails on such an input says the same.

In the browser

audio/web_record.rs records with Web Audio, on one clock:

  • The song. It is the render’s WAV, which the window fetches for the take (record::song). render_mix fills it in a buffer at the audio context’s rate, with the count-in and its click, as fill does natively. An AudioBufferSourceNode starts it at a set time on the context’s clock, a quarter of a second after the input listens.
  • The input. getUserMedia asks for the chosen input with the browser’s echo cancelling, noise suppression and gain control off. It goes to an AudioWorklet (record-worklet.js, which trunk copies beside the page). The worklet hands the page about 43 ms at a time, each chunk stamped with the context frame its first sample reached the worklet in. Captured puts the chunks together, with silence for frames that went missing, each a dropout. Told to stop, the worklet hands over what it still holds and says it is done; the window waits for that, three seconds at most (a busy page takes a frame or two), before it cuts the take, which then says the browser held back its last moment.
  • Where the take starts. It is arithmetic (take_starts): when its downbeat was to play, plus what the browser reports of the output’s latency (baseLatency, outputLatency) and the input’s (the track’s latency), plus the window’s Latency.
  • A MIDI keyboard. Web MIDI (requestMIDIAccess) gives the keyboards once the page may use them. Where the browser says it was allowed before (permissions.query), the window lists them without asking; otherwise it offers to ask. A message is stamped where it arrived (timeStamp, on the page’s clock), however late the page handles it; Chromium stamps a real keyboard’s 0, so then key_time takes when the page heard it. heard_at_stamp puts it where the song was heard then, from the output’s reading (getOutputTimestamp: the context time the output was playing, and when). pair makes the notes, as natively. The guide tone is an oscillator a key (Voices: a key pressed again starts over, sixteen at most). A CoreMIDI keyboard playing every half second, recorded in Chromium on a MacBook Pro, came out a beat apart to within 12 ms.

Browsers report little of their latency. Chromium on a MacBook Pro reported 8.5 ms (5.8 ms of baseLatency, an outputLatency of 0, and 2.7 ms on the input), and takes landed 60 ms late. Measure works as natively, through Recorder::lateness.

On that Mac, Chromium’s capture of the built-in microphone was processed even with all of its own processing off. A tone from the speakers, whether the page played it or another app did, came in 30 dB down, with runs of silence up to two thirds of a second. The app’s capture of the same microphone had none. A take there has holes, and Measure cannot hear its clicks. What did it was not pinned down; macOS’s per-app Mic Mode on Voice Isolation does the same, so the window says the input went silent and points there (hushed).

The unit tests run the browser’s path natively, in 128-frame quanta: a song scheduled on the context’s clock, heard, recorded with a quantum lost, and cut on its downbeat to the frame; a measurement through it that finds an unreported 0.18 s; and keys pressed in time with what is heard, which come out on the beat. site/tests/record.spec.mjs records in Chromium with a file for a microphone, against a claudius of its own. It drives a studio built with the plan feature (cargo xtask web --plan), which runs the scripted plan in its page’s ?plan= and prints what the Record window says to the console. The tests check that:

  • a take kept arrives, plays in the song and holds the microphone’s tone;
  • a take an assistant asks for opens the window, plays back, and goes to the assistant; or is turned down;
  • Measure with an input that cannot hear the clicks says so;
  • a keyboard the test plays itself (a Web MIDI of its own, before the page’s scripts) makes a part, a note a beat;
  • a browser without Web MIDI, a page blocked from it, and one blocked from the microphone say what to do.

Choosing files

Where the studio wants a file (a song to open, a recording to listen to or remake, a release’s cover), the person chooses one on the studio’s own computer, and the studio reads it into memory (pick.rs). Natively that is the system’s dialog (rfd); in a browser, a file input of the page’s own (hidden, data-claudius-pick naming what it is for), which waits in the page until a file is chosen. What was chosen arrives through pick::chosen, which the app reads each frame:

  • A song goes as its text in open_text, which opens a blueprint.json (by the file’s name) or runs a script; a file that is not text is no song, and a toast says so. An example song, chosen in the New song dialog’s From an example (Start::Example), goes the same way: its script, from claudius_api::examples, compiled into the studio.
  • A recording waits in the New song dialog, From a recording (or made From the microphone, by the same Hearing the command palette listens with, up to a minute, as from the microphone.wav), for what to do with it (WithRecording): its button sends it, the file itself (a flip with flip=true, a rebuild with rebuild=true), to POST /api/analyze or POST /api/remake, named so that its extension says its format. claudius decodes it in memory. What an analysis heard comes back as data beside the words (Analyzed::heard, which Event::Listened hands to the What claudius hears window, panels::hears); claudius keeps that recording, and the parts it took it apart into, in the session’s folder until it analyzes another, and the window’s second player plays them from /api/listened/{id}/{track}. The demo’s engine sends what it heard with its answer too, and the window plays the file chosen (Source::File).
  • A cover goes to POST /api/release/artwork, as a dropped one does.

So nothing the studio asks for is a path on the computer claudius runs on, and a studio on another computer works the same. Scripted runs open the dialogs (pick:<song|audio|cover>) and press the buttons (listen:<analyze|remake>, and the What claudius hears window’s hears:<play|pause>); site/tests/files.spec.mjs fills the page’s file input as a person choosing a file would.

The demo

mock/ is the built-in demo: the claudius engine itself, which makes, edits and renders the studio’s songs as the server does, kept in memory. In a page it runs in a Web Worker, claudius-engine (crates/claudius-web), which trunk builds beside the studio; in the app, on a thread of its own. Both run claudius_session::host::Host: a new song from the composer, the API’s edits (claudius_session::edit, the server’s own), undo and redo, and a render after every change, judged with the meters and the theory (the ears do not run in a browser). A render takes about an eighth of the time the song plays on the one thread a page has (a 4:48 house song in 36 s), so a new song first plays its first 16 bars, a few seconds after it is made, while the rest renders: its render’s url is PREVIEW_URL meanwhile, which the studio treats as older than the song. The studio sends where its playhead is, and whether it plays, with each command (Link::playhead). While it plays, a change to the mix is heard by windows, as from a server (Link::window, Host::live_window), and the render waits until the studio has stopped asking for them for 2.5 s (Host::waits), since it would hold them up for seconds. Otherwise an edit to a song heard whole is heard where the person listens: the engine hands over the last render with the twelve seconds from there rendered again with the edit (Host::window, render::render_window), within a second, at the loudness of the render before, while the whole song renders again; a song an edit made longer or shorter gets its first bars. The player swaps either in where it was playing.

The page and the worker trade messages of JSON and audio (mock/engine.rs): a command at a time goes out, and its reply and the state after it come back; a render comes with its master, handed over rather than copied. A message sent before the worker has loaded its WebAssembly would be lost, so the page holds its messages until the worker first speaks.

Where the browser has cores to spare, the engine makes a render’s tracks side by side, as the app does on threads (crates/claudius-web/src/crew.rs):

  • It starts up to three copies of itself (claudius-engine_loader.js?crew), as many as there are cores beyond the page’s and its own.
  • It shares out the tracks the render would make anew (Host::to_make), the costliest first to the copy with the least to make, with the audio they play. Each copy speaks first, as the engine does, before it is handed its share. A track that plays a sampled instrument (below) it makes itself: its files are the engine’s alone, and playing samples costs little next to a synth. What a track costs is measured, not guessed (render::track_cost): half a second of a note of its patch at the octave it plays around, and half a second of noise through its effects, each once.
  • The costliest track, when it is more than an even share of the work and a synth that plays its notes apart, is made in parts, one a copy (render::part_bounds, track_part), unless one part would still hold most of its work (as a chord held from one beat would, every part that it sounds in rendering it whole). Each copy renders the notes that sound in its stretch of the song and adds them up as a render does, so its part is the track there to the sample; the engine puts the parts together and runs the track’s effects (render::track_joined).
  • It keeps each track a copy posts back (render::track_sound, Host::made). The render that waited for them then only mixes, and comes out as it would have alone. A copy that has made its share stops, which gives back its memory.

A crew that fails leaves the engine to make the tracks itself, as it does on a phone, whose browser holds a page’s workers in the memory it gives the page, and when started as claudius-engine_loader.js?alone. With a crew of three, a four-minute deep-house song renders whole in about 19 s where the engine alone takes 29, synthwave in 20 where it takes 30, and trap in 12 where it takes 16, each the same to the sample.

What needs a computer of one’s own the demo turns down, and says so: takes, folders, files written, installing packs (it plays web editions of them). Mutation and evolution run in its engine as the server’s do, without the ears: a worker has no threads, so the engine judges one candidate a turn (evolve::Stepwise, Host::step), with the messages that came meanwhile between them, and the state’s busy says how many it has judged. A stop keeps the best judged so far; an edit meanwhile ends it. The download button hands over the render as a file its engine writes in its Web Worker, where the seconds a song takes to encode do not stop the page: FLAC at 16 bits, or the format the export menu asks for (State‘s exports, which lists for the demo what its engine can write). The menu’s Project file (.claudius) is the song itself (Host::project), a zip named .claudius (PROJECT_EXTENSION) so that a browser keeps it whole (Safari unpacks a .zip it downloads): its blueprint and script, and the files it plays, which only the engine’s memory holds, at the paths the blueprint names them by (samples/<role>/<whose>/<recording>/break.flac, takes/...), each cut with the recording it came from (Found) in the .json beside it, a scratch’s take with what its record was cut from (take::Sources) in the .sources.json beside it, and credits.txt. A cut is kept as 24-bit FLAC, and a drum hit, cut as floats, as a 32-bit WAV. The release the page keeps (Publish’s details, and the cover the page holds as the file itself, Mock::set_artwork) goes in once something is given for it, as a song folder keeps one (publish::project_files: release.json, naming artwork.jpg or artwork.png beside it). Opened in the demo again, the engine hands the release back with its answer (Host::take_opened_release, Heard::Release). What a cover is and Publish’s preview of it are made in the engine too (Heard::Artwork, claudius_session::release::artwork), since the page leaves the engine’s crates, and their JPEG decoder, to the worker. The app and the web studio ask claudius for the same file (Backend::project_file, GET /api/project, App::project_file): it packs the song from the files it plays on its computer (song::pack_song, under takes/ and samples/, each with what it was cut from beside it), leaves Apple loops and a pack’s files where they are (Packed::theirs, said in X-Claudius-Note), and the app’s save dialog keeps it (keep::deliver). On a Mac the file saved then shows as its name (claudius_macos::hide_extension) and by the cover it carries as its icon (publish::project_cover, claudius_macos::set_icon: NSWorkspace setIcon:forFile:options:). claudius opens the project (song::unpack_project, from load or POST /api/project, which the studio sends a chosen .claudius or .zip to, claudius_api::is_project) into a song folder of its own; a song’s paths that name no file of its own (find_moved) are read in its folder, so the samples play from there. A blueprint.json the app’s dialog chose beside the files it plays, as an unpacked project’s is, goes as a project too (Picked::as_project): the studio reads those files, which claudius on another computer could not. A recording chosen to listen to goes to the engine as the file itself (claudius_api::Listen with its bytes, the worker’s listen message), which does with it what the app does with one the studio sends (claudius_session::listen, shared with the server): Only say what claudius hears hears it, Remake it as reworks it, Flip it into flips it and Rebuild it on rebuilds it (without the ears, on its drum habits and its chords), Sample its vocals into the song samples them, and Put the song’s drums in its groove does that. Until the answer comes, the dialog shows what the server’s busy line says (State::busy, with progress): the server’s App::listening puts each step there (taking the recording apart with the stems’ progress, listening to it, sampling it, remaking it) while no job holds the line, and clears it after unless a job has taken it since, as the render a change starts does. The busy line offers to cancel only a job (State::cancellable), since a step of listening runs to its end. An answer that changed the song closes the dialog (View::listened), and the toast every answer gets shows its first line. A take recorded in the Record window goes the same way and joins the song, where assess_voice hears how it is sung, transcribe_drums turns it into the drum lanes, transcribe_take into a part’s notes, and tune tunes it. A pitch check is the engine’s as well: it makes the check (request_pitch_check) and hears the answers (claudius_api::Listen::PitchCheck), and the voice it hears tunes the takes after it (claudius_session::edit::tune, shared with the server). What it keeps of a recording (the rework’s whole recording, a flip’s pieces, the sampled phrases, a take) is kept in memory under demo:takes/ (take::IN_MEMORY), and goes in the project the page saves under takes/. A project it saved opens in it again (claudius_api::Listen::OpenProject, Host::open_project): claudius::song::read_project reads the zip into memory as unpack_project would unpack it, and each recording the song plays is held again as demo:<its path in the zip>, with what it was cut from and what a take credits. A command that names a path is answered that the demo opens no paths. Scripts, opened songs and every edit are the engine’s, as in the studio.

cargo run -p claudius-ui -- --mock          # the native studio on the demo song
CLAUDIUS_MOCK=1 cargo run -p claudius-ui

On the web, ?mock in the URL does the same.

A phone with the demo

A phone plays along with the demo through the site’s relay (site/worker/room.js): the demo’s Play from a phone joins a room, named with 128 random bits kept in the tab’s sessionStorage (a reload keeps it), as its host, and shows the phone’s page on the site, /phone/?room=<name>, as a QR code. The page is the one claudius serve serves to a phone (Server, sessions and MCP); with ?room= it sends each request as a message {id, method, path, body} through the room. mock/phone.rs answers them as the server’s phone.rs does: the song and the clock from the demo’s state and the transport the studio reports, each lane’s hit, the keys’ notes and a record rendered by the engine (claudius_session::host::Host::sound, a message of their own to the worker) and kept as WAV files for the song’s version, and a take sent to the engine as a command of its own name, whose answer goes to the phone and to the person as a toast. A sound goes back as a binary message: the phone’s id, the request’s, and the WAV.

The demo’s samples

A song built on samples is built on them in the demo too: one of a genre that is by default (trip-hop, boom bap, lo-fi, jungle, big beat, filter house), or one asked to be (sampled, sample_search). Making it starts a job, mock/sample.rs, that gathers what the genre samples, as the engine’s genre info says (GenreInfo::sampling): a phrase, and a drum break or a texture where the genre has them. For each it tries the genre’s searches in an order the song picks (“disco”, “gospel choir”, “funk drum break”; the phrase’s searched for the words asked instead), takes the recordings of a length the role takes under CC0 or CC BY, and fetches one, a loop or a whole song. The page only finds and fetches: it hands the engine the file’s bytes (Link::recording), and the engine, in its Web Worker, cuts it as claudius cuts one (Host::sample, sampling::cut): it decodes the file, finds its beat grid, and cuts the phrase out of the two bars of its harmonic sections that are loudest (the demo has no ears to choose by), with their key and chords, or the break with its own hits, or sixteen seconds of texture, and keeps the cuts in memory. A recording it can cut nothing from it turns down, and the page tries the next; one is stretched, sped up or chopped into the genre’s tempo as the app does it, with the same stretcher (sampling::meets, LoopPart::retime). The song is made from what was kept as the server makes one from the samples it gathered (see Songs built on samples), and the log gives each sample’s full credit with the links.

The demo asks the site, never the libraries: samples/search?q=… and samples/audio/…, relative to the page. The site’s Worker answers those (see Privacy). Natively, CLAUDIUS_DEMO_SAMPLES names an address, such as the local site’s:

cd site && node tests/serve.mjs &          # its /studio/samples/ asks Openverse and the libraries live
CLAUDIUS_DEMO_SAMPLES=http://127.0.0.1:4321/studio/samples cargo run -p claudius-ui -- --mock

The demo’s instruments

A browser has no folder to install packs in, so the demo plays web editions of them, which the site serves from /studio/packs/ (cargo xtask site --sounds, claudius-packs web, crates/claudius-packs/src/web.rs): the Salamander piano, a Wurlitzer and a CP-80, the upright piano, the organ, the strings, brass, flute, harp, mallets, sax and hand percussion of VSCO 2 and VCSL, the guitars and basses, the choir, the acoustic kit, the TR-808 and TR-707, uzu’s kit and FreePats’ synthesizer percussion, 99 instruments in 25 MB, from packs the site may pass on (CC0, public domain, CC BY; their credits in /studio/packs/CREDITS.txt). A song asks for a Rhodes most of all, and jRhodes’ samples may not be passed on for others to use, so the Wurlitzer answers for it; the TR-909’s licence forbids passing its samples on too, so the demo synthesizes the 909, as it does any kit it lacks. Of each instrument an edition keeps what a browser can fetch and hold for a song: one velocity layer (two of a keyboard and of a drum), the first round robin, a root every three semitones with its keys reaching halfway to the next, and four to six seconds of each note (two of a drum hit; a note that loops keeps its loop), as Ogg Vorbis. Its index is a pack’s like any other.

The engine fetches packs/index.json and each pack’s index before it first speaks, so the first song already draws their instruments, and hands each to claudius_packs::provide: from then on they resolve as installed ones do. Before it renders, it asks which files the song’s instruments play that it has not got (Host::instruments, claudius_packs::wanted), fetches them all at once, decodes each into the packs’ cache, where it stays (claudius_packs::provide_file), and renders once they are in; the browser keeps them for the next visit. A song of a few instruments fetches 1 to 4 MB. A page served without them (cargo xtask site without --sounds, or trunk serve) plays the synthesized sounds, as the demo did before.

Beside them the site serves the fuller editions of the same packs from /studio/packs-more/ (WEB_MORE in xtask/src/site.rs): every instrument of VSCO 2, VCSL, FreePats, the E-Pianos and the acoustic kit, the Splendid grand and the light piano, 163 instruments in all against the 99 the demo starts with. The engine fetches them once its first song has rendered (more in crates/claudius-web/src/worker.rs), one pack’s index after another, and hands each to claudius_packs::provide in place of the smaller pack of its name: the songs after the first draw on them, and the demo starts as quickly as before. Their files come as a song plays them. The engine tells the page how many instruments it has ({"library": {"instruments"}}), which Infinite Radio’s page shows on its genres’ row, and once all are in, its sounds again ({"sounds"}) for the studio’s lists. The TR-909, jRhodes, Dirt-Samples, tidal-drum-machines and the mridangam stay out: their licences forbid passing them on, give no terms, or ask for share-alike.

Scripted runs

CLAUDIUS_UI_PLAN drives the native window from a list of steps separated by ;, so a change to the UI can be checked, screenshotted and repeated without a person at the screen:

CLAUDIUS_UI_PLAN='wait:4;shot:/tmp/a.png;tab:mixer;play;wait:2;shot:/tmp/b.png;exit' cargo run -p claudius-ui -- --mock

The steps: wait:<s>, tab:<name>, section:<i>, play, pause, seek:<s>, newsong, close, tour[:<step>], assistants (the Connect an assistant dialog), publish (the Publish dialog), radio (the Infinite Radio window), cmd:<command JSON>, size:<w>,<h>, script:<code> (into the editor, \n for a newline and %3B for ;), run, reference, audiopath:<file>, shot:<file.png> (the window as rendered), exit, and synthetic pointer input in points: move:x,y, click:x,y, rclick:x,y, drag:x1,y1,x2,y2, sdrag:x1,y1,x2,y2 (with shift). A scripted run starts the first-run tour only when a tour step asks for it, so that the screenshots of other steps do not have its card in them.

Building

Natively, the studio is part of the claudius binary (the studio feature, on by default) and of claudius-ui. For the web, trunk builds it into crates/claudius-ui/dist:

cargo xtask web                       # trunk build --release, with relative asset URLs

Trunk.toml builds index.html with relative URLs (public_url = "./"), so the same dist works at / of any claudius and from a static file server, and hashes file names so a browser never runs a stale build.

The studio draws itself on a canvas, so there is no page to render ahead on a server. While its program arrives (about 3 MB compressed, 10 MB unpacked), index.html draws the studio’s outline itself, in HTML and CSS: the transport, the toolbar, the arrangement, the dock, the inspector and the status line where the studio puts them, in the look its settings keep in the page’s local storage, with a meter of how much of the program has arrived. The page counts the program as it arrives, unpacked, against how large it is unpacked, which cargo xtask web writes into the page (data-bytes), as a server that compresses it, as the site and claudius both do, does not say. The program itself goes to the browser as it came, so the browser can keep it compiled for the next visit. start_web takes the outline away once the studio runs. If the program does not arrive or the studio cannot start, the outline says why, and the page links to Troubleshooting. CI runs clippy for wasm32-unknown-unknown separately, because the native clippy run never sees the code behind cfg(target_arch = "wasm32"). Preferences (the open tab, volume, the Variations and Improve settings) persist through eframe: natively in claudius-studio/app.ron under the platform’s data folder, on the web in local storage.

Testing

claudius makes music, and most of what can go wrong with it is audible rather than a crash: a hat that moved, a song that came out 3 dB too loud, a script that stopped printing back into itself. The tests are built around that. Some check laws (a printed song changes nothing when run), some check measurements (a render lands within 1 LU of its target), some freeze the generators so that a change to the music shows up as a readable diff in review.

Running them

cargo xtask ci

runs what CI runs on every pull request: cargo fmt --all --check, cargo clippy --workspace --all-targets --locked -- -D warnings, clippy again on the builds that leave features out (the studio without the ears, the engine and server without the ears) and a check of the CLI without the studio window, so that code behind cfg(feature = ...) keeps compiling, then the tests (with cargo-nextest when it is installed, cargo test otherwise), the doctests, and the examples in the docs. The dev profile compiles the workspace at opt-level = 2 and dependencies at 3, because many tests render audio, so expect a long first build and fast test runs after it.

One kind at a time:

commandwhat it runs
cargo test -p claudiusthe engine’s unit tests and every file in crates/claudius/tests/
cargo test -p claudius --test scriptone of them (pipeline, theory, script, docs_examples, pattern_laws, generators)
cargo test -p claudius-serverthe session, HTTP and MCP tests
cargo test -p claudius-clithe binary end to end, and the connect unit test
cargo test -p claudius-packsthe packs’ unit tests and the offline pack test
cargo test -p claudius-packs -- --ignoredthe network test: real downloads
cargo test -p claudius-decodethe decoder
cargo test -p claudius-macoson a Mac, the files read from an “open documents” event as the Finder sends it
CLAUDIUS_INTENT_MODEL=PATH cargo test -p claudius-intent -- --nocapturethe command palette’s search: word pieces, the model’s file, the index, the ranking; and, with PATH the model (claudius’s own file of it, potion-base-8M.clde in claudius’ cache once the palette has been used, or a folder holding Model2Vec’s model.safetensors and vocab.txt), the evals: the phrasings people use for each action, one set the ranking was tuned on and two held out, and the ways people ask to go back to a change among a song’s history (tests/history.rs), with phrasings held out that share few words with it; each phrasing missed said
CLAUDIUS_NEEDLE_MODEL=PATH CLAUDIUS_NEEDLE_ADAPTERS=crates/claudius-intent/data/needle-adapters.safetensors cargo test --release -p claudius-intent --test asks --test needle -- --nocapturethe request model (0014), with PATH Needle 3’s needle3.cact (in claudius’ cache once the palette has read a request with it): claudius’s step of it against needle-core’s, a request read after another as on a fresh model, and the taught model on every example, alone and after the readings, and on requests that ask no change; CLAUDIUS_NEEDLE_SET=later reads the newest examples only
CLAUDIUS_WHISTLE_CLIPS=DIR cargo test --release -p claudius-session --test hearing -- --nocapturewhat is said to the palette, heard as the palette hears it (0015): every WAV file in DIR beside the words said in it (<name>.txt, empty for silence), each heard and its words put right, and the words missed counted, at most one in five. The speech model comes from claudius’ cache (CLAUDIUS_HOME), and downloads there when it is not in it
cargo test -p claudius-uithe studio’s tests: the native player, the mock, the script editor’s highlighting and error lines, numeral labels
cargo test -p earshotearshot’s fast parity checks, no models
cargo test -p earshot --release -- --ignored --nocaptureearshot’s model parity checks (downloads the models)
cargo +nightly fuzz run scripta fuzz target, from fuzz/
cargo bench -p claudiusthe benchmarks
cargo xtask perf [--base REV]the instructions each of the engine’s main steps takes (with Valgrind, on Linux); on a Mac, their wall times

What each kind protects

Unit tests

Every crate keeps small tests next to its code: the mini-notation parser in pattern/mini.rs (sequences, alternation, weights, euclid, readable errors), velocity crossfades keeping constant power in claudius-packs/src/model.rs, name resolution with banks and aliases in resolve.rs, SFZ inheritance, Strudel maps, WAV to FLAC being lossless, connect editing a config file without losing other servers and refusing broken JSON, the decoder reading WAV at its own rate and explaining what it cannot read. They pin down the behaviour of one function, so a failure points at it.

tests/pipeline.rs

The engine end to end, on signals with known answers:

  • every genre composes and arranges, every section’s layers name real tracks (or the genre’s optional parts), and a blueprint survives a round trip through JSON unchanged;
  • a short house song renders with every sample finite, a true peak at most 0.05 dB over its ceiling, a loudness within 1 LU of its target, and a verdict over 50;
  • the beat tracker reads click tracks at 92, 124, 140 and 174 BPM within 1 % (half or double counts);
  • chroma finds G major in I IV V I played as sine triads;
  • loudness reads −3.0 LUFS (±0.2) for a −3 dBFS 1 kHz sine, the BS.1770 reference.

tests/theory.rs

Keys parse and print; Roman numerals follow the key’s mode (VI in A minor is F) and round-trip; chord symbols round-trip; voicings stay in range, use only chord tones and move at most 24 semitones over three changes; Markov progressions stay diatonic; euclidean rhythms spread their onsets; templates keep their certain hits; every bass style lands on the chord’s bass note at each change (except acid), and a lead stays in key and in range.

tests/script.rs

The script language:

  • patterns built from code have the right events, and keep their code, closures included;
  • the round trip: songs in five genres print as scripts that, run on the same song, change nothing; and a pattern-built song does the same;
  • pattern tracks play in their sections with exact note counts per sound, voiced in range, with the right roles;
  • edits on a generated song do what they say, and a change of mode moves the progression’s numerals;
  • every example in the script reference (script_reference.md, which claudius reference prints and assistants read) runs;
  • sampled instruments and drum machines resolve and render, when packs are installed (skipped otherwise);
  • the sandbox: dense patterns, deep nesting, long strings, huge repeats and euclids, infinite loops, import, eval, songs over 512 bars or 20 minutes, and songs with more tracks than a render can hold all fail with the right message;
  • errors say what to do (unknown sound 'foo' lists the synths, cannot read key, no part 'nope').

tests/docs_examples.rs

Every fenced js block in docs/src and in the README runs against a house song with seed 9, so the book cannot drift from the language. The info string decides what is expected: js must succeed, js error must fail, js packs runs only when packs are installed, js no-run is not run. Lines starting with ~ run but are hidden on the page. A block passes when the script succeeds and, if it leaves a song, the song arranges into at least one track; it is not rendered. A failure report starts with <n> of <m> examples failed: and gives, for each, docs/src/<file>:<line>:, the error and the example’s code, the line being that of the opening fence. Writing docs explains how to write examples.

tests/pattern_laws.rs

Properties that hold for any pattern, checked with proptest on 256 generated cases each, from mini-notation built out of the pieces people write (bd, ~, cp:2, numbers, *2, /2, !, ?, @2, (3,8), (5,8,2), nested in [ ], < >, stacks and [ ]*2):

  • the parser never panics, on any text up to 120 characters;
  • events start inside the queried window, in order, with positive, finite lengths;
  • querying [0, 1), [1, 1.5) and [1.5, 3) gives the events of [0, 3);
  • fast(k).slow(k), late(t).early(t) and rev().rev() give back the original;
  • randomness (sometimes, degradeBy) gives the same events every time;
  • degradeBy(0) keeps everything and degradeBy(1) nothing;
  • a pattern’s printed code evaluates to the same events.

When a case fails, proptest shrinks it to a small counterexample and saves it in tests/pattern_laws.proptest-regressions, which is committed so the case keeps running.

tests/generators.rs

A snapshot (with insta) of what each genre’s generator writes for seed 42: tempo, key and swing, the progressions, every section with its flags and layers, every drum variant as a step string, every part, the mix of every track. Numbers are rounded, so floating-point differences between platforms cannot fail it, and the test points CLAUDIUS_PACKS at an empty folder, so the snapshots describe the generators and not what is installed. A second test checks that the same seed gives the same blueprint and the same project.

Any change to theory, genre profiles or the composer shows up here as a diff a reviewer can read: “the house hats moved”, “trap’s progression changed”. When the change is intended:

cargo test -p claudius --test generators     # fails and writes tests/snapshots/*.snap.new
cargo insta review                           # shows each diff; accept the intended ones

(cargo install cargo-insta provides the command.) Commit the updated .snap files with the change, and say in the pull request how the music changed.

crates/claudius-server/tests/session.rs

  • a session makes a song, settles with a render over 60 s long and a verdict over 50, takes a script (tempo and solo), refuses a bad progression, and undoes and redoes back to the right tempo;
  • a session limited to one folder refuses to load, save or play files outside it, including inside/../escape, and answers a missing file outside it exactly as an existing one, while a missing file inside is does not exist;
  • the HTTP guards: security headers, 403 for a foreign Host, 415 for a command that is not JSON, 400 for an unknown command, 401 without the token, 200 with ?token= (and a cookie) or a bearer header;
  • MCP over HTTP: initialize, list the tools, make a song, get a tool error for an unknown sound, read the song back as a script;
  • two saves asked for while the new song’s render runs wait for it, then write the whole folder, each track’s stem only into the one that asked, and no part of a file left behind;
  • the studio’s accent and ghost thresholds (claudius_api::{ACCENT, GHOST}) equal the engine’s step-string ones.

These tests run real renders with the library and the ears off, so they take tens of seconds.

crates/claudius-cli/tests/cli.rs

The claudius binary as people and assistants run it, with CLAUDIUS_PACKS pointed at an empty folder so the result is the same on every machine: the help names the commands, genres and reference print, a script from stdin prints its song, a broken script fails with its reason on stderr, connect print prints valid JSON, make writes a song folder with a verdict over 50, and MCP over stdio initialises, lists tools, runs a script and reads the song back.

Packs, the decoder and earshot

claudius-packs/tests/offline.rs builds a pack of sine waves by hand (two velocity layers at two pitches, a drum with two variants), installs nothing from the network, and checks resolution, layer selection, pitch, variants and credits. A unit test in install.rs, pack_names_stay_inside_the_packs_folder, holds remove to plain pack names. tests/network.rs is ignored by default: it installs tr707 and a Strudel map into a temporary folder and plays them, and checks that an opt-in pack refuses to install without consent.

earshot’s tests/parity.rs compares the Rust port with the Python earshot on fixtures it wrote (parity/fixtures/, made by parity/make_fixtures.py): decoding, resampling, the mel front end, CLAP embeddings (1 − cosine within 3e-10), calibrated z-scores, AudioSet probabilities, realness, measurements, beat grids and search. The model checks are ignored by default because they need the models; inputs that are Apple Loops are skipped where they are not installed. Stem separation (separate.rs) runs its front end and back end without the nets: nets that keep the bins of a band each (vocals under 1 kHz, bass under 200 Hz, drums above 4 kHz) must give stems that add up to the recording within −50 dB, each holding its band, with each channel its own. earshot’s README lists every tolerance.

Fuzzing

fuzz/ holds two cargo-fuzz targets, in a workspace of their own because libFuzzer needs nightly:

targetfeedsmust hold
mini_notationany UTF-8 text to mini::parse, then queries what parses over [0, 4) and [−1.5, 0.25)no panic, no hang, no runaway query
scriptany UTF-8 text to script::runno panic, no hang, no memory exhaustion
cargo install cargo-fuzz
cargo +nightly fuzz run mini_notation -- -max_total_time=300

CI runs each target for five minutes every Saturday, keeping the corpus in the Actions cache and uploading any crash. A crash leaves its input in fuzz/artifacts/<target>/: turn it into a regular test before fixing the bug, so it stays fixed. The sandbox limits in Patterns and the script engine exist because fuzzing finds the gaps first.

Benchmarks

crates/claudius/benches/engine.rs (criterion) times generating and arranging a house song, rendering 8 bars, querying a dense pattern for 64 bars, running a script edit and printing a song. Results go to target/criterion, with comparisons against the previous run. CI checks that the benchmarks build.

Performance tests

A clock on a shared CI machine wanders by a tenth from one run to the next, too much to tell a slower change from a busier machine, so CI counts instructions instead. crates/claudius/examples/perf.rs holds the workloads, each one of the engine’s main steps on fixed input: generating a house song and a layered alternative hip hop one, arranging a song, rendering four bars, judging them, a script edit and printing the song, encoding eight seconds as MP3 and decoding them, a scratch, and the harmonic-percussive split a remix makes. cargo xtask perf runs each under Valgrind’s cachegrind on one thread, once with its setup alone and once whole, and counts what the workload itself takes. The same build counts the same on every run, give or take a hash map’s order.

CI’s performance job builds the pull request’s workloads and its base’s (in a worktree of the base) and fails a workload that takes more than 10 % more instructions than the base’s. A change that slows one on purpose says so in its pull request’s description, a line such as perf: render +20% (twice the voices), and the job allows that workload as much. The job’s summary has the table of counts. On a Mac, where Valgrind does not run, cargo xtask perf prints each workload’s wall time instead.

The rest of CI

The tests run on Linux and macOS, and on Windows without the ears as an experimental job that reports without blocking. Besides them, every pull request checks: formatting; clippy on the workspace, on the studio for wasm32-unknown-unknown, and on the builds that leave features out; that the Intel Mac release target compiles; that the web studio builds with trunk; that the workspace builds on the minimum supported Rust version (rust-version in Cargo.toml); cargo deny (licences, advisories, sources); spelling with typos; that the book builds and its examples run; that the benchmarks build; the workflows and install scripts pass actionlint, shellcheck and PSScriptAnalyzer; and the website builds, its internal links resolve (lychee, with the book at /docs/), and it passes its smoke test. The only required check is ci ok, which passes only when each of them passed or was left out by a condition of its own: one that failed, was cancelled, or never ran because no runner took it fails it. Development setup covers installing the tools.

Tests and the machine they run on

Installed packs, Apple Loops and models change what claudius does, so the tests decide what they see:

  • generator snapshots and the CLI tests point CLAUDIUS_PACKS at an empty folder;
  • tests that need packs skip without them (sampled_instruments_and_drum_machines, js packs examples);
  • the engine’s tests pass no Apple Loops library to generate, and the session tests run with library: false;
  • no test loads earshot’s models except earshot’s ignored parity checks.

Tests that render with packs installed are slower but check the same things. CI has no packs, no Apple Loops and no models, so whatever passes there passes on a clean machine.

Adding a test

  • A bug gets a test that fails before the fix, in the file of the layer where it lives: a parser bug in pattern/mini.rs, a script function in tests/script.rs, a session behaviour in tests/session.rs.
  • A new script function needs a case in tests/script.rs, an example in the language reference (a js block, which docs_examples runs), and, when it changes what a song stores, a check that the song still prints back into itself. Making a change walks through one.
  • A change to the music (theory, a genre, the composer) updates the generator snapshots; review the diff as music and describe it in the pull request.
  • A new pattern method with a law (an inverse, an identity) belongs in tests/pattern_laws.rs, and a new mini-notation feature in the strategy that generates sources there.
  • A new HTTP route or command gets a case in tests/session.rs, through http::router with tower::ServiceExt and no network.
  • Pack handling is tested with a hand-written pack in a temporary folder, as tests/offline.rs does, never with downloads in the default test run.

Security model

claudius runs on your computer, opens audio files, runs scripts written by people and assistants, downloads models and samples, and answers HTTP. SECURITY.md is the summary and says how to report a vulnerability. This page is the full model: who claudius trusts, what it defends against, how, and where the defences end.

What is worth protecting

  • Your files. claudius can read audio and write song folders; it must not become a way for someone else to read or write anything else.
  • Your computer’s resources. Rendering is heavy by nature; nothing outside should be able to make claudius use unbounded memory, disk or time.
  • Control of the session. Whoever can send commands can run scripts, start jobs, open and save files.
  • The integrity of what runs. The models and samples claudius downloads, and the releases you install.
  • The licences of what you publish. A song should not quietly contain samples you may not publish.

Who is who

actortrusted?can reach claudius by
you, at your computeryesthe studio, the CLI, curl
assistants you connectacting for you; their scripts are untrusted codeMCP over stdio or HTTP
programs and users on the same computernot defended against127.0.0.1, like you
web pages in your browsernorequests your browser sends to 127.0.0.1
machines on your networknonothing, unless you listen beyond loopback
whoever holds your tokentreated as youa tunnel or the network, with --public
hosts claudius downloads frompartly: content is checked where it can be
files and blueprints you opennotheir contents

Two of these deserve a sentence each. A local process is outside the model: it can already read your files, and claudius listening on loopback gives it nothing it lacks. A token holder is inside the model on purpose: the token is how you reach your own claudius from a phone or a cloud assistant, so whoever has it is you.

The network

Loopback by default

claudius serve and studio listen on 127.0.0.1 unless --host says otherwise. Listening on another address without a token prints warning: listening on <host> without --token: anyone who can reach this port controls claudius. The server prints its address only once the port is bound; a taken port is an error, port <port> is taken, by another claudius or another program (--port picks another).

Host names: no DNS rebinding

A web page cannot read http://127.0.0.1:7878 directly, but it can point a domain it controls at 127.0.0.1 and talk to claudius as a same-origin page. That attack (DNS rebinding) is stopped by the Host header: unless the server is --public, every request must name localhost, 127.0.0.1 or [::1], and anything else gets 403. The MCP endpoint has rmcp’s own allowed-hosts check as a second layer, turned off for --public servers. The Host check is not authentication: a program can send Host: localhost to a claudius listening on the network, which is why listening beyond loopback takes a token.

Cross-site requests: no forms, no no-cors

Without CORS, a page on another site can still send simple requests (a form post, a fetch in no-cors mode), even if it cannot read the answer. claudius makes every state-changing request impossible to send that way:

  • POST /api/command requires Content-Type: application/json, which no simple request can carry (415 otherwise);
  • the MCP endpoint requires Content-Type: application/json and Accept: application/json, text/event-stream, and every request after initialize needs the mcp-session-id from a response the page cannot read;
  • GET routes change nothing (the one side effect is encoding an MP3 of a render that exists).

CORS then allows reading answers only from pages served by http://localhost, http://127.0.0.1 or http://[::1] on any port, so a local web app can use the API and a remote site cannot. The allowlist includes every local port, which means any local web server’s pages, consistent with not defending against local processes.

Tokens

With a token (--token, CLAUDIUS_TOKEN, or the one --public makes when it is given none), every request must carry it as Authorization: Bearer, as the claudius_token cookie, or as ?token=. A request with ?token= also sets the cookie, HttpOnly; SameSite=Strict; Path=/, and Secure when the request came through https, which tunnels report with X-Forwarded-Proto: https; over plain HTTP on a LAN a Secure cookie would be dropped, so it is left off there. The comparison takes the same time wherever the strings first differ. CORS preflights are answered without the token so a browser can learn what is allowed; the request itself then needs it. A request without the right token gets 401 with this claudius needs its token (Authorization: Bearer <token>, or ?token=<token>), which is how claudius mcp, studio and doctor tell a claudius that wants a token from nothing at all.

What the token does not do:

  • It does not expire or rotate. Restart with a new token to revoke the old one.
  • A ?token= URL lands in browser history and in the logs of the tunnel and any proxy in between. The bearer header avoids that where the client supports it.
  • Anyone with the token can do everything you can through the API, including reading and writing files inside the shared folders below. Treat it like a password: openssl rand -hex 16 makes one of the same strength as the tokens claudius makes.

The phone’s page

Playing from a phone opens a second port to the network, but only while the studio asks for it (POST /api/phone, which a page on another site cannot send: the main API’s guard and CORS stand in front of it) and only for the page and its few routes, which play the song’s sounds and take add_hits, add_notes and add_scratch, and nothing else. A scratch’s recording is the one audio a phone sends: a WAV file of at most 10 seconds, in a body of at most 4 MB, decoded as any recording is and kept as the take. Every request needs the key the QR code carries: 16 random bytes, new each time the page is served, checked in constant time, and kept by the phone as an HttpOnly; SameSite=Strict cookie. Without it the answer is 403. The page’s answers carry Referrer-Policy: no-referrer (its address holds the key), Content-Security-Policy: default-src 'self' with no inline script, X-Frame-Options: DENY and no-store. The traffic is plain HTTP, like the rest of a LAN claudius: someone who can watch the network can see the key and play into the song until the page stops, which DELETE /api/phone, the window’s Stop sharing or quitting does.

The chat’s agents

Starting an agent from the chat (POST /api/chat/agent) runs a program on the computer claudius runs on, so a claudius others reach (--public, a token, or --files) refuses it, and a page on another site cannot send it (the API’s guard and CORS). The programs are claudius’s own, fixed: npx -y @agentclientprotocol/claude-agent-acp, npx -y @google/gemini-cli --acp and npx -y @agentclientprotocol/codex-acp, as the ACP registry runs them, never one a request names. The agent works in the songs folder with claudius’s MCP tools (claudius mcp --url of this claudius), and a permission it asks for anything else is refused, and the chat says so: for a tool not named for claudius, or one that edits, deletes or moves a file, runs a command, fetches from the web or names a file it works on, whatever it is called. When it stops, or claudius quits, its whole process group goes with it.

The demo pairs with a phone through a room of the site’s relay instead (site/worker/room.js, a Durable Object). A room is named with 128 random bits that only the demo’s QR code carries, takes one tab as its host (the same tab again after a reload, which keeps the name) and four phones, and only pages of the site’s own origin may join it. It passes a phone’s requests to the host, tagged with an id it gives the phone, and the host’s answers to that phone alone; it keeps nothing. The demo, like the server, makes nothing of a phone’s requests but its sounds and add_hits, add_notes and add_scratch.

--public

--public lifts the Host check so a tunnel’s or a LAN’s host name is accepted, and switches on the file policy below. A public claudius always has a token: without --token it makes one from 16 random bytes from the operating system and prints it once the port is bound:

claudius at http://127.0.0.1:7920: web UI at /, API at /api, MCP at /mcp (token required)
shared with a new token: open http://127.0.0.1:7920/?token=<token> (through your tunnel, its address with ?token=<token>), or send Authorization: Bearer <token>. --token sets your own.

Each start makes a new one, so a restart revokes the last. --host with any address but loopback makes one the same way, with or without --public: the Host check refuses browsers, but a program on the network can send Host: localhost, so only the token keeps it out.

Files

The policy

A claudius only you can reach reads and writes wherever your user can, because that is what a local app does. A shared claudius (serve --public, serve --host with an address other than loopback, or serve --files <dir>) checks every path it is given against a list of roots, config::shared_roots() plus the --files folders:

  • Reading (config::path_allowed): the path must exist and, canonicalised (symbolic links and .. resolved), start with one of the canonicalised roots. config::read_error turns a refusal into a message. Used for scripts’ .s(path), load / open (and every audio file a loaded blueprint plays), analyze, remake, add_take and sample_song.
  • Writing (config::write_allowed): the nearest existing ancestor of the path must pass the reading check, and every remaining component must be a plain name, so allowed/../outside and allowed/missing/../../outside are refused. Used for save and for where a take is kept.

config::shared_roots() is the song folder (~/Music/claudius), claudius’ cache folder, the sample packs folder and the two Apple Loops folders. Sample-pack instruments and Apple Loops one-shots are found by name, not path, and stay available. The command line is not subject to the policy: you are running it.

Its limits

  • Check, then use. The check and the use are separate system calls. A local process that can swap a path for a symbolic link between them can redirect a read or write; local processes are outside the model, and a remote token holder has no command that creates links.
  • Links already inside a root. Writing song.wav into a folder follows a symbolic link already there. If you keep links inside ~/Music/claudius to places you do not want written, a token holder can write through them.
  • Existence. config::read_error says <path> does not exist only for a path that would be inside the roots; any other path gets <path> is outside the folders this claudius may read, whether it exists or not. A token holder learns which files exist only inside the folders it may read anyway.
  • Roots that do not exist yet. Roots are canonicalised, and one that does not exist is left out. Until ~/Music/claudius exists, a shared claudius refuses to save there (<path> is outside the folders this claudius may write), including the default save without a path. This is listed as a known gap below.
  • Unshared mode is open. An assistant connected to an unshared claudius can open and save files anywhere your user can, through open, save and .s(). That is the trust you give it by connecting it; serve --files <dir> fences it in.

Scripts

Scripts come from you, from assistants, from files you open and from printed songs, so they run in a sandbox (script::limits):

  • no file, network or process functions exist; the only file access is resolving .s(path), under the file policy;
  • import finds no modules (DummyModuleResolver) and eval is disabled;
  • 5 million operations, 10 seconds, call depth 64, expression depth 128 (64 in functions), strings of 200,000 characters, arrays of 10,000 items, maps of 1,000 entries;
  • a pattern query may do 4 million steps of work and make 262,144 events; *, /, fast, slow and ply take factors above 0 and up to 256; a track may play 1,024 notes per bar; mini-notation is limited in length (4,096 characters), nesting (64), repeats and euclidean steps (256);
  • a song is at most 512 bars and 20 minutes, with at most 64 tracks and 12,000 track-seconds (20 tracks of 10 minutes), because a render holds every track in memory; this is checked after every script and edit and again before rendering, where a pattern with several sounds counts as a track for each.

The fuzz targets run arbitrary text through the parser and the script engine every week. The event budget is what bounds a query’s memory. track("x", s("bd*100000000")) is refused while parsing, and the whole claudius script process peaks at 33 MB; the densest pattern the speed limit allows, track("x", s("[bd*256]*256")), stops at the event budget with the process at 134 MB.

Pattern tracks in a blueprint are code: arranging a song evaluates them, with the same sandbox and only the pattern functions.

Files and blueprints you open

  • A project double-clicked, or handed to claudius studio FILE, opens as one chosen with Open does, with the same limits: the file is read whole only up to 300 MB, and it unpacks into a song folder of its own, refused when a file in it would land outside that folder or it would unpack to more than 2 GB or 10,000 files. On a Mac the system hands the app its files as an Apple Event, taken by claudius-macos: the one crate with unsafe code, for its calls into the Objective-C runtime, each block saying why it holds (clippy::undocumented_unsafe_blocks is denied there).
  • Audio is decoded by symphonia, a Rust decoder, in claudius-decode, which forbids unsafe code itself; the Opus symphonia finds by opus-pure, a Rust decoder too, with no C. When neither can read a file and ffmpeg is installed, ffmpeg decodes it, and earshot decodes with ffmpeg whenever it is installed, to match the Python reference: C code, run as a separate process with the file name as an argument (never through a shell) and -nostdin. CLAUDIUS_FFMPEG=none turns that off. Every ffmpeg and ffprobe input goes through claudius_decode::ffmpeg_input, which allows only the file protocol and the demuxers of files that hold their own audio. A playlist (.m3u8) or a list of files is refused, because it would make ffmpeg open files the path check never saw, outside the folders of a shared claudius.
  • Decoding is bounded: a file gives at most 30 minutes of stereo at 48 kHz (MAX_SAMPLES, as many samples in other layouts), and a longer one is refused (TooLong) before it fills the memory. ffmpeg is asked for no more than that (-t), and its output is read as it comes.
  • Blueprints are data, with three things in them that act: pattern code (sandboxed, above), file paths (checked by the policy on a shared claudius), and numbers. Lengths are bounded, but not every effect parameter is, so a hand-crafted blueprint can make a render slow or large within the song-length limit. Open blueprints from people you trust as you would open their project files in a DAW.
  • Text that reaches an assistant: song titles, sound names and file names from a blueprint or a file appear in the MCP tools’ answers, where they could carry instructions aimed at the assistant (prompt injection). claudius passes them through as data; the assistant’s host decides what to trust.

Downloads

whatfromchecked
CLAP and AudioSet modelshuggingface.co, at pinned revisionsSHA-256 of every file, pinned in earshot/src/models.rs; a mismatch is deleted and never used
the command palette’s models (potion-base-8M, Needle 3, Whistle)huggingface.co, at pinned revisionsthe size and SHA-256 of every file, pinned in claudius-intent’s model.rs and needle.rs and claudius-session’s hearing.rs; a mismatch is deleted and never used. Needle’s adapters are built into claudius, and are refused if they were taught with other tools than claudius gives the model
curated packs from GitHubraw.githubusercontent.com at pinned commitsthe commit pins the content; sizes against GitHub’s listing when there is one
curated Strudel mapsthe map and every file it names on raw.githubusercontent.com at pinned commitsthe commit; a map whose _base names a branch is pinned to the map’s commit, or by the registry’s map_base, and an install refuses a file that is not at a commit
tr909, the FreePats organaudiorealism.se, freepats.zenvoid.org (archives)the size and SHA-256 in the registry; a mismatch, in a download or in the cache, is deleted
Strudel maps you addany URL you give, HTTPS or HTTPnothing beyond the length, and at most 1 GiB a file

Archives are unpacked into a scratch folder with the system’s tar (or unzip, 7z); bsdtar and GNU tar strip absolute paths and refuse .. members by default. Every symbolic link in the unpacked tree is then deleted, and the walk over it follows none, because a member named like a sample but linking to ~/.ssh/id_rsa would otherwise be copied into the pack. The members are copied into the pack under sanitised relative paths (.. cannot survive sanitize), so what lands in the pack’s folder stays inside it. A download whose size is not known in advance stops at 1 GiB, and one that sends more than its known size is cut off. A GITHUB_TOKEN in the environment is sent only to api.github.com. Every sample is audio and goes through the decoder above. The packs on an unclear licence are opt-in and refuse to install without --accept-licence.

Releases and the build

  • Release archives are built by the release workflow from main after a reviewed release pull request, with a SHA256SUMS file and a build provenance attestation. The install scripts come with each release and are in its sums, and they check the archive they download against them. gh attestation verify <archive> --repo devlato/claudius --signer-workflow devlato/claudius/.github/workflows/release.yml --source-ref refs/heads/main checks where an archive was built. 0009 Releases through pull requests explains the process.
  • The release workflow runs only on main (and on the hotfix branches, which only admins can push), and on a push only for the merge of a release PR. None of its jobs restores a cache: a cache is written by whatever ran in an earlier job on main, so restoring one would let that code into the archives. The jobs that hold tokens run no cargo, and the tokens are secrets of environments that only main may use. The site is built without secrets and deployed by a job that only uploads it.
  • Third-party GitHub Actions are pinned by commit SHA, checkouts do not keep credentials, and workflow permissions are the minimum each job needs. Tools downloaded in CI (lychee, actionlint, gitleaks, OSV-Scanner) are checked against SHA-256 sums.
  • cargo deny checks every dependency’s licence, advisories and source on every pull request; dependabot proposes updates.
  • Building earshot downloads a prebuilt ONNX Runtime through the ort crate (its download-binaries feature), which is linked statically. That download is a build-time dependency on the ort project’s hosting.

Known gaps

These are open, and listed so that nobody has to rediscover them:

  1. Sample pack archives (tr909, the FreePats organ) and user maps are not pinned by hash; a compromised host could serve different audio. GitHub-hosted packs are pinned by commit.
  2. The token never expires, and a ?token= URL stays in browser history and in proxy and tunnel logs.
  3. Caches do not shrink by themselves: decoded audio and Apple Loops cuts on disk, a session’s last ten renders (other sessions’ are deleted after 12 hours), and the one-shot and warp caches in memory. A token holder who keeps rendering and saving can fill the disk.
  4. cancel stops a mutation or an evolution after the current step but never a render, which runs to its end.

Report anything else privately, as SECURITY.md describes.

About these records

These are claudius’ architecture decision records: one short page per decision that shapes the code and would be expensive to reverse. Each records what the situation was, what was decided, and what that costs, so that someone who wants to change it later starts from the reasons instead of guessing them.

They are not design documents for features. A record is worth writing when a reasonable newcomer would ask “why on earth is it done this way?”, and the answer is a trade-off rather than a mistake.

recordin one line
0001 Real audio onlyevery sound is synthesized in code or recorded; no generated audio, no General MIDI
0002 Rust end to endengine, server, UI, ears and decoder in one language, no Python at runtime
0003 The blueprint is the songa song is stored as its decisions; the arranged notes are derived
0004 Rhai with Strudel-style patternsan embedded, sandboxed language with live-coding patterns inside strings
0005 One session, many clientsthe studio, browsers and assistants all edit one song
0006 A critic with earsmeters, theory and a calibrated CLAP model judge every render; some evidence is held out
0007 Which samples we shipnone: curated packs are downloaded from their authors, and only clear licences are on by default
0008 egui for native and webone immediate-mode UI compiled natively and to WebAssembly, talking only HTTP
0009 Releases through pull requestsa release is a reviewed pull request; merging it builds and publishes
0010 Samples from online librariessamples come from libraries made to be used (Openverse, Commons, ccMixter), never from YouTube or the streaming services, and only under licences that allow publishing
0011 Finding by meaning, on the devicestatic word embeddings and a flat index in plain Rust, in the engine, find actions by what the words mean on any computer, the browser too
0012 A history that only growsevery change is an operation in a log, with an id, what it was made on, and what it changed path by path; undo and going back are operations too, ready for a CRDT
0013 Requests in plain words, read on the devicea request is read by its words, the examples nearest it in meaning and rules on the song into what claudius would do, a button for each reading, scored on rounds of new requests before tuning to them
0014 A small model taught to read requestsCactus’s Needle 3, taught in Rust on claudius’s tools with low-rank adapters, reads on the device what the readings read nothing of; its calls are checked, said again in the readings’ words and grounded in the song
0015 Requests said aloud, heard on the deviceCactus’s Whistle, ported to Rust on needle-core, hears what is said to the palette; silence is heard as nothing, words heard near ones claudius knows are put right, and the words go into the field as if typed
0016 Settings any later claudius readsevery settings file has a version and is read field by field, a field that does not read costing only itself; earlier versions migrate as they are read, and what a later version wrote is kept
0017 A rebuild that sounds like the recordingproposed: a rebuild is measured on songs claudius renders itself and made from better parts, HTDemucs stems, YourMT3+’s notes, each instrument on a sound like its own, and chords from the notes
0018 Processors: effects with several tracks inproposed: an effect takes up to eight tracks in and gives one out, defined by a script’s function recorded once as a graph, with knobs and values that move through the song, and plays live in the live mix’s runtime
0019 Libraries of sounds and effectsproposed: recorded sounds, procedural sounds and effects in one format that holds data and never code, kept on the computer or installed from a marketplace pinned by hash, each with its licence and credit, tests first
0020 Changing a song’s genreaccepted: a song in another genre keeps its form, chords, key, melody, recordings and written notes, and the genre’s drums, bass, parts, sounds and mix play it, as one change undo takes back
0021 Every kind of sample, ranked and variedaccepted: the sampler offers sung phrases, hook and passage loops, drum breaks, bass lines and stabs, each scored as its kind, and a varied set of them, each piece saying what it is; a remake’s flip and sample_song choose by the same scores
0022 A song’s own sectionsaccepted: the analysis finds a song’s sections where they start, to the bar and at any length, names each for what it is by what repeats and what is sung, gives the music each plays a letter, and says where a build resolves and where a piece is best cut
0023 The live mix, first by windowsaccepted: while the song plays, windows of it as it is now, mixed by the server from the tracks the last render kept, play in the render’s place from just after the playhead, so a fader is heard as it moves; the runtime of 0019 replaces them later
0024 The radio in the appaccepted: the station planned by shared Rust code, its songs written by an engine of its own on a thread, each change from one song to the next rendered as audio and played as one stream
0025 The signal flow as the song’s lanesaccepted: each track a lane the sound runs through left to right, its effects as blocks that show what they do, zoomed and panned and edited where they are; an effect switched off is wrapped as off, keeping its place and settings

The format

Each record has a status and three parts:

  • Context: the forces at play when the decision was made: what claudius needed, what constrained it, what the options were.
  • Decision: what was decided, stated plainly, and the options that were rejected, with why.
  • Consequences: what follows, good and bad. The bad ones matter most; a record that lists only benefits is a sales pitch.

A status is accepted, superseded by NNNN, or deprecated. Records are not edited to match later thinking: when a decision changes, a new record supersedes the old one, and the old one gets a line pointing to it. Fixing a typo or a broken link is fine.

Adding one

  1. Copy the shape of an existing record into docs/src/design/NNNN-short-title.md, with the next free number.
  2. Write it while the decision is being made, in the pull request that implements it or before. Half a page to a page is enough; link to the code and the engineering pages for detail.
  3. Add it to docs/src/SUMMARY.md under “Design decisions” and to the table above.
  4. If it replaces an earlier record, set that one’s status to superseded by NNNN.

Use the pull request title docs(design): NNNN short title, so the record shows up in the changelog.

0001 Real audio only

Status: accepted

Context

claudius is meant to make songs the way a producer does in GarageBand or FL Studio, and to make them sound like a producer’s work. There were four ways to get sound:

  • Generated audio: a neural model that outputs waveforms from a description. It can sound impressive, but the result is a finished recording: there is no kick to move, no bass line to rewrite, no mix to rebalance. Its provenance depends on training data nobody can audit, and it needs a large model and, in practice, a GPU.
  • General MIDI: notes played through a General MIDI or SoundFont set. Every note stays editable, but GM sound sets sound like GM sets, and the free SoundFonts that sound better often have unclear licences.
  • Synthesis only: drums and synths rendered in code. Fully editable, small, deterministic, licence-free. But earshot’s ears, and people, hear a fully synthesized song as only marginally “professionally mixed”; a real piano, strings or a recorded 909 make a large difference.
  • Recordings: multi-sampled instruments, drum machines, loops. They sound real, cost disk space, and each set comes with a licence.

Decision

Every sound in claudius is real audio: either synthesized in code (13 drum voices, a subtractive and FM synth engine with 20 presets, risers and impacts) or recorded (sampled instruments and drum machines from sample packs, Apple Loops where GarageBand or Logic installed them, chops of songs you give it, any file a script names). Notes exist only as the score that plays those sounds, like a piano roll.

The model enforces it: model::Sound has a variant for each kind of audio source and none for anything else. Synthesis is always available as the fallback, so a song can be made with nothing installed, and recordings replace it where they exist (a genre’s "piano|epiano" preset plays the sampled piano when its pack is installed).

Generated audio was rejected because it cannot be edited at the level a producer works at, its output cannot be attributed, and its runtime cost dwarfs the rest of claudius. General MIDI was rejected for its sound, and because the packs claudius uses are mapped per instrument with velocity layers and round robins, which GM sets rarely have.

Consequences

  • Everything in a song stays editable and explainable: every note has a pitch and a time, every sound a name, every level a reason. Mutation, scripts and the critic all depend on that.
  • Rendering is deterministic: the same blueprint and the same installed sounds give the same audio.
  • The good-sounding version needs a download: about 2.2 GB of sample packs (1.2 GB on disk), and the sound of a song depends on what is installed, so the same seed sounds different on a machine without packs.
  • Sounds arrive at wildly different levels and timbres, so claudius needs an automatic mixer that balances every track to its role’s loudness, a mastering stage, and a critic to check the result (see Rendering).
  • Sampled instruments have the limits of their recordings: the default piano keeps 5 of its 16 velocity layers for size, the only clearly licensed choir is built from one sung vowel, and there are no vocals with words.
  • Licensing becomes claudius’ problem: which packs it may download by default, what credits a song needs. That is 0007.
  • claudius cannot make sounds that exist only as recordings it does not have, and will never “imagine” a sound. That is the point, and also a real limit next to generated audio.

0002 Rust end to end

Status: accepted

Context

claudius has to do several different jobs well:

  • render a four-minute song of a dozen tracks, with convolution reverb and a mastering search, in seconds, many times over during evolution;
  • parse audio files, scripts and blueprints that come from other people and from assistants;
  • serve a studio natively and in a browser, an HTTP API and MCP, from one session;
  • listen: run CLAP and the AudioSet tagger, which earshot, the library that calibrates them, does in Python with PyTorch.

It also has to install as a program a musician downloads and runs, not as a development environment.

Decision

claudius is written in Rust throughout, as one Cargo workspace:

  • the engine (DSP, theory, rendering, the critic) uses rayon for parallel rendering and evolution;
  • the server uses tokio and axum, and the MCP tools rmcp;
  • the studio is egui, compiled natively and to WebAssembly (0008);
  • the scripting language is Rhai, which is itself written in Rust (0004);
  • audio decoding is symphonia, with ffmpeg only as an optional fallback;
  • earshot is ported to Rust (crates/earshot): its DSP reimplemented, the two models run as ONNX exports on ONNX Runtime through the ort crate, linked statically. Nothing needs Python at runtime.

Rejected: keeping earshot in Python and calling it as a subprocess, which would make every user install a Python environment with PyTorch, add seconds of startup to every verdict, and split the program in two. A C++ engine (a JUCE or similar stack) would be as fast but give up memory safety where claudius parses untrusted input, and make the build harder to keep portable. A JavaScript engine sharing code with Strudel would have made the web studio simpler and offline rendering of long, dense songs much slower.

Consequences

  • One language, one toolchain (rust-toolchain.toml), one dependency audit (cargo deny), and binaries that run without an interpreter. The claudius program carries the whole engine, the server and the studio.
  • The wire types (claudius-api) are shared by the server and the WebAssembly studio, so they cannot drift.
  • Parsing audio, scripts and JSON happens in memory-safe code; the remaining C is ONNX Runtime (running pinned, hash-checked models) and ffmpeg when it is installed.
  • The port of earshot is a maintenance cost: it has to match the Python original, which crates/earshot/tests/parity.rs checks against fixtures the Python version wrote. Regenerating those fixtures is the one task that still needs a Python environment, and only for developers.
  • ONNX Runtime arrives as a prebuilt static library downloaded at build time by ort. There is no build for Intel Macs, so that release target is marked experimental and fails for now.
  • Compile times are long (the dev profile optimises everything, because tests render audio), and contributors need to know Rust, which is a higher bar than Python for people who come from music.

0003 The blueprint is the song

Status: accepted

Context

A claudius song is edited from many directions: a script changes the tempo, the studio paints drum steps, mutation swaps a bass style, an assistant rewrites the form, analysis of an audio file produces a new song. It has to be saved, undone, printed as a script and evolved, and two versions of it have to be comparable.

A DAW stores the arranged session: tracks with their notes and clips. That is what it plays, and it is the obvious thing to store. But a session records results, not decisions. A bass line stored as 144 notes no longer knows that it was an off-beat house bass over a progression; changing the key means moving every note; trying another style means writing it again by hand; and a mutation operating on notes can only nudge notes.

Decision

A song is its Blueprint (crates/claudius/src/model.rs): the decisions a producer makes, stored as data. Tempo, key and swing; progressions as Roman numerals; the form; drum lanes as step patterns; each melodic part as a recipe (a role, a style, a register, a density and a seed of its own); pattern tracks as the code that makes them; every sound; the mix. The arranged Project with its notes and clips is derived from it by compose::arrange, deterministically, every time it is needed, and thrown away after rendering.

The blueprint is what is saved (blueprint.json), what undo restores, what scripts print and edit, and what mutation and crossover change. Notes are stored in a blueprint only where no recipe produced them: hand-written or analysed notes in a part’s notes, and the drum steps.

Rejected: storing the project as the truth, for the reasons above, and storing both, which would leave two copies of the song that drift apart the first time one is edited.

Consequences

  • Edits happen at the level a producer thinks at. A new seed is a new bass line in the same style; a new key moves every part, because progressions are numerals and parts are written from them; a style change rewrites a part in a sentence. Mutation operators are a few lines each (Evolution).
  • A blueprint is small: about 30 KB of JSON for a full house song, against about 300 KB for its project. Undo keeps 200 whole blueprints, and evolution hashes them to skip duplicates.
  • A song can print as a script that runs back into itself (Patterns and the script engine), because every field is a decision a script function can state.
  • The notes of a generated part depend on the writer’s code. When theory code changes, an existing blueprint renders differently: a saved song is not frozen across versions of claudius. The generator snapshot tests make such changes visible in review, but they cannot keep old songs as they were.
  • Single notes of a generated part cannot be edited in place. To change one, the part has to become hand-written notes or a pattern track, and then it no longer follows the key and style.
  • A track plays the same way in every section it is in; there is no per-bar arrangement edit. A variation takes a second track.
  • Everything that derives the project must be deterministic, which shapes the random number generator, the seeds stored in parts, and the hash-based randomness of patterns (Architecture).

0004 Rhai with Strudel-style patterns

Status: accepted

Context

claudius needs a language in which a song can be written, read and edited, by people and by assistants:

  • Patterns. Drum grooves, bass lines and chord rhythms are cyclic. Live coders have a compact, proven notation for them: TidalCycles’ mini-notation, as Strudel uses it ("bd*4, [~ cp]*2, hh*8?"). Many musicians who code already know it, and assistants have seen a lot of it.
  • Song edits. Tempo, key, progressions, parts, mix, form: the decisions in a blueprint, named as functions.
  • A sandbox. Scripts come from assistants and from files people share. They must not read files, open sockets, run forever or exhaust memory.
  • Embedding. The language runs inside the Rust engine, in the server’s process, many times a minute.
  • Printing. Every song must print as a script that runs back into itself (0003), so the language has to be able to state everything a blueprint holds.

The candidates were JavaScript (Strudel’s own language, through QuickJS or V8), Lua, a language of claudius’ own, and JSON commands only.

Decision

Scripts are Rhai, with Strudel-style mini-notation inside strings and pattern methods named after Strudel’s (fast, every, sometimes, struct, off, superimpose …). One cycle is one bar. Song edits are plain functions (tempo(), prog(), drum(), part(), mix(), track(), form()). Patterns are immutable values that remember the code that built them, so a song’s pattern tracks print exactly as written.

Rhai is written in Rust, embeds with a few lines, looks enough like JavaScript that assistants write it well, and has the limits a sandbox needs built in (operations, call depth, string and array sizes, a progress callback for a time limit, module resolution that can be switched off); it has no file or network functions unless the host registers them. Patterns are claudius’ own implementation (pattern/), not a binding to Strudel.

Rejected: JavaScript, because embedding a JS engine brings a large C or C++ dependency and makes the sandbox the host’s job, and because Strudel’s semantics (per-event controls, fragments, its scheduler) do not map onto a blueprint anyway. Lua, for similar embedding reasons and an unfamiliar syntax for most users. A language of our own, because the general-purpose parts (variables, loops, closures, maps) would have to be built and documented. JSON commands only, because nobody can read or write a song in them; they remain available as the HTTP API.

Consequences

  • Scripts are safe to run from anyone: the limits and the work budget for patterns are enforced by the engine, and fuzzed weekly (Security).
  • Strudel and Tidal users recognise most of it. What differs includes no polymeter ({} is a plain group), events returned by onset rather than as fragments, track settings (.room(), .lpf()) that apply to a whole track instead of per event, and one cycle per bar; Coming from Strudel covers the rest.
  • Closures print by calling them once on a placeholder pattern, so |x| x.add(up) prints as |x| x.add(7): the value is kept, the variable name is lost.
  • Rhai is stricter about types than JavaScript: ply(1.5) is Function not found: ply (Pattern, f64), a common first error that Errors and limits explains.
  • Rhai is slower than a JIT-compiled language, which does not matter for scripts that describe songs but rules out writing DSP in it.
  • Maps are written #{ k: v }, which is Rhai’s own and has to be learned.

0005 One session, many clients

Status: accepted

Context

The studio exists as a native window and as a web page, and assistants edit songs over MCP. The experience claudius aims for is a person listening in the studio while an assistant works, hearing every change and stepping in. That means several clients edit one song at the same time, and each must see the others’ changes quickly.

The options were to give each client its own engine and synchronise them, to merge concurrent edits with a CRDT or operational transforms, or to keep exactly one song and make every client a view of it.

Decision

A process holds one App (crates/claudius-server) with one Session: the song, its undo and redo stacks, the latest render and verdict, a log, and at most one running job. Every client goes through it:

  • the studio, native and web, uses the HTTP API only, long-polling GET /api/state?since=N and sending commands;
  • MCP over HTTP calls the session in process;
  • claudius mcp, started by a desktop assistant, first looks for a claudius already running on the port and drives it through its HTTP API; only if there is none does it start a session of its own. One older than itself it does not drive, since its tools would ask for what that one does not know: it and the studio both step round it, to the ports after it, where they find each other.

Edits are serialised by a mutex, and each runs on a copy of the current blueprint and replaces it on success. Every change bumps a version that long polls wait on. Jobs (renders, mutation, evolution, saves) run one at a time, and a render or a save asked for during a job runs after it.

Rejected: an engine per client, which would leave the person and the assistant on different songs the moment one of them edits. Merging concurrent edits, which suits documents edited by many people offline and is far more machinery than one person and one assistant need, when serialising edits gives a clear “last edit wins, nothing is lost to undo”. WebSockets for updates, which would add a protocol for what a long poll does, and long polls pass through tunnels and proxies without configuration.

Consequences

  • There is no synchronisation protocol and no conflict to resolve: whoever edits second edits the result of the first. Undo is shared too, so you can take back an assistant’s change from the studio with Cmd+Z.
  • The studio is an ordinary HTTP client, which keeps the API complete: anything the studio can do, curl, scripts and assistants can do.
  • One process holds one song. Working on two songs means two processes on two ports.
  • One job at a time: while an evolution runs, a render or a save waits for it, and a second mutation is refused with busy.
  • Optimistic edits in the studio can be refused by the server, and then flash back to the server’s state.
  • A client holds a connection open per long poll, up to 20 s (or the timeout it asks for), which is cheap for the handful of clients a session has and would not scale to many.
  • When claudius mcp finds nothing on its port (the studio runs on another port, or was started after the assistant), it starts its own session without failing, and the assistant edits a different song from the one on screen. stderr says which way it went, but people rarely look there. A claudius that asks for a token the assistant was not given is recognised, and claudius mcp fails with a message instead of starting a second session.

0006 A critic with ears

Status: accepted

Context

claudius revises songs: evolution tries dozens of variations, and assistants edit a song, listen and edit again. Both need feedback after every render, faster than a person can listen and in a form they can act on.

Measurements alone (loudness, spectrum, width) say whether a master is technically sound, not whether a house track sounds like house. A learned judge can say the latter, but every model can be pleased without the music getting better: optimise against it and you get songs that score well with it. earshot, the library claudius listens with, warns about exactly this. No model exists that rates music quality with clear licences and data behind it.

Decision

The critic (judge.rs, ears.rs) combines evidence that cannot all be gamed at once:

  • mix: model-free meters on the master (loudness and true peak against the targets, energy per band against a healthy range, stereo width, a mono low end);
  • arc: whether section loudness follows the energy the arrangement intends, and whether the drop is clearly louder than the break;
  • theory: checks on the notes themselves (lead in key and on chord tones, singable range, bass on the roots, smooth voice leading, a sound form);
  • ears, when earshot’s models are installed: one CLAP embedding of the master, scored with earshot’s calibrated z-scores against the genre and the genres it is confused with, and against “professionally mixed” versus six named flaws; with reference tracks, typicality among them.

Every problem is an issue with a severity, a sentence, and a target naming where the fix lives (band:sub+, part:lead, form), which evolution uses to choose what to mutate and assistants read as advice. Two readings are held out: the realness estimate and the AudioSet tags are reported and never scored, so that a rising score without rising held-out readings shows the scored parts being gamed. Without the models, the critic works with the first three components.

Rejected: listening by people alone, which cannot drive an evolutionary search. Meters alone, which cannot hear genre. Scoring the AudioSet tags or realness too, which would leave nothing held out. Training a model of our own, for lack of data we could license.

Consequences

  • Verdicts explain themselves: “the drop is only 2.1 LU louder than the breakdown (aim for 3-7)” is something a person or an assistant can act on, and the targets let evolution act on it automatically.
  • The critic works offline and without the 785 MB of models, with less to say.
  • The ears are only as good as CLAP on music: earshot validated it for matching sound effects, house, tech house and techno sit close together for it, and fully synthesized songs read only marginally professional. Genre and production scores are hints.
  • The healthy band ranges are one target for every genre, so dark genres such as lofi collect issues that are style, not fault.
  • A high score means no measurable problems and a confident genre reading. It does not mean a good song, and the docs say so wherever scores appear.
  • Evolution judges previews (the build-up and first drop), which keeps it affordable but misses problems elsewhere in the song.
  • The models cost a download, about half a gigabyte of memory, and a few seconds to load; verdicts made before they load have no ears.

Amendment: stock music

Status: accepted

Verdicts of 90 and more came out for songs whose own sounds like line read “inspirational corporate background music” or “playful children’s piano music”: the genre was a 0.15 share of the weight, and its margin was taken only over the genre’s named neighbours, so a trip-hop song that sounded like an advert’s background music still beat lo-fi hip hop and scored well.

Every genre is now also measured against five readings of stock library music (ears::STOCK), and when the strongest of them is plausible (z 2.5 or more) and within one z of the genre’s reading, the verdict loses up to 40 % of itself, in proportion: total × (1 − 0.4 × clamp(stock_z − genre_z + 1)). Scores of songs that sound like their genre are unchanged; songs that sound as much like stock music as like their genre drop by up to 40 %. The cut is a gate on the whole verdict rather than a bigger genre weight, because sounding like stock music is a failure of the song, not one measure among others.

0007 Which samples we ship

Status: accepted

Context

Real audio (0001) needs recordings, and people publish what they make with claudius. Free samples are plentiful; samples whose licence is clear are not. In the sets live coders use every day:

  • many drum machine sets trace back to anonymous uploads with no stated terms;
  • TidalCycles’ Dirt-Samples has no licence file, and some of its folders are cut from commercial records;
  • some well-made libraries are free to use in music but forbid redistributing the samples themselves (Audio Realism’s TR-909 pack, the jRhodes3d Rhodes);
  • share-alike licences can reach into the music made with the samples.

Putting samples in the repository or the release archives would also make claudius a redistributor, and the repository huge.

Decision

claudius ships no samples. Sample packs are installed on demand from their authors’ own hosts, at pinned revisions, by claudius setup or claudius-packs install (crates/claudius-packs). The curated registry records, for each pack, its licence, its credit line, whether credit is required, and a licence_note quoting the licence text and where it was read.

  • The default set (14 packs, 162 instruments) contains only packs whose licence lets you make and publish music with them, with at most an attribution: CC0, public domain, the Unlicense, CC BY, and free-for-music licences such as jRhodes’ and Audio Realism’s. Packs that forbid redistribution are acceptable because each machine downloads them from their author.
  • Credits are automatic: a song that plays CC BY packs gets a credits.txt naming exactly the packs it used.
  • Opt-in packs, whose licence is unknown or carries conditions (tidal-drum-machines, dirt-samples, mridangam under CC BY-SA), install only with --accept-licence and print a warning.
  • User maps added with add-map record the licence the map or its repository declares, or unknown with a warning that also appears in the credits of every song that uses them.
  • Apple Loops are read where GarageBand or Logic installed them, under Apple’s licence for using them in your own music, and never copied, except the drum one-shots claudius cuts into its cache.
  • Where no clearly licensed recording exists, claudius does without or builds one: the choir is a single sung vowel, CC0, played as a five-voice ensemble, and the uzu kit’s processed Amen break is left out.

Rejected: bundling packs (redistribution, and a gigabyte-sized repository); enabling the popular unlicensed sets by default (users would publish samples they have no right to); limiting claudius to CC0 (it would lose the best piano, the electric pianos and the acoustic kit, all CC BY).

Consequences

  • Music made with the default set can be published, with the credits claudius writes.
  • Every licence decision can be checked by reading registry.json, without repeating the research.
  • The first run downloads about 2.2 GB from a dozen hosts, and claudius depends on those hosts staying up. GitHub-hosted packs are pinned by commit; the two archives (the 909 and the FreePats organ) are not pinned by hash, so a compromised host could serve different audio (Security).
  • Strudel’s default drum-machine banks, which Strudel users expect, are opt-in.
  • The library has gaps where no clearly licensed recording exists: no multi-sampled choir, no vocals with words, a piano cut to 5 of its 16 layers for size.
  • Adding a pack means reading its licence at the source and quoting it (Sample packs).

0008 egui for native and web

Status: accepted

Context

The studio is DAW-like: an arrangement of section blocks and track rows, a step sequencer, a mixer with faders and meters, a waveform with a playhead, a script editor, a verdict panel. It has to run as a native window on the user’s computer (claudius studio) and as a web page (claudius serve), including through a tunnel on a phone or a laptop elsewhere. Almost all of it is custom drawing; few standard widgets fit.

The rest of claudius is Rust (0002), the team is small, and the server’s types should be the UI’s types.

Decision

The studio is written once with egui and eframe (crates/claudius-ui), compiled natively with the glow backend and to wasm32-unknown-unknown with trunk. It depends only on claudius-api and talks to the engine only through the HTTP API (0005), so the same code is a native window or a web page. Playback is rodio natively and an HtmlAudioElement on the web. The widgets that matter (faders, knobs, meters, the arrangement grid) are drawn with egui’s painter, and a built-in mock server lets the studio run, and be developed, without an engine.

Rejected: a web front end in a JavaScript framework with a native shell around it, which would mean two languages, the wire types written twice, and a build pipeline per language. A native toolkit per platform, which would triple the work and still leave the web. Rendering the UI on the server and streaming it, which does not work offline or through slow tunnels.

Consequences

  • One studio for both targets, in one language, sharing types with the server; a change shows up in the window and the browser at once.
  • egui redraws the whole UI each frame it paints, so the studio schedules repaints itself (while playing, while a job runs, while waiting on the network) to stay idle otherwise.
  • Accessibility is weaker than native widgets or HTML give: screen-reader and keyboard support are limited to what egui provides. Text input and editing are egui’s too, which is enough for the script editor but not a code editor.
  • The web build is a WebAssembly bundle of several megabytes that has to download before the studio appears.
  • The two audio paths differ: natively the 24-bit WAV is decoded and played sample-accurately; on the web the browser plays the MP3, and a browser blocks sound until the user clicks.
  • The native window cannot send a token, so it cannot open a token-protected claudius; claudius studio says so and points to the browser, which can.
  • Clippy has to run separately for the wasm target, because native builds never compile the cfg(target_arch = "wasm32") code.

0009 Releases through pull requests

Status: accepted

Context

claudius is published as binaries for several platforms, with a web studio inside, a changelog, an install script, a Homebrew formula and a website. Every release has to bump the version in every manifest and Cargo.lock, write the changelog, tag the right commit, build five targets, publish checksums and provenance, and update the formula and the site. Done by hand, that is a checklist of a dozen steps where any skipped one ships something wrong. Contributors should never have to touch versions, and the people using claudius should be able to verify what they download.

Decision

A release is a pull request, and merging it is what releases:

  • Pull request titles are Conventional Commits (feat(script): add euclid() to patterns), checked by pr-title.yml. Pull requests are squash-merged with their title as the commit message, so main’s history is one line per change.
  • Starting a release is running the release-pr.yml workflow with a bump (patch, minor, major or a version). It runs cargo xtask release prepare, which bumps the workspace version, the path dependencies and Cargo.lock, turns the commits since the last tag into a changelog section with git-cliff (adding anything written under “Unreleased” by hand), and opens the pull request release: vX.Y.Z from release/vX.Y.Z. The notes can be edited on that branch before merging.
  • Merging pushes the new version to main, which runs release.yml: it checks that the version is unreleased and has a changelog section, builds the web studio and the archives for each target, checks and collects their SHA-256 sums, attests their build provenance, creates the GitHub release as a draft and publishes it (which creates the tag on the merge commit), then updates the Homebrew tap and deploys the site. Run again by hand, it retries a release that failed halfway, replacing the draft.

The details are in Releasing.

Rejected: tagging releases by hand, which is where versions and tags drift apart; releasing on every merge to main, which would ship half-finished work and make the changelog noise; a third-party release bot, which would put a dependency with write access in the most sensitive workflow when a few hundred lines of xtask and two workflows do the job and can be read.

Consequences

  • Every release is reviewed like any other change, with its notes in front of the reviewer, and CI runs on it.
  • Nobody bumps versions by hand, and the changelog writes itself from titles people already had to write.
  • Archives can be verified: SHA256SUMS for integrity and gh attestation verify for where they were built. The install scripts check the sums.
  • Pull request titles carry weight: a vague title becomes a vague changelog line. The title check stops malformed ones, not uninformative ones.
  • Squash merging loses the commits inside a pull request from main’s history.
  • A pull request opened with the workflow’s own token starts no workflows, so the release workflow starts CI on the release branch itself, or opens the pull request with a RELEASE_TOKEN when one is configured.
  • Two targets are experimental: Intel macOS (no ONNX Runtime build exists for it) and Windows (not verified yet). Their failures leave them out of a release instead of stopping it.
  • Fixes go into the next release only; there are no maintenance branches for older versions.

0010 Samples from online libraries

Status: accepted

Context

Many genres are built from samples: trip-hop from slowed breaks and film-score strings lifted off records, boom bap from chopped soul and jazz, jungle from breaks cut up and replayed, filter house from disco loops. Synthesizers and multi-sampled instruments (0007) cannot stand in for them, and songs built without them sound clean and polite, the stock background music the critic now catches (0006, amended).

The places people hear records online cannot supply them:

  • YouTube’s terms forbid downloading and automated access, except through YouTube’s own features or with its written permission, and nearly everything on it belongs to someone;
  • Spotify and Apple Music stream behind DRM, and their terms forbid copying it out, previews included;
  • SoundCloud’s tracks belong to their uploaders unless they chose a Creative Commons licence, and its API registers applications only for paying Artist Pro subscribers, under terms of its own;
  • for all of them, a sample needs a licence from whoever owns the recording and from whoever owns the composition.

Some libraries do exist to be used: Freesound (sounds under CC0 or CC BY, recorded and uploaded by their authors), Wikimedia Commons (reviewed recordings under free licences, and records old enough to be in the public domain), ccMixter (stems and a cappellas shared to be remixed), and Openverse, which indexes Freesound, Commons and Jamendo and answers without a key.

Decision

claudius samples (claudius_packs::online) searches Openverse, Wikimedia Commons and ccMixter, and downloads into a samples folder of its own, with a .json beside each sound naming its title, author, licence and page.

  • Licences follow 0007: CC0, an author’s public domain mark and CC BY are kept; recordings in the public domain by age (public domain in the United States, while a tune on them may still be protected where copyright lasts 70 years after the composer’s death) and CC BY-SA sounds come only when asked for (--us-public-domain, --share-alike); non-commercial and no-derivatives licences never come.
  • Suspect uploads, whose titles or tags say they were cut from someone’s record, are left out: an uploader cannot license a record they do not own.
  • Credits are automatic: a song that plays a downloaded sound names it in its credits.txt, with the licence and the page.
  • No keys: Openverse’s anonymous limits (20 searches a minute, 200 a day) are enough for a person searching, and nothing claudius ships holds a secret.

Rejected: grabbing from YouTube, Spotify, Apple Music or SoundCloud (their terms, and the records’ owners); a Freesound key in claudius’ source (Freesound asks that keys stay secret, and a shared one would hit its daily limit for everyone); the Internet Archive’s Musopen recordings, which it offers only as ZIP archives of whole albums.

Consequences

  • Sampled genres can be built from material people may publish, and claudius says where every sound came from.
  • Openverse serves Freesound’s previews, MP3s of about 128 kbps; the originals need a Freesound login (OAuth2), which claudius does not ask for.
  • claudius depends on the libraries’ APIs staying up and keeping their shape; a library that does not answer is reported and the others still answer.
  • A licence is what the uploader chose. The suspect filter catches only uploads that say what they are, so a sound to publish is worth a look at its page.

0011 Finding by meaning, on the device

Status: accepted

Context

The command palette (Cmd+K) found the studio’s actions by their names and a few words listed for each. People say what they want in words of their own (“make it sound better”, “sing over it”, “go back”), and the palette should find what they mean. It has to do so on the computer claudius runs on, a weak laptop with integrated graphics and a browser tab included, without sending the words anywhere. Two later features will ask the same of it: finding what was done to a song from a description of it, and commands in plain words, which need a model that turns words into claudius’s commands.

These were the options:

  • A sentence transformer (MiniLM, bge-small: 22 to 33 million parameters, run with ONNX Runtime). It finds meaning well, but takes tens of milliseconds a query on a weak processor and 30 to 130 MB, and ONNX Runtime is not in the web build.
  • A vector database extension (sqlite-vec). It is C, reached through FFI and built for each target, the web too. claudius’s lists hold hundreds of entries, which a flat scan searches exactly in microseconds.
  • Static embeddings (Model2Vec’s potion models, MIT). They hold a vector for each word piece, learned from a sentence transformer, and a phrase is the mean of its pieces’ vectors. Embedding is a lookup and a sum, with no neural network run at all.
  • A small function-calling model (Cactus’s Needle, 121 million parameters, Apache-2.0). It turns words into commands rather than searching, and it is far heavier than search needs.

Decision

claudius-intent, a crate of plain Rust whose only dependencies are serde and serde_json, finds by meaning:

  • Static embeddings: potion-base-8M (29,528 pieces, 256 numbers each), from a pinned revision checked against its hashes. claudius keeps it as a file of its own, each number a byte with a scale for each vector: 7.9 MB, read in a few milliseconds, with every cosine as it was to a hundredth.
  • A flat index in memory (Index): the exact cosine to every vector. There is no approximate index until a list grows past tens of thousands.
  • Names and meaning together (Finder): a name that matches is found at once and is never outranked by a guess, meaning finds what names miss, and an action both find ranks highest.
  • Where the studio’s commands go: a server’s session answers the palette (Host::find, GET /api/find), and the demo answers on the studio’s own thread, since its engine may be rendering for seconds when a search takes microseconds. Natively the model downloads the first time the palette is typed in, the demo fetches the site’s copy, and until it is there names find everything.
  • Evals: tests/meaning.rs holds the phrasings people use for each action, in one set the ranking was tuned on and two held out from it, and fails when fewer than 95% of the first set (85% of the held-out ones) find their action among the first three.

Consequences

  • Search is fast and light everywhere. On an Apple M-series laptop a search takes about 50 microseconds, and embedding the actions, once as the model comes, a third of a millisecond. It needs no graphics card and no ONNX Runtime, and it adds 8 MB to the web demo, fetched only once the palette is used.
  • Static embeddings know words, not sentences. Word order is lost (“undo the redo” reads as “redo the undo”), and so is negation, and a word the vocabulary has never seen counts for nothing. Matching names and the words listed for each action make up for much of it, and the evals keep count of the rest.
  • The model knows English only.
  • Each phrasing added to the catalogue or to the evals is data for a later fine-tune or a larger model. The evals stay as they are when the model changes, and a model that does worse on them does not ship.
  • Searching a song’s history needs nothing new: the same index over its changes, each described in words. Commands in plain words need a function-calling model, which is a decision for a record of its own. Such a model must ask claudius for facts (the tracks, the history) rather than guess them, and claudius shows the person what it understood and acts only once they confirm.

0012 A history that only grows

Status: accepted

Context

Undo and redo were two stacks of whole blueprints, at most 200, which a change pushed onto and undo popped. They knew nothing of what a change did beyond its label, and they forgot. Undo past the 200th was gone, a change undone and replaced by another was gone, and a song closed and opened again had no undo at all.

What people want of a song’s history goes further:

  • finding what was done from words of their own (“when did we add the whistles?”), with on-device search (see 0011);
  • going back to before a change: undoing it and everything since, in one step, with redo bringing them back;
  • in time, more than one person editing one song at once, whose changes merge, which is what a CRDT does.

The simplest history keeps snapshots of the song after each change. A snapshot says nothing about what changed, so it cannot be searched by what was done, and two people’s snapshots cannot be merged. A CRDT needs a log of operations: each with an id no other replica gives, the operations it was made on, and what it changed, at a grain fine enough that two people’s changes to different things do not collide.

Decision

claudius_session::history keeps every change made to the song as an operation in a log that only grows, beside the undo and redo stacks, in both the server’s session and the browser’s demo:

  • An operation has an id (the session’s own random id and its Lamport time), the operations it was made on, when it was made, its kind (an edit and the command that made it, an undo or redo of an edit, or a going back to before one), what undo calls it, what it did in words, and what it changed in the song.
  • What changed is the paths of the blueprint’s JSON whose values differ, each with its value before and after. A list of named things (tracks, drum lanes, sections) is keyed by name, with its order as a value of its own, so a change to one track names that track, whatever happens to the others. Another list changes by place, appended to or cut short, or whole.
  • Another song in the song’s place (a new song, one opened, a recording remade) is one change of the whole song, and so is undoing it. The song’s own history begins at the edit that put the song as it is in its place, the latest one undo can still take back, so the undos and goings back since replay with the steps they took.
  • Undo, redo and going back are operations too, whose changes take the song back or forward. Nothing in the log is ever taken out or rewritten. Files the song plays that moved (a save copies its takes into its folder) are an operation of their own, which changes neither undo nor redo.
  • The song follows from the log: the changes of every operation, applied in order to no song at all, make it. Saving writes the song’s own log into its folder (history.jsonl), and opening the folder replays it, which brings the undo and redo steps back as they were. A song edited by hand since then has the difference recorded as an edit of its own.
  • The undo stack keeps whole blueprints, as before. The log could rebuild them, but the stacks undo in a moment, and they cannot fail to restore exactly what was there.
  • The state lists the last 200 changes, each with its words and whether going back can reach it. go_back takes the song to before a change, and the MCP tools history and go_back let an assistant do the same.

Consequences

  • What was done can be found again, by the words each change is described in (“added the whistle track (lead), playing the synth whistle; tempo 124 to 128”), and the palette can search them by meaning, as it searches its actions.
  • A CRDT has what it needs from the log: ids every replica can order, the operations each change was made on, and changes at the grain of a setting. Merging two replicas’ logs is still to come. Most paths merge as registers, last writer wins. The order of a list and a list changed by place need a sequence of their own, and claudius’s lists of named things already have the names it would hold.
  • The log costs memory and disk: a new song’s operation holds the whole song, and opening another holds both. A song’s own log, as a folder keeps it, starts at the operation that began the song.
  • Going back reaches only the changes undo can still take back: one undone and replaced, or more than 200 ago, is in the log and can be found, but the song goes back to it only by hand. Rebuilding any earlier song from the log is possible, and is for later.
  • The demo’s project download, which the app opens, does not carry the history yet: its blueprint plays the samples from the zip, where the page’s history plays them from the page.

0013 Requests in plain words, read on the device

Status: accepted

Context

People ask the command palette for changes in their own words: “lets increase overload for guitar track to 95%”, “swap all toms for snares”, “cut the guitar from 1:02 where drums start”, “undo the last 5 commands”, “go back to before we added the whistles”. The palette should make them on any laptop and in the browser, without a large model, and never before the person has seen what claudius understood. That means a button that says what it would change, from what to what, and a button for each reading when the words could mean more than one thing. How well requests are read has to be measured, on requests phrased in many ways, with a set of examples that keeps growing and that could one day tune a model.

A language model that calls tools would read requests best. The small ones made for devices are still tens of megabytes and some hundreds of milliseconds a request on a laptop, which is for later (see Consequences). What runs now has to answer as the person types.

Decision

claudius_intent::ask reads a request in three steps, in microseconds, in the engine (a server’s, and the demo’s in the page):

  • What it asks: an undo, a redo, going back to before a change; a track’s level, drive, reverb, delay or pan; the tempo or the key; a track’s sound swapped, cut from a time, muted, unmuted, soloed or removed. This is read from the words each kind is asked in, each with how surely it tells the kind, and from the example requests nearest it in meaning (data/asks.jsonl, through the palette’s embedding model, 0011). The meaning is read without the words that name a track, which tell what a request acts on, not what it asks. A word that surely tells a kind leads, and the nearest examples break ties; where no word does, the examples decide. Undo, redo and going back are only read from words of their own, since nothing else needs naming for them.
  • What it acts on, and by how much, read off the song by rules. The tracks it names: by name, role or sound, the drums as a group, tracks named together as one, “everything” but what comes after “except”. Its numbers and their units: 95%, -6 dB, 128 BPM, 1:02, “by 3”, “x3”. Which way: “louder”, “too dry”, “the bass is a bit loud”. The sound to swap to, the section a time falls in, and the change in the history it names.
  • What claudius would do: the commands, and what they do in words, from the song’s values now to those asked (“Increase guitar’s drive from 20% to 95%”). A word that several tracks answer to gives a proposal for each, and tracks named together give one. A reading that would change nothing (muting a muted track) proposes nothing, and a reading far less likely than the best is not offered beside it.

The palette shows the proposals before the actions, and nothing is done until the person picks one. A proposal’s edits go as one together command, which the history records as one change named for what the button said, so undo takes it back in one step. Undo, redo and going back go as they are.

The evals (tests/asks.rs) read every example on one song and check the first proposal’s kind, tracks, numbers, time, sound and change, by words alone and with the model. They also check that an action’s name, and what claudius cannot do on a song, propose nothing, since Enter does the first row.

The examples are in three sets. The first is what the readings learn from. The second is held out of what they learn from. The third, later, is requests written after the readings were last tuned. A later set is scored once, before anything is tuned to it, then its misses are fixed and it joins the held out. These are the scores of four rounds of new requests, before tuning to them:

roundrequestsby wordsby meaning
14126 (63%)30 (73%)
24132 (78%)35 (85%)
33935 (90%)36 (92%)
43428 (82%)30 (88%)

Round 4 asked more tersely and casually than round 3 (“kick down a bit”, “just vocals”, “make it 128”), and one of its misses was a mistake in the example itself. After the fourth round, all 330 examples read right both ways.

Consequences

  • Requests are read in tens of microseconds on any computer and in the browser. Every one is confirmed by a button that says what it does, from what to what, so a misreading costs a glance, not a change.
  • The readings are rules and examples, so a request in words they have not met is read wrong or not at all. Each round of new requests showed it: one in ten to one in three were missed before tuning. The examples are the remedy. A request people phrase in a new way goes in as later, is scored, and is then fixed.
  • A request for two things at once is read as one of them. A request for taste rather than a setting (“make it groovier”) finds actions, Improve the song among them, rather than edits.
  • A small model that turns requests into tool calls on the device reads what the rules cannot: claudius teaches Cactus’s Needle 3 to, and asks it what the readings read nothing of (0014). The rules stay, to ground its calls in the song and to answer until it has downloaded, and the examples measure both.

0014 A small model taught to read requests

Status: accepted

Context

The readings of 0013 are rules and examples. They read most requests in microseconds, but a request in words they have not met is read wrong or not at all: of 39 requests written after they were last tuned, they read 32. A model that has learned a language reads words it was not shown. It has to run on the person’s computer, as the readings do, on any processor, and it has to be taught there too: claudius is Rust from end to end (0002), with no Python to install, to run a model with or to teach one with.

Cactus Compute’s Needle 3 is made for this kind of work. Its 121 million parameters read a request and the tools it is given, and write the calls. Its weights are 35 MB, in two and four bits, under the Apache 2.0 licence, and needle-infer runs it in plain Rust, in the browser too (MIT). Untaught, it read 27 of 330 example requests on claudius’s tools (8%), nearly all of them undos.

Decision

claudius teaches Needle 3 to read its requests, and asks it only about what the readings read nothing of (claudius_intent::needle, teach).

  • What it reads: sixteen tools, one for each thing a request can ask, named as people say it (set_volume, with way louder or quieter, by_db and to_db; swap_sound; cut_track from a time), each argument in the request’s own words, its tracks as said (“the toms”, “everything but the vocals”). They are 756 tokens, read once when the model loads and kept, so a request costs only its own tokens and its answer; the tools, a request and its answer fit the 1024 positions the model attends to.
  • What it is taught: lessons made from 245 ways of saying the requests, each said 20 times with other tracks, numbers (in digits, or in words: “seven”), sounds, keys and times, and requests no tool serves (an action’s name, talk, a question, something asked not to be done), one lesson in ten, which call nothing (teach::lessons). Each answer is a line of reasoning that quotes the words each argument comes from, then the call, as Cactus teaches Needle.
  • How it is taught: claudius-tune, in Rust, runs Needle 3 in candle on the CPU, on its weights as needle-core reads them; its forward pass gives needle-core’s logits to 1.3·10⁻⁵ of their size (claudius-tune parity). Only low-rank adapters are taught (rank 16, beside the five projections of each block’s attention: its queries, keys, values, gate and output), with the loss on the answer alone. The model is run to 8 of its 20 layers, a depth Needle 3 is made to answer from, at less than half the cost. 5,456 lessons, one in ten held out, four times over: 47 minutes on a laptop’s ten cores. The adapters are 1.6 MB in half precision and built into claudius (data/needle-adapters.safetensors), with a fingerprint of the tools they were taught with.
  • How claudius reads with it: on a thread of its own, the model downloads once (from Hugging Face, at a pinned revision, checked by its size and SHA-256), reads the tools, then reads the latest request the palette asks about. claudius runs the model a token at a time itself, needle-core’s kernels with the adapters added, and decodes greedily, the call held to the tools’ grammar. It refuses a call that does not fit its tool (words where a number goes), one whose reasoning quotes no words the request says, or words it does not, and a reasoning that runs past 48 tokens, as a model’s does that cannot tell what is asked. A call it keeps is said again in the words the readings read (“set the guitar’s drive to 95%”, teach::said), and the readings ground it in the song as they ground a request: its tracks, its values from what the song has now, its change in the history. The proposals say they are the model’s (by_model), and nothing changes until one is picked.

The evals (tests/asks.rs, with the model’s file) read every example with the model, alone and where the readings read nothing, and 30 requests that ask for no change (a question, talk, an action’s name), for which it should offer nothing. tests/needle.rs holds claudius’s step of the model to needle-core’s.

requeststhe readingsthe model alonethe readings, then the model
every example369362273363
round 5, written after the readings were tuned39322333

Where the readings read nothing, the model offered no wrong change for an example, and it offered a change for 2 of the 30 requests that ask for none (“share this with a friend” as an undo). Its checks refuse one call in eleven, three in four of them wrong, and one of the three changes it would offer for requests that ask none.

Consequences

  • The model reads some of what the readings miss, one of the seven in round 5 (“bring the choir in again”), at a cost of 35 MB downloaded once, about 100 MB of memory, and about half a second for each request the readings cannot read, on one core. Requests the readings read are answered as fast as before.
  • Alone, it reads three requests in five that it was not taught, against the readings’ four in five: it was taught on ways of saying things made from templates, and people’s requests stray further from them. The readings stay first.
  • The example requests are the model’s test, not its lessons, so they measure the readings and the model alike.
  • It reads in the app and not yet in the demo in the browser. needle-infer runs there, but half a second on the page’s one thread would hold the studio up; it needs a worker.
  • A change to the tools needs the adapters taught again: cargo run --release -p claudius-tune -- train needle3.cact crates/claudius-intent/data/needle-adapters.safetensors (--depth, --epochs, --each, --lr), and claudius refuses adapters taught with other tools. claudius-tune check compares the trainer’s model with the app’s, logits and decoding.
  • Teaching it on the example requests the readings learn from, as people wrote them, and on more of its layers, are the next things to try, each measured on a round of requests written after it.

0015 Requests said aloud, heard on the device

Status: accepted

Context

A person making music often has their hands on an instrument or a controller, and saying “mute the drums” is quicker than reaching for the keyboard. The palette reads requests as text (0013, 0014), so a speech model has to turn what is said into text. It has to run on the person’s computer, as the readings and the request model do, on any processor, and in Rust (0002).

Cactus Compute’s Whistle is made for this. It is 16.9 MB, under the Apache 2.0 licence, an encoder and decoder built of Needle 3’s parts: a log-mel front end, a convolution stem, eight encoder blocks, and eight decoder layers that attend to the encoder. It hears seven languages, in up to 30 seconds at once.

Decision

crates/whistle ports Whistle to Rust, on needle-core’s kernels, from Cactus’s JAX reference and its notes on porting the engine. It was checked against whistle-rust, another port, at every stage: the front end’s features to within 10⁻⁶ of them, the encoder’s output to a cosine similarity above 0.999, the decoder’s logits for the same input, and the transcripts.

  • Listening: the palette’s microphone records the default input until a pause of 1.2 s after speech, or for 15 s at most, and sends the WAV file of it to be heard (POST /api/hear).
  • Hearing (claudius_session::hearing): the recording is decoded, mixed to mono and resampled to 16 kHz. Nothing as loud as speech at its loudest (-40 dBFS) is heard as nothing, before the model sees it: a speech model raises the level of what it hears, and hears words in the hiss of a quiet room (“Thank you.”). What is said is cut out of the silence around it, from a tenth of a second before it to a quarter after: a person pauses after clicking, and after a pause of a fifth of a second Whistle heard “mute the drums” as “Mew the drums”. Whistle hears English, the language the readings read, with a beam search of five. It downloads the first time (from Hugging Face, at a pinned revision, checked by its size and SHA-256).
  • Putting it right (claudius_intent::spoken): a word heard that claudius does not know, one letter from one word it does and from no other, is taken as that word, the song’s tracks first, then the words of the studio’s actions and of the example requests (“undu” as undo, “base” as bass when the song has a bass). The readings read times as they are said (“one minute two seconds”) and numbers in words up to 99, for typed requests too.
  • The words go into the palette’s field as if they were typed, with the buttons they find, and nothing changes until one is picked.

The evals (tests/hearing.rs, with a folder of clips) hear each clip as the palette would and count the words missed against the words said. On nine requests said by two of macOS’s voices, and three clips of silence, hiss and noise, 3 of 51 words were missed, and nothing was heard in the silence; with a second of silence before each request, as after a click, 2 of 51. The worst was “more reverb on the piano”, heard as “Moreiver bone the piano”. A 3-second request is heard in about half a second on one core, in about 50 MB. In the browser (site/tests/palette.spec.mjs, with a clip and the model), the palette’s microphone opens, listens until the pause, and puts what was said in its field with the row it finds.

Consequences

  • Saying a request costs 17 MB downloaded once and half a second.
  • A word the model mishears that claudius cannot put right stays wrong in the field, where the person sees it and can type over it. Biasing the model’s search towards claudius’s words (the song’s tracks, the actions, the requests’ words) is the next step.
  • The demo on the website has no microphone: Whistle runs in a page, but half a second on its one thread would hold the studio up, and needs a worker, as Needle does.
  • The clips are said by macOS’s voices, which claudius does not ship, so the eval runs where a folder of clips is given; requests people record of themselves are the clips to gather next.

0016 Settings any later claudius reads

Status: accepted

Context

claudius is released every day that it changes, and people update when they update: one day later, or a year and three hundred versions later. Either way, what they set should still be set. Before 0.6 the settings were kept as each version’s own structs. The studio kept its settings as RON under eframe’s key, and the server kept the voice a pitch check heard as JSON, each read as a whole. A field a later version renamed, or one of a type it changed, made the whole file unreadable, and every setting in it went back to its default.

Decision

Every settings file is versioned and read field by field (claudius_api::settings::Fields, which the browser’s studio has too).

  • A version in every file: a JSON object with "version", the version of its kind that wrote it. A file without one is version 0, as every claudius before 0.6 wrote them.
  • Each field read on its own: a field that is not there, or does not read as its type, is its default alone, and the rest are read as they were. A file that is not JSON at all, cut short or another file, is read as no settings.
  • Migrations in order: a version that renames or reshapes a field changes the earlier versions’ files to its own as it reads them (Fields::rename), from the version before it on, and a test reads a file of every earlier version.
  • What a later version wrote is kept: a field this claudius does not know is written back as it was, so that going back to an older claudius and forward again loses nothing.

The files are:

  • the studio’s settings, in eframe’s storage under settings: a file in the app, the page’s local storage in a browser. The RON a studio before 0.6 kept under eframe’s key is read as version 0, once, and kept as JSON from then on;
  • voice.json, the voice a pitch check heard;
  • telemetry.json, the answer about usage statistics and the day each kind of event last went out;
  • updates.json, whether to update by itself and the day it last looked.

Consequences

  • A setting survives any number of versions. A change to a setting’s shape comes with its migration and a test of the earlier file, in the same pull request.
  • A setting whose meaning changes in a way no migration can carry is a new field with a new name, and the old one is read for as long as a file may hold it.
  • Songs and projects need the same, with a corpus of the files every release wrote: that is a change of its own.

0017 A rebuild that sounds like the recording

Status: proposed

Context

A rebuild (remake with rebuild: true, rebuild.rs) makes a recording again from its parts, so that every note of it can be changed. People who tried it heard almost nothing of the recording in what came out. Three steps lose it:

  • Separation. The stems come from Spleeter (stems.rs, earshot::separate), which scores 5.9 dB SDR on MUSDB18-HQ: much of each stem is the others, and the transcription after it writes that bleed down as notes.
  • Transcription. Basic Pitch (transcribe.rs) writes the bass and the rest as notes. It was made for one instrument at a time: on the 2025 AMT Challenge’s multi-instrument test it scores an F1 of 0.06, where the best systems reach 0.6.
  • Instruments. The rest (keys, guitars, synths, together) becomes one part, played on the genre’s chord sound, so a guitar riff comes back as a pad.

Decision

Rebuild from better parts, and measure every step.

  1. Measure first. An evaluation of the whole rebuild on songs claudius renders itself, whose notes are known exactly: each part’s note F1 (onset, pitch and offset, as mir_eval counts them), and how near the rebuilt song’s chords, tempo and drums come to the original’s. Each later step has to raise these numbers, and CI keeps them from falling.
  2. Separation by HTDemucs, fine-tuned (vocals 9.2, drums 10.1, bass 10.4 and the rest 6.3 dB), in pure Rust as the ears are, in place of Spleeter. Its code is MIT, but on 26 October 2026 its author wrote, in the fork he now keeps, that the licence of its weights is not clear: some of the MUSDB songs it learnt from are for research only, and part of its data is Meta’s own; he calls the six-stem model likely CC BY-NC, and the MIT tag is gone from its model card (adefossez/demucs). So no HTDemucs weights go in until that is settled, whatever a copy of them is tagged. A Mel-Band RoFormer would hear the voice better still: Kim’s vocal model has been tagged MIT since April 2026, and goes in only once what it learnt from allows it too; UVR’s models carry no licence.
  3. Transcription by YourMT3+ (F1 0.59 on the same test), ported to Rust from its paper: its weights are Apache-2.0, and its code GPL-3.0, so the port follows the paper and not the code. It writes each instrument’s notes with its General MIDI program.
  4. Instruments of their own. Each instrument transcribed becomes a part, played on the claudius sound nearest its program (a guitar on a guitar), rather than the rest on the genre’s chords. The genre still gives the mix and the master, and any sound can still be changed.
  5. Chords from the notes of every instrument, rather than from the mix, whose drums and voice blur them.

Not taken: Kim’s Mel-Band RoFormer and UVR’s models, which carry no licence, and MuScriptor, whose weights are CC BY-NC.

Consequences

  • More models to download on first use, each pinned by its size and SHA-256 as the ears’ are; without the ears a rebuild does what it does now.
  • A rebuild takes longer, as transformer separation and transcription of a whole song on a laptop’s CPU do.
  • Each step lands as a pull request of its own, with the evaluation’s numbers before and after it.

0018 Processors: effects with several tracks in

Status: proposed

Context

Every effect in claudius works on the audio of one track, a bus, a return or the master. Within a track, a rack plays several sounds as one and parallel runs chains side by side, but each still takes that one track in. The only signal that crosses from one track to another is the sidechain duck, and that is built from the kick’s notes, not its sound. Producers reach for more: a pad gated by the hi-hats, chords pumped by the real kick, a bass whose filter opens with the drums’ envelope, strings that crossfade into a pad over a build, a synth vocoded by a voice, several tracks mixed with gains that move through the song.

What is asked for is effects as functions: each takes up to some number of tracks, has parameters a person turns as knobs and that can follow time, and gives one track back, which then mixes like any other. They have to be available wherever the rest of claudius is: scripts, the studio and MCP.

The constraints:

  • Songs render offline, over whole-song buffers: a four-minute stereo track is about 92 MB at 48 kHz, and the studio plays the render. The live mix, which the studio gets before processors, keeps each track’s signal before its fader from the last render and mixes them in real time, its buses, returns and master streaming, so that a knob is heard as it turns.
  • Scripts are Rhai, an interpreter: far too slow to call per sample, and its closures cannot be stored. A song has to print back to a script that rebuilds it exactly (printing), and saved songs have to keep opening in later releases (0003).
  • Settings already move over time: a Param is a number, a curve of [beat, value] points or a value for each section, and scripts write them in fx() (settings that move). The compressor already takes a sidechain key, which nothing passes.

Decision

A processor is a named node of the blueprint (Blueprint.processors). It has:

  • a name, which is the name of the track it outputs;
  • its inputs: tracks of the song, or other processors;
  • a graph of operations from a built-in set, over those inputs;
  • knobs: named parameters with a range and a default, which the graph reads;
  • the output’s mix: level, pan, sends, bus and inserts, as any track has.

Scripts define one with a function whose arguments are its inputs. The number of arguments is the number of inputs, up to eight:

process("pump", ["chords", "kick"], |chords, kick| chords.duck(kick, knob("depth", 0.7, 0, 1)));
process("swell", ["pad", "strings"], |pad, strings| pad.crossfade(strings, sections(0, #{ build: [0, 1], drop: 1 })));
process("talk", ["chords", "vox"], |chords, vox| chords.vocode(vox, #{ bands: 24 }).gain(-3));

The function runs once, when the script runs, on stand-ins for the tracks. What it does to them is recorded as a graph, the way a pattern function is printed by running it on a placeholder. The graph is saved; the function is not, so the song prints back as process(...) lines that rebuild it.

An effect saved in a library (0019) takes the function’s place: process("pump", ["chords", "kick"], "mine:pump").

Values wherever an operation takes a number:

  • a number;
  • a knob, knob(name, default, min, max), which the studio shows and MCP can set;
  • a curve over the song’s beats, [[0, 0.2], [64, 1]], or a value for each section, sections(0.2, #{ drop: 1 }), as the settings of fx() that move take them;
  • a pattern in mini-notation, one cycle a bar, "0 0.5 1 0.5";
  • a function of the beat, |beat| 0.5 + 0.5 * sin(beat / 8.0), sampled into a curve when the script runs;
  • another signal’s envelope, kick.envelope(5, 120).

The operations start with:

  • gain, pan, lpf, hpf, bpf, saturate, delay, and reverb, with a recorded space or the generated one;
  • compress(key, ...), duck(key, depth), gate(key, depth);
  • mix(other, gain), crossfade(other, position), ringmod(other), vocode(modulator, ...);
  • envelope(attack, release);
  • convolve(other, seconds), capped in length.

catalog lists them, each with its arguments and their ranges.

Graphs stream, block by block, in the runtime that 0019 describes, the one the live mix runs the buses, returns and master in. A song renders its processors offline; in the studio’s live mix they play live, so that a processor’s knob is heard as it turns, as a fader is.

Rendering splits the per-track pass in three, where the live mix splits it too:

  1. Every track’s source and insert effects: its signal before the fader, which the live mix keeps from the last render.
  2. The processors, in the order of their inputs. A cycle is refused when the script runs. Each processor reads the pre-fader signals of its inputs.
  3. Level, duck, pan, sends and bus, for each track that still plays and for each processor’s output.

The live mix runs the second and third passes live. A track a processor processes no longer plays on its own, unless it is marked keep. Keys do: the inputs of duck, gate, compress and envelope that only steer.

The studio gives each processor a strip in the mixer, with its knobs. A turned knob sends set_knob, a command as the mixer’s set_mix is, which undo takes back, and the live mix plays it at once. MCP builds processors through run_script; catalog lists the operations and the recorded spaces; get_song lists each processor with its inputs and knobs; and command takes set_knob.

Saved songs. processors has a default, so songs without processors stay in blueprint format 1. A song with processors is written in format 2. An older claudius would otherwise drop the field silently and play the raw inputs; with format 2, it refuses the song with its “update claudius to open it” message.

Rejected:

  • Functions called per sample: about 10^7 interpreter calls per track and second of audio.
  • Only a fixed list of processor kinds (duck, crossfade, vocoder): it cannot express the mixing the request is about.
  • A graph of tracks edited in the studio: the script is where songs are built, and a graph editor would be a second language.

Consequences

  • Memory. A processor’s output is one more track buffer, and its inputs stay alive until the processors have run; in the live mix, their signals before the fader stay kept as every track’s do. MAX_TRACKS counts processors.
  • Convolution. Convolving one track with another needs partitioned convolution, or a short cap on the kernel: today’s convolve sizes its FFT to the whole kernel.
  • Slices and evolution. Project::slice, which previews and evolution use, shifts processor curves as it does filter curves. Mutation and evolution leave processors alone at first.
  • The documentation grows. The language pages get a page on processors; the mixing pages, the script reference and the songs skill describe them; catalog documents each operation.

0019 Libraries of sounds and effects, made, brought and shared

Status: proposed

Context

Today claudius plays its own synth presets and effects; 27 curated packs listed in registry.json, 22 of them on by default, which claudius setup or the install_packs tool downloads from their authors (0007); Strudel sample maps added with claudius-packs add-map; the person’s sample folders and Apple Loops; and recordings from online libraries anyone may use, each downloaded once into the samples folder with its credit (0010). People want more than that:

  • to bring their own sounds: recordings they made, or processed sounds they are proud of;
  • to make sounds and effects in claudius itself, and keep them;
  • to find what others made in a marketplace, free for now, and to publish their own there;
  • to keep some libraries for themselves only.

A sound is either recorded audio, or a procedure that makes it. An effect is a procedure over up to N input tracks with one output (0018), which should be able to stream in real time.

The constraints:

  • Speed. Scripts are Rhai, an interpreter, far too slow per sample, as 0018 explains.
  • Strudel. Strudel patterns run in claudius; using sounds has to stay Strudel’s way.
  • Downloads. A downloaded library must not be able to do anything but make sound.
  • Saved songs. They have to keep opening.
  • Publishing. Licences matter more once anyone can publish.

Decision

One format, the library. A library is a folder, or a .zip of one, with a library.json manifest: name, version, author, licence and description, its files, and its items. An item is one of:

  • a recorded sound: audio files and their mapping (root notes, velocity layers, round robins, loop points), as the packs’ instruments have today;
  • a procedural sound: a recorded graph of synthesis blocks, played per note with the note’s pitch, velocity and length, and with knobs;
  • an effect: a recorded graph over 1 to 8 inputs, with knobs, as in 0018.

The curated packs and the Strudel maps are read as libraries too, so there is one loader and one resolver.

Definitions are data. Sounds and effects are defined in the script language, by a function that runs once on stand-ins and is recorded as a graph, the way 0018 defines processors:

sound("mine:glass", |note| osc("sine", note).fm(osc("sine", note * 3.5), knob("bite", 2, 0, 8))
    .env(2, 900).lpf(knob("tone", 6000, 200, 16000)));
effect("mine:pump", |music, kick| music.duck(kick, knob("depth", 0.7, 0, 1)));

A library therefore holds audio and graphs, not code. Installing one cannot run anything; it can only make sound. Graphs have size limits, as scripts do. The graph’s blocks are native Rust, so a procedural sound costs what a built-in preset costs.

Graphs stream. The graph runtime processes blocks of samples (128 by default), keeping each block’s state, rather than whole-song buffers:

  • An offline render runs a graph block by block over the song.
  • The studio runs the same graph live: audition a sound, or turn an effect’s knob and hear it at once, without a new render.
  • Memory stays bounded by the block, not the song.

The live mix builds the runtime first. Before libraries, the studio gets a live mix: each track’s signal before its fader is kept from the last render, and a real-time mixer plays them, with the levels, pans and sends, the buses, the returns and the master running live, so that a knob is heard as it turns. It needs the effects on the buses, returns and master in blocks, in this runtime, and an audio path that plays them as they come: a callback on the computer, and an AudioWorklet running the same Rust in the browser. Library effects and procedural sounds then play live in what the live mix built. The offline render stays what is exported and what the critic hears.

Today’s whole-buffer effects keep working. They move to blocks one at a time, those of the buses, returns and master first, each move held to the tests below.

Using sounds stays Strudel’s. A library sound plays with s("mine:glass"), .bank("mine") and n(). samples("github:user/repo") and samples(url) load a Strudel sample map as a library, which is what add-map does today, so Strudel code that brings its own samples runs in claudius. The definitions (sound, effect, process) are claudius’ own; the docs mark them as extensions to Strudel.

Where libraries live:

  • Personal libraries are folders in ~/Music/claudius/libraries/, beside the person’s songs. They are made with claudius library new, with the studio’s Save as sound or Save as effect, or by a script’s library("mine"). They stay on the computer.
  • Installed libraries come from the marketplace, a URL or GitHub, into libraries/ in claudius’ data folder, beside packs/ and samples/ (files). They are pinned to a version and its SHA-256, as the packs are pinned to a commit or to an archive’s hash.
  • Songs name sounds and effects as library:item@version, and keep a copy of the graphs they use. A song still plays when a library changes or goes away; its audio files are fetched again when needed.

The marketplace is a small service, free for now:

  • a Cloudflare Worker for the API, beside the one that serves the site, with R2 for the files and D1 for the index;
  • files reached only through the API, so that they can move without a change to claudius. R2 charges $15 per TB a month with free downloads; past about a terabyte, Backblaze B2 behind Cloudflare costs less than half that, its downloads also free;
  • sign-in with an emailed link, with no password, for publishing and for private libraries. Searching and installing public libraries need no account. The command line signs in with a short code confirmed in the browser;
  • each published version is immutable and named by its content hash.

Each library has a visibility:

  • public: listed and searchable;
  • unlisted: anyone with the link;
  • private: the owner only. This is also how a person carries personal libraries to another computer.

The command line has claudius library search, install, publish and remove. The studio has a library browser. MCP has the same, through run_script and catalog, plus commands for searching and installing.

Licences and safety:

  • Publishing asks for a licence (CC0, CC BY, CC BY-SA, personal use only, or the author’s own text) and for the author’s word that they have the right to publish.
  • The index shows the licence, and claudius’ credits.txt covers library sounds as it covers packs. A recording from an online library goes into a library with its credit, as it goes into a song.
  • Uploads are checked: audio formats claudius decodes, sizes and lengths within limits, and safe names (no path traversal, no zip bombs).
  • Samples whose terms forbid passing them on are never uploaded or hosted: the curated packs with such terms (Audio Realism’s TR-909 and the jRhodes3d Rhodes) stay fetched from their publishers on each computer, as 0007 decided.
  • A reported library is hidden while it is looked at, and a takedown request is answered by removing it.

Tests come first. Before the engine changes, regression nets go in at every level of the pyramid. Each change in the work that follows then shows what it did to the sound:

  1. The sound of today’s songs. Short synth-only renders of each genre, with their metrics: loudness, true peak, energy per band, and a hash of the samples on each platform. A change meant to be bit-exact must keep the hash. A change meant to alter the sound updates the metrics on purpose, in review. Null tests compare two engines sample by sample.
  2. Every DSP block and effect.
    • Impulse and frequency responses, and envelope timing, measured against expected values.
    • Stability: no NaN, infinity or denormals.
    • The same output in blocks of any size as over the whole buffer.
  3. Properties. Random graphs give finite, bounded and deterministic output whatever the block size.
  4. The language.
    • Definitions print and rebuild the same graph.
    • A corpus of Strudel snippets has to parse and play.
    • Errors say what to do.
  5. The format.
    • Manifests across versions, with fixtures, as blueprints have.
    • Name resolution and its precedence, and credits.
    • Safe unpacking, and the manifest parser under fuzzing.
  6. Integration.
    • The server and MCP against a fake marketplace.
    • The command line end to end.
    • The studio’s library browser through CLAUDIUS_UI_PLAN.
  7. The marketplace service.
    • The Worker’s tests: sign-in, visibility, immutability, quotas.
    • A contract test of the schema claudius and the Worker share.
  8. Performance budgets. Benchmarks with limits: a graph’s throughput as a multiple of real time, render time per genre, and peak memory, checked in CI with a margin.

In this order:

  1. The tests of today’s sound, of every DSP block and of their properties (1 to 3 above), which the live mix needs too.
  2. The graph runtime, as the live mix builds it: today’s effects in blocks, the buses, returns and master first, played live in the studio.
  3. The format, personal libraries, and bringing sounds (folders, samples()), with their tests.
  4. Effects and procedural sounds as graphs, rendering offline and playing live in the studio.
  5. The studio’s Save as and the library browser.
  6. The marketplace, with its tests.

Rejected:

  • Native plugins (VST3, CLAP, AU) inside libraries. Untrusted native code, and a build for each platform.
  • Script functions called per sample. Too slow, as in 0018.
  • A marketplace made only of a GitHub index. Publishing waits for a pull request, and there is no private visibility.
  • Sign-in with GitHub. Musicians and DJs rarely have a GitHub account; everyone has an email address.
  • Libraries in the claudius repository. The redistribution and size problems of 0007.

Kept for later: WebAssembly modules for DSP the graph’s blocks cannot express. Sandboxed, portable and fast, they would be the one kind of code a library could carry.

Consequences

  • A service to run. The marketplace has an operator: storage costs past R2’s free tier, a service that sends the sign-in emails, moderation, takedowns, and backups of D1.
  • Licences are the authors’. The marketplace states each one, claudius credits it, and nobody reviews the audio before it is published.
  • Songs carry graphs. A song that uses a library carries the graphs it needs, so the blueprint gets a format 2 when it does (0018).
  • Effects are rewritten for streaming. Every effect moves to blocks, those of the buses, returns and master first for the live mix; the tests in step 1 keep each move honest.
  • Live playback asks more of the studio’s audio path than playing a file. The live mix pays that first, for the mix; library effects and procedural sounds then play live in its audio path.

0020 Changing a song’s genre

Status: accepted

Context

People make a song, like it, and want to hear it as something else: their house track as lofi, a pop song as drum and bass, a sketch in a fusion. Until now that meant a new song in the other genre, which keeps nothing, or a remake of the render, which listens to the audio and keeps all of it. Neither is the same song in another style.

What makes a song itself, and what makes it a genre, are mostly different things. The form, the chords and the key, the melody, a vocal take or a sampled phrase are the song; the drums, the bass line’s style, the chords’ rhythm and voicing, the sounds, the swing and the mix are the genre. A cover in another style keeps the first and remakes the second.

Decision

claudius::regenre::change builds the song again in the new genre (compose::generate, at the song’s key, unsampled so that no phrase of a library brings other chords) and carries the song over:

  • Kept as they are: the title, the form (each section’s name, kind, length, energy, progression and transitions, and its drum variant where the genre’s drums have it), the harmony, the key, the recordings it plays (takes, loops, sampled phrases), its pattern tracks and grooves.
  • Kept on the genre’s parts: the notes written out on a part go to the genre’s part of the same role, and the lead’s melody, as the theory engine writes it for the old song, is written out on the genre’s lead, note for note. A part the genre has no part of its role for stays as it was.
  • The genre’s: the drums, bass, chords, pads and the rest, their sounds, swing, mix and transitions’ sounds.
  • Where each plays: in each section the genre’s tracks of the kinds that played there before, a drum lane by what it does in a kit (kick, backbeat, hats, percussion), a part by its role; tracks of kinds the song never had play where a section’s energy calls for them, as a song like a recording places them.
  • Tempo: the song’s when recordings play in it, which keep time with it; otherwise the nearest of the song’s, its half and its double that the genre plays, as a remake chooses. At half its tempo or less, two of its bars become one (the sections’ bars, the bars each chord holds and its notes’ beats halved), so that it keeps its length and its pace: a 4-minute house song at 118 BPM is a 3:25 lofi song at 70, not a 7-minute one. A chord held a bar cannot hold half of one, so there each section plays its chords half as many times. At twice its tempo or more, each bar becomes two.

It is one edit (Command::ChangeGenre), so undo brings the song back; the reply and the history say what was kept. The studio (the genre under the title, and Variations), MCP (change_genre), the HTTP API and the command line (claudius change-genre) all reach it.

Rejected

  • A remake of the render (remake on the song’s own audio): it keeps the old genre’s drums and sounds in the recording it plays, and loses every editable note.
  • Swapping sounds only (swap_sound): the drums’ patterns, the bass style and the mix stay the old genre’s, so it sounds like the old song on other instruments rather than the song in another genre.
  • Keeping every part’s notes: the chords’ rhythm and the bass line are much of what a genre is; keeping them would only change the sounds. Only what someone wrote, and the melody, are kept.

0021 Every kind of sample, ranked and varied

Status: accepted; its five steps are built

Context

The Sample window offers a recording’s sung phrases: up to four that it sings whole, each as it was cut and through a treatment, the best of them on the first take and a seeded draw among the near-best on each other (sampler::pieces). A remake’s flip takes more from a recording: its hook, another passage, its drums as a break, and bits of it from all over (remix). The two choose in different ways, and neither offers what producers take most.

Of 42,447 samples on WhoSampled, 37% are drum loops, 34% bass lines, 17% hooks, 7% whole tracks and 2% vocals (Bryan & Wang, ISMIR 2011). A list of four phrases from the same chorus is also less use than four different things: what is offered should be good of its kind, and varied.

Decision

The Sample window, sample_pieces and the auto-sampler offer pieces of six kinds, cut on the recording’s downbeats from its stems (its vocals, drums, bass and the rest; from the mix without the ears), each scored for what makes a piece of its kind good, and a varied set of them.

KindWhat it isFromScored by
Sung phrasea phrase sung whole, as nowvocalshow deep the quiet is at its cuts, isolation, repetition, salience, how steady its pitch is
Hook loop1, 2, 4 or 8 bars of the section repeated most and most completelythe instruments, the voice too when it is the hookhow well it stands for the repetitions (thumbnail fitness, Müller, Jiang & Grosche 2013), loopability, salience, isolation
Passage loop1 to 8 bars from elsewherethe mix, the instruments or one stemloopability, isolation, how unlike the hook it is
Drum breakthe drums alone, a bar at least and 2 to 4 at best; with the bass, said sodrums, bassisolation, how busy it is, loopability
Bass line1 to 4 bars of the bass alonebassisolation, loopability, how much it moves
Stabone sharp onset of a clear chord and a beat of its decaythe instrumentsattack, how clear its chord is, a clean tail, isolation

Rules before scores, never relaxed: no cut inside a sung note or a word (cuts); each cut moved back to the loudness minimum before it, then to a zero crossing, with a short pre-roll so a downbeat keeps its transient; a loop’s ends within 30 ms of their downbeats. A stem is alone only when every other is inactive, under -20 dB (as Cheston et al. take it), and it is about 20 dB over them.

Loopability, as LoopMaker measures it (Shi & Mysore, CHI 2018): how much the loop’s first beats resemble the beats after its end, over 4-beat chunks, 1.0 × the chroma cosine + 0.6 × the MFCC distance + 0.2 × the loudness difference, in the stems it is cut from. The chord change from its end back to its start should be one the recording makes; notes ringing on past its end cost.

Quality: a weighted geometric mean of the piece’s features, each on a scale of 0 to 1 fixed for it (isolation from -10 to 20 dB, how busy a break is and how much a bass line moves up to a half of its beats, the rest as they are) and none under a fifth, so that one weak feature lowers a piece without ruling it out. A scale rather than a rank among the candidates, so that a hair’s more loopability does not count as much as 20 dB of isolation, and so that the pieces of different kinds can be weighed against each other.

Variety: a greedy DPP (Chen, Zhang & Zhou, NeurIPS 2018) over L = diag(r) S diag(r), where r is a piece’s quality weighed by how many of its kind to offer (below) and S how alike two pieces are: the most of the share of the shorter’s bars they share, a half when they are of the same section, and how alike their first bars sound beat by beat, as a seam compares two beats (a tenth apart or less as one, two fifths apart or more unlike); pieces cut from different stems are never alike. The best of each kind comes first, so that the scores never hide a kind; then each piece that adds the most, while it adds at least 0.4. The first take is that list; each other take is a seeded draw (Gumbel noise on the qualities, as Gumbel-top-k draws: Kool et al., ICML 2019) among the pieces within 0.15 of the best of their kind, those the take before offered as though they scored 0.15 less, phrases too. The reply says the seed, as now.

How many of each: the WhoSampled shares by default, r weighed by the square root of its kind’s share over the largest, and twice the share for a kind the genre’s producers sample (its sampling: a drum break, a bass, a phrase to build on as a hook, a texture as another passage); up to two more pieces than kinds, or four of a kind asked for alone. Several of a kind kept with no sections named share the sections their kind plays in, the fuller of them in the louder.

Each piece says what it is: its kind, where it is in the recording, its length, key and tempo (“a 4-bar drum break, the drums alone, 92 BPM, bars 33-36”), and in words why it scored as it did.

A piece kept plays as its kind does: a phrase as a vocal loop, as now; a hook or passage loop as a loop where the song’s chords and keys play; a break as a drum loop beside the genre’s drums or in their place; a bass line in place of the bass; a stab struck as a drum lane, as now.

Advice, not rules. The scores decide what is offered first. They never hide a kind the person asks for, and the person or their assistant can ask for any kind and any number, and read why each piece scored as it did.

Steps

  1. Built: hook and passage loops, breaks and bass lines with their scores in sample_pieces, each piece with its kind and what it scored for (claudius_api::PieceView), kinds to ask for some, and a piece kept placed as its kind plays (keep_pieces). The best of each kind on the first take, a seeded draw among the near-best on any other.
  2. Built: the Sample window offers them, each saying what it is.
  3. Built: variety, the DPP over the pieces of every kind but a phrase (kinds::varied), the seeded draws away from the take before (sampler::Options::shown), the shares of each kind and the genre’s (sampler::leaning), and several of a kind kept sharing the sections.
  4. Chop sets of breaks, loops and phrases at their onsets (SuperFlux, Böck & Widmer, DAFx 2013), laid out on pads: built, a piece kept chopped (kinds::chop, the Sample window’s on pads), the hits that sound as one on a pad, each pad a drum lane playing its hits where they came. Stabs of the instruments: built, stab, a hit of their chords where SuperFlux hears one, scored by how hard it comes in, how cleanly its beat rings on and how alone they play, kept struck by a drum lane (today’s stab of a voice is a syllable).
  5. Built: the flip and sample_song choose by the same scores. A remake’s flip is built on a loop of the hook (remix::hook_of: eight bars, else four or two, of the sections with chords that pull most toward being the hook, salience now one of a hook’s scores), another passage as long from none of them (passage_of) and a drum break (break_of), each the best on the first take and drawn among the near-best on any other, as the window’s takes are; where no loop of the hook can be cut, the flip falls back to the first bars of its loudest section with chords. sample_song samples the phrases the window offers first, sung whole, and with kinds the best piece of each kind, kept as its kind plays or chopped onto pads.

Evaluation

  • Cut safety on JamendoLyrics, as eval_cuts measures it now: no cut inside a word.
  • Loops: songs built from loops of the Freesound Loop Dataset, whose boundaries are known, found within 30 ms; a listening test counts audible jumps.
  • Hooks: top-1 and top-3 overlap with the chorus labels of Harmonix.
  • Isolation: how often “the drums alone” and “a cappella” are right, on MUSDB18 and MedleyDB with their true stems.
  • What producers took: on Sample100, whether a piece among the first few overlaps what was sampled, and is its kind.
  • Variety at the same quality: how unlike each other a list’s pieces are, the sections, stems and kinds it covers, how much two takes overlap; then a preference test against today’s sampler.

Consequences

  • Sampling a recording offers what producers take from records, and not only its voice, so a song can be built on a break or a bass line as well as on a phrase.
  • The thresholds (250 ms, 10 dB, 20 dB, 6 dB, 30 ms) are where to start, tuned on the evaluation sets; only the -20 dB inactivity comes from the literature.
  • Each step is its own pull request with its tests; the Sample window shows each kind as it comes.

0022 A song’s own sections

Status: accepted

Context

A remake, a flip, a rework and the sampler all start from the sections the analysis hears in a recording: the flip takes its hook from the loudest of them and goes on through the recording a section at a time, a rework is its form bar for bar, and a sampled passage starts where one of them starts. Until now the analysis cut a song into 4-bar blocks from its first bar, put a boundary where neighbouring blocks differed most (8 bars apart at least, 32 at most), and named each section by its loudness alone: 0.85 of the loudest or more was a drop.

That suits a dance track, whose sections are its loudness. A song is not: on six songs a person had in their Downloads (Alizée, Depeche Mode, The Prodigy, Telenova, The Killers), every one came out as an intro, a row of drops and an outro, its verses, pre-choruses and choruses nowhere. A section could not be 6 bars or 17, nor start where its phrase does, so a piece cut from one could end while the recording was still building, and the song made on it would drop early. An agent reworking two songs over MCP asked for the same: phrases to the beat, sections labelled by what repeats, boundaries in the singer’s breaths, any length.

Decision

The analysis hears a song’s own sections (analysis/structure.rs), with no model of its own: signal processing on what it already reads, the stems when the ears separate them, and a small tagger that tells a voice in them from what the separation left in the vocals.

  • Each bar is heard as its harmony (the pitch classes of each of its four beats, from the bass and the rest), its timbre (cepstral coefficients of its spectrum), how loud and bright it is, its kit, its bass and how much of it a voice sings (the words cuts hears in the vocals, over the bars round each, so a breath between lines is no change).
  • A section starts where how the bars sound stops being like it was (Foote 2000, the novelty of their similarity); where the chords a passage plays change, whatever their order; where a run of bars that comes back 8 bars or more later starts or ends (a diagonal stripe in the harmony’s similarity: it marks where both verses start, however unlike each other the bars within a verse are); where the voice, the kit or the loudness comes in or goes. The harmony is not compared bar by bar as the sound is: chords change every bar within a section. Of every way to cut the bars, the one whose boundaries are most novel, less a cost for each, under a preference for 8 and 16 bars that never forbids another length: a clear boundary at 17 bars outweighs it (dynamic programming over the bars). The bars are counted as a phrase’s: a bar over 3.2 s, of a slow song or one heard at half its tempo, as two. Each change is scaled to the song’s clearest, but never by more than what a real change measures, so a steady loop’s noise is no boundary, and sections that rise together, bar by bar, into a louder one are one build.
  • The voice is where cuts hears it in the separated vocals and the ears’ AudioSet tagger hears a voice there too (stems::voiced): a guitar riff or a synth line the separation left in the vocals sings nothing. The tagger is CED-Tiny (Dinkel et al. 2024; 5.5 million parameters, Apache-2.0), asked about the phrases a few lines at a time (those less than a second apart, up to the 10.11 s it hears at once), and a stretch is a voice’s from 0.03, chosen on half of JamendoLyrics’ songs and confirmed on the other half (Evaluation).
  • What the voice sings, beat by beat, where the stems are apart, counts as much as the chords: in the runs that come back, so a chorus’s tune coming back marks where it starts, and between two sections both sung. Many songs play one loop of chords all through, and only the tune tells their verse from their chorus.
  • Sections that play the same music, in the same key or up to two semitones away (a last chorus a step up), share a letter: they start and go on alike in their chords, in what is sung over them where both are sung, and in their sound (average linkage).
  • What each is: in a song a voice sings, the chorus is the music it sings again and again that is loudest and sung most, ends the singing and does not start it; the verse is the other music it sings again, that leads to the chorus; a pre-chorus comes between, a post-chorus is loud music no one sings right after a chorus, a bridge is sung once after two choruses (or after one, 8 bars long or more), the intro and outro play before and after the voice, an instrumental or a break between (Goto 2006 finds a chorus by its repeats; Paulus, Müller and Klapuri 2010 review the methods). A track no one sings in (the stems apart, its vocals all but silent) keeps intro, build, drop, break and outro, by loudness, with the music a drop plays a drop wherever it plays. With no stems, the voice is not heard, and a song is taken as sung wherever it plays fully.
  • A build is the bars at the end of a section that rise into a louder one, bar by bar; it resolves where the next section starts. A cut is where a piece of a section is best taken from the recording: its first bar’s line, or the quiet before its first phrase when that is sung before the bar.
  • analyze says all of it, the phrases sung to the beat as a DAW writes positions (27.2-31.4), and a section’s label maps to the kinds a song of claudius’s plays (a chorus as its hook, a pre-chorus as a build), so the blueprint does not change.

Evaluation

examples/eval_structure.rs measures any version, from its analyses (claudius analyze --json) or making them, on two sets of songs downloaded to the computer and never into the repository. The 4-bar blocks this replaces were measured from claudius 0.10.0’s analyses, on the bar grid of their first downbeat and tempo, as the new one was for a like comparison.

JamendoLyrics: 78 songs under Creative Commons licences, their lyrics in stanzas and each line timed by hand. A stanza that starts other music than the one before is where a sung section starts; the stanza sung again most often is the chorus.

4-bar blocksnew, the mix alone
stanzas starting other music heard within a bar of a section’s start14% of 66160%
sections starting within a bar of a stanza, or of where the singing stops (a lower bound)44% of 28257% of 892
choruses heard as choruses66% of 20453%
other stanzas heard as choruses55% of 49738%
stanzas sung alike heard as the same music(no letters)54% of 416

On the first 25 songs, with the stems apart as the studio hears them: starts heard 62% (58% from the mix, 17% before), sections on a stanza 52% (57%), choruses 51% (46%), other stanzas taken for choruses 32% (34%), stanzas sung alike as the same music 36% (48%). Heard without its tune, the voice had found the starts less well (57%, 46% on a stanza), named more choruses (59%) but taken more stanzas for one (44%), and put stanzas sung alike in the same music twice as often (71%): the tune, which a voice’s stem hears less steadily than the rest hears its chords, parts two choruses sung a little differently. It is kept for what it finds that nothing else does (below).

The voice tagger (CED-Tiny), on the same 78 songs against when lines are sung, every 10 ms, its threshold chosen on alternate songs and confirmed on the others: on the half it was not chosen on, precision 0.827 to 0.850, recall 0.876 to 0.874, and a voice heard more than 2 s from any line in 18.6% of that time to 12.4%, with no song’s F1 down by more than 0.02 (on all 78: 0.849 to 0.868, 0.886 to 0.884, 14.7% to 9.6%). With the stems read back from the cache both times, every song’s analysis comes out the same, byte for byte, with the tagger as without it: at 0.03 it keeps every phrase these songs sing, and what it takes out is what no voice sings. On seven recordings with lyrics timed by LRCLIB the far-off voice went from 53% to 43% on The Prodigy’s “Firestarter”, 34% to 28% and 17% to 13% on two more, and stayed at 74% on one.

SALAMI: 60 recordings of its Internet Archive part (live, a jam band as often as a pop group) whose first annotator marked a verse and a chorus, against each of its annotators, from the mix alone.

4-bar blocksnew
boundaries within 0.5 s, F-measure0.0810.154
boundaries within 3 s, F-measure0.3560.486
the time heard as its function (verse, chorus, …)25%26%
the time heard as a chorus, F-measure0.3470.230

Published methods of this kind score 0.22 to 0.30 and 0.45 to 0.55 on SALAMI’s boundaries: the new one is among them at 3 s and under them at half a second, where its sections start on bar lines and live recordings drift. The blocks scored their chorus by calling nearly everything a drop.

On the song that started this, Alizée’s “J’ai pas vingt ans”, one loop of chords all through, the 4-bar blocks heard an intro, four drops of 16 to 32 bars and an outro. The new reading, its stems apart, hears an intro, a verse of 8 bars, the verse’s music of 16, a chorus of 16 from bar 33, the verse’s music again from bar 49, choruses on from bar 65, and an outro; against its lyrics as LRCLIB times them, its second verse starts at bar 51 (heard at 49) and its second chorus at bar 65 (heard at 65). Without the tune, the loop had read as 28 sections of four bars, all one music and nearly all named chorus, and a flip’s build would have landed in the middle of its first verse.

On claudius’s own house song of the cookbook (intro 8, groove 16, break 8, build 8, drop 16, outro 8), it hears all six sections to the bar, the intro and the build as one music and the groove, the drop and the outro as another, and names them intro, drop, break, build, drop, drop; the blocks heard a drop of 24 bars, the break, and a drop of 32.

Consequences

  • A remake’s hook is taken from the choruses (the kind a song of claudius’s plays as its hook), and a rework’s and a rebuild’s sections are named for what they are (verse2, pre_chorus, chorus3).
  • A flip’s build plays the recording’s bars that end where one of its choruses or drops starts, first those the recording’s own builds lead into, and its drop plays on from there (remix::landings): the song’s drop comes where the recording’s build resolves. On “J’ai pas vingt ans” flipped into deep house, the build plays bars 25 to 32 and the drop the chorus from 33; on the cookbook’s house song, its own build, 33 to 40, and its drop from 41.
  • Without the ears the voice is unknown, and an instrumental between verses can be taken for a verse.
  • Methods like these find a section’s start within half a second about a quarter of the time on the Harmonix Set (structural features and spectral clustering: 0.26 to 0.28 of the hits, F-measure), and name no function, only letters. All-In-One (Kim and Nam 2023; code, weights and the annotations it learnt from all MIT) finds them 0.60 to 0.66 of the time and names intro, verse, chorus, bridge, instrumental and outro, from 0.3 million parameters a fold; it learnt from HTDemucs stems, and claudius separates with Spleeter. Ported to Rust, it is the reader to use with the ears, once measured on claudius’s stems; these rules stay for a song without them, the browser’s included, and for what the model does not say: the sung phrases, the cuts, the builds and the pre-chorus.

0023 The live mix, first by windows

Status: accepted

Context

A fader moved in the studio was heard only when the whole song had rendered again: the edit, a render of every track’s mix through the buses, returns and master, the master’s loudness search, the file written, fetched and decoded. On a four-minute song that takes a few seconds, and moving a fader by ear, the way people mix, is not possible.

Design 0018 and 0019 name the live mix that fixes it: each track’s signal before its fader kept from the last render, and a real-time mixer playing them, its buses, returns and master running block by block in a runtime that a callback on the computer and an AudioWorklet in a browser both play. That runtime asks every effect on a bus, a return or the master to work in blocks, keeping its state between them, and today’s effects work over whole buffers. Moving them is the larger part of the work, and each move is to be held to tests.

A render already keeps what the live mix needs. Each track’s sound before the mix is kept between renders (render::Kept), so an edit of the mix makes no track again, and render::render_window mixes any stretch of the song from the kept sounds through the buses, returns and master, starting early enough for every effect to settle, at the loudness the last render settled. Its windows equal the whole render there to within 1e-6. The demo’s engine already uses it (Host::preview): an edit is first the last render with the twelve seconds from the playhead rendered again and crossfaded in, handed to its player as a new render, in about 0.8 s in a browser. A server did nothing of the sort, and doing it the demo’s way would send the whole song again, a 24-bit WAV of 70 MB for four minutes, for each move of a fader.

Decision

The live mix comes first by windows of the song, and the runtime of 0019 replaces them later.

  • The server keeps what each render leaves for windows: the kept sounds, shared rather than copied (Kept::share, each sound behind an Arc), and the loudness the render settled.

  • /api/window?from=&secs= mixes that stretch of the song as it is now (App::window), up to ten seconds, and sends the song’s version, the window’s first sample and its rate, then its samples as 32-bit floats. When an edit changed a track’s own sound (its notes, its sound, a section) or the song’s length, it says so with a 409, and the next render plays the change, as before.

  • The studio, while the song plays and is newer than the render playing, asks for a window from just after the playhead (0.15 s, about what one takes to come), then the next, a second each, up to four seconds ahead of the playhead, and again from the playhead when the song changes again (live::Live).

  • The desktop player plays each window in the render’s place, faded in and out over 5 ms against what plays beneath it, so that the mix changing never clicks; windows of one version that follow on are one stretch, with no fade between them. The next render replaces them all.

  • The page’s player (the web studio connected to a claudius) plays on Web Audio: the render decoded once into a buffer, played from it on the audio clock. A window goes into the buffer over what the render holds there, faded in and out over 5 ms as on the desktop; a window of the same version that follows on from the last is joined to it, the last one’s end written back as it came and no fade between the two, so that a run of windows plays through as one stretch. A source started again at the moment it would be fades in over the one playing, which may have read the buffer when it started; both play the same up to the window, which comes after it. Its audio runs at 48 kHz, claudius’s rate, because a browser decodes a render to the rate its audio runs at and a window has to fit the buffer sample for sample (where a browser will not run at 48 kHz, each window is resampled to the rate it does run at). A new render takes over from where the song has got to, fading in over the one before, and play and pause fade in and out, so that nothing clicks. A play, pause, stop or seek while a render is still on its way counts: the render plays, or does not, from where the song was left, as on the desktop. It once played a whole file through an audio element, over which nothing could be played.

  • The demo’s engine (in a page’s worker, or on a thread of the app’s demo) makes windows as a server does (Host::live_window), from the tracks its last render kept, and the studio asks it for them in the same way. A page’s worker is one thread, on which the whole render of a change to the mix takes about 10 s for a song of four minutes on a recent laptop, while windows are kept four seconds ahead: a render started while the song plays would leave it playing the render before for seconds. So while the studio plays a change to the mix by windows (it says with each command whether it plays, and asks for a window at least every second), the render waits, and comes 2.5 s after the studio stops asking (Host::waits). With the song stopped, an edit is previewed as before, where it will play from: the last render with the twelve seconds from the playhead rendered again and crossfaded in, in about 0.6 s, then the whole render. An edit of a track’s own sound gets that preview while the song plays too.

Consequences

  • A fader, a pan, a send or an effect on a bus, a return or the master is heard a few tenths of a second after it moves, while the song plays.
  • Each window mixes the seconds before it again, for the effects to settle: a second of song costs a few seconds of mixing, and four seconds ahead are kept. On a laptop that is a small share of a core; the runtime of 0019 removes the repetition.
  • What a window plays is what the next render plays, but for the master’s loudness, which the render searches again over the whole song: a fader moved far shifts the level a little when the render comes.
  • An edit of what a track plays is heard when the render comes, as before.
  • In the demo, the verdict and the meters of a change to the mix come once the song stops, as its render waits while the song plays.

Rejected

  • Waiting for the runtime of 0019. Every effect has to move to blocks first; windows give the studio a live mix now from code that already renders the song, and the runtime replaces them where it is ready.
  • Streaming the whole song from the server as it renders. A stream renders ahead of the playhead by what the connection buffers, so an edit is heard only after that; windows asked for from the playhead are heard at once.

0024 The radio in the app

Status: accepted

Context

The site’s radio writes songs as it plays them, a genre at a time, and mixes each into the next as a DJ mixes records. It is a page: the studio demo’s engine in a Web Worker writes and renders each song, and the page schedules the change on Web Audio’s clock (site/assets/radio.js). The plan asked for the radio in the desktop app too. The app has neither a worker nor Web Audio, and its own song must not be disturbed by the station’s.

Decision

  • The station is shared code. claudius_session::radio plans as the page does, ported from it with tests: the genres a station plays (less the few with no beat to mix on or too harsh for a radio, kept to the ones chosen), the first song from a set of openers, and each next one, three times in four a genre whose tempo range takes the playing song’s tempo (or its double or half) in a key with the same notes, else another tempo and key.
  • An engine of its own. The app’s radio runs a claudius_session::host::Host on a thread, as the demo does, and asks it for one song at a time: new_song with the station’s genre, seed, tempo and key, then a whole render. The person’s song, in the studio’s session, is untouched.
  • Each change rendered as audio. Where the page schedules gain, filter and echo changes on its clock, the app renders each change once the next song is in (radio::change): a blend under the outro with the basses swapping halfway and a rising high-pass, an echo out on the bar, or a record stop. A skip renders a cut on the next beat (radio::cut). The radio’s player (audio::radio) plays one stream of pieces placed at frames of it: the song on air up to the change, the change, the next song from where the change leaves it. The station places pieces ahead of where the stream is and may place them again; the audio thread plays whatever covers its frame.
  • The same controls as the page. Tune in and pause, Skip, the genres to keep to, Save this song (an MP3 in the songs folder’s radio), and Open it in the studio, which asks the studio’s session for the same new_song, so that undo brings back the song that was open. The studio’s song and the radio take turns: one started pauses the other.

Consequences

  • The page and the app plan the same way from two sources, JavaScript and Rust. The Rust station is the one the engine could serve the page from later.
  • A change is exact to the sample, and costs a few hundred milliseconds of rendering when the next song comes in.
  • The first song takes as long as a whole render of it, as the app has no first bars to play meanwhile yet.

0025 The signal flow as the song’s lanes

Status: accepted

Context

The studio shows a song three ways, as equals in the main area: the arrangement (its sections and the parts that play in them), the script, and the signal flow, which is every path the sound takes from the sources to the finished song. The signal flow began as a node graph and became a board (panels::board): a card for each track, its effects as chips of text, curved wires into a card for each bus and return, and the master. It fitted itself to the window, could not be zoomed or panned, said an effect in words rather than showing what it does, and left the sound’s path to be read off wires that cross. People who mix think of a mixer’s channel strips and a device chain: each track’s sound running through its devices in order, each device showing what it does (an equalizer’s curve, a compressor’s threshold and ratio), into the buses, the returns and the master.

An effect could be added, moved, changed and removed, but not switched off to hear the track without it and back again, which is how a mix is judged; removing it lost its settings.

Decision

The signal flow is drawn as the song’s lanes, the arrangement’s tracks in the arrangement’s order and colours, each one row the sound runs through from left to right.

  • A track’s lane: its source (the instrument, the kit or the recording it plays), each effect of its chain as a block in order, then its fader, pan and meter, then its sends to the reverb and delay returns. Its output runs into its bus.
  • The buses, the returns and the master are lanes of the same kind under the tracks, their chains as blocks, ending in the finished song.
  • A block shows what its effect does: an equalizer or a filter its frequency curve, a compressor or a limiter its transfer curve with its threshold and ratio, saturation its curve and drive, a delay its time and feedback, a reverb its decay. Zoomed out, a block is its name and its main value; zoomed in, its picture, with its power button and its × along its top.
  • Everything is edited where it is: a click chooses a block and opens all its settings in the inspector beside the lanes, a drag moves it along its chain or into another, a + between two blocks adds one there, × or Delete removes it, a power button switches it off, a fader’s level and pan drag where they are, and the keyboard reaches every block.
  • Zoom and pan as a map does: around the pointer with a pinch or the scroll wheel held with Ctrl or Cmd, dragging the background to pan, and a button to fit it all to the window.
  • An effect can be switched off: wrapped as an effect of its own, {"fx": "off", "effect": {"fx": "gain", "db": 3}}, it keeps its place in its chain and all its settings, and the renderer passes the sound by it untouched; switched on again, it is unwrapped. Every earlier song reads as it did (0016), and a script writes it the same way: #{fx: "off", effect: #{fx: "gain", db: 3}}.

The studio and the web demo draw it from the same code, and the MCP’s graph tool describes the same flow in words.

Rejected: keeping a node graph with better drawing (the sound’s path stays a tangle of wires to follow, and a node graph is a programmer’s picture, not a musician’s); a mixer of channel strips alone (it hides the order of the effects, which is half of what a chain is); bypass as a list beside each chain (it would have to follow every move of the effects it names); "on": false among an effect’s settings (it reads better, but a claudius that knows nothing of on ignores a field it does not know and plays the effect switched on, without a word, where one that does not know off says so).

Consequences

  • Each kind of effect needs its own picture in a block, and a new kind of effect a new picture (a kind without one is drawn as its name and settings, never left out).
  • Everything that reads a chain has to know off: the renderer passes it by, and the summaries, the critic’s reading of a chain and the words for an effect say what it wraps and that it is off. A song saved with an effect switched off does not open in a claudius older than the one that wrote it, which says why rather than playing it wrong.
  • A whole song’s lanes are more than a window holds; zoomed out they are blocks too small to edit, which is what the zoom is for.
  • The board’s code goes; its parts that stay (a track’s level, pan, mute, solo and sends, the right-click menus, the inspector beside it) move into the lanes.

Amended: the lanes as a diagram (24 November 2026)

Built as one lane under another, the tracks over the buses, the returns and the master, the flow was a list of rows. Each track ended in a label that named its bus (“→ drums bus”), and nothing showed the sound going from the tracks into the buses, from the buses into the master, or from the sends into the returns. Fit made the whole song about 40% of its size, too small to read, and a short chain left a long empty line between its source and its fader. devlato, on the web demo: “i requested a fuckign complete flow diagram (and asked to make it look nice — not like a cheap uml render library regurgitation) and you made it into some unusable lines”.

So the lanes stand in three columns, and the sound’s way between them is drawn:

  • The tracks’ column: the tracks in the arrangement’s order, a group of them for each bus they run into, the groups apart. A track’s first block holds what plays, its name, its sound, its mute and its solo (they were in headers at the left, which the columns leave no place for); its strip and its sends line up after the column’s longest chain.
  • The buses’ and returns’ column: each bus beside its group, at the group’s middle, none over another; the reverb and delay returns under the buses.
  • The master’s column: the master as a rack, its effects one under another, its loudness and ceiling under them, as tall as its chain; then the finished song, how loud it is made and, while it plays, how loud it is now.
  • Bands run from each lane’s right edge into the left edge of the lane its sound goes to: a track’s into its bus, as thick as its fader leaves it and in its colour; a send’s, thinner, as much as it sends, into its return; each bus’s and return’s into the master, as thick as what it gathers; the master’s into the finished song. Under the pointer, or chosen, a lane’s bands are lit and the others dimmed, so that its way through the mix can be followed. While the song plays, light runs along each band with the beat, a bar from end to end.
  • It opens readable: all of it in view where that leaves it at 72% or more, else at 72% from the top left; the inspector stands beside it only while something in it is chosen, and the diagram has all the width otherwise.

Rejected: wires from every send’s knob to its return across the tracks’ strips (a tangle; the bands leave from the lane’s edge, a send’s under its track’s own); the master as one more row (four effects wide, it made the diagram too wide to read at any zoom that shows all of it).

A tour of the repository

claudius is about 45,000 lines of Rust in eight crates, and most of what makes it interesting is in one of them. This page gives you the map, follows one song through the code from the command line to the speakers, and suggests an order to read things in, with what to look for in each. Set up your machine first with Development setup; the commands below assume a built checkout.

The map

crates/
  claudius/                the engine: everything that makes or judges music
    src/model.rs             Blueprint (a song's decisions) and Project (the arranged timeline)
    src/compose.rs           generate: decisions from a genre and a seed (parts, sounds, kits, flipped samples)
    src/compose/arrange.rs   arrange: decisions into notes, sections and automation
    src/genres.rs            loads data/genres/*.json
    src/theory/              keys, chords and voicing, progressions, rhythm, bass lines, leads
    src/pattern/             mini-notation, pattern queries, events into notes
    src/script/              the Rhai engine; song functions (song.rs, mix.rs, form.rs); sound names; printing
    src/render.rs            the mixer and the master
    src/fx/ dsp/ synth/      effects; filters, oscillators, FFT; drum voices, the synth engine, risers
    src/loudness.rs          BS.1770 loudness
    src/judge.rs ears.rs     the critic, and the ears that feed it
    src/evolve.rs            mutation, crossover, the evolutionary search
    src/analysis/            reading tempo, key, chords and sections from audio
    src/library/             Apple Loops, chops, one-shot cutting
    src/config.rs            constants, folders, the shared-mode file policy
    src/song.rs              one song end to end, and write_folder, which writes every song folder
    data/genres/             the sixty-six genres, as data
    tests/ benches/          the engine's tests and benchmarks
  claudius-packs/          sample packs: registry, installer, SFZ and Strudel maps, the player
  claudius-decode/         audio files to samples (symphonia and opus-pure, ffmpeg as fallback)
  earshot/                 the ears: earshot ported to Rust, CLAP and AudioSet on ONNX Runtime
  claudius-api/            the HTTP API's types, shared with the web studio
  claudius-intent/         the command palette's actions, found by name and by meaning (static word embeddings)
  claudius-server/         the session, HTTP routes, MCP tools
  claudius-ui/             the studio, native and WebAssembly
  claudius-cli/            the claudius program: main.rs (the commands), args.rs (flags), report.rs (printing)
docs/                      this book
fuzz/                      cargo-fuzz targets (their own workspace)
xtask/                     cargo xtask: ci, web, docs, site, dist, release
scripts/                   install scripts, the Homebrew formula template
site/                      the website
.github/                   CI, releases, fuzzing, dependency updates

Two rules keep the shape: the engine knows nothing about HTTP, sessions or windows, and the studio knows nothing about the engine, only the API. Architecture draws the dependencies.

One song through the code

Follow claudius make --genre house --seed 9 from start to finish. Keep the files open as you go.

The command (crates/claudius-cli/src/main.rs, Cmd::Make). clap parses the flags, which are defined in args.rs. genres::get("house") deserialises data/genres/house.json, plus any genre files of your own, into a GenreProfile. Library::open reads the Apple Loops database if GarageBand content is installed. listen() loads earshot’s models unless --no-ears.

The decisions (compose::generate, then generate_inner). A seeded generator is forked into one stream per area: harmony picks two progressions as Roman numerals, form picks a list of sections, drums sample a 4-bar pattern per lane from the genre’s step probabilities, parts get a preset, a style and a seed of their own. Sounds come from part_sound and kit_sound, which prefer a sample-pack instrument where the genre asks for one and it is installed. The result is a Blueprint (model.rs): about 30 KB of JSON that says everything about the song and contains almost no notes.

The layout (song::render_and_write, then compose::arrange in compose/arrange.rs). The blueprint becomes a Project. For each section the drum patterns are tiled, with snare rolls in builds and fills every 8 bars; each part is written once per progression by the writers in theory/ (bass::bassline, melody::chord_part, melody::lead, melody::arp) and tiled across its sections; transitions are placed; bus automation is added.

The sound (render::render). Every track is rendered in parallel: notes through a drum voice (synth/drums.rs), the synth engine (synth/voice.rs), a sample-pack instrument (claudius_packs::Instrument) or a loop (warp.rs); then its inserts, the auto-mixer’s gain to its role’s target loudness, the sidechain, the pan. The buses and the two returns are summed, and finalize searches for the input gain that lands the master on the genre’s LUFS target under the true-peak ceiling.

The judgement (judge::judge, with ears::Ears::report). Meters, the energy arc, theory checks on the notes, and earshot’s calibrated CLAP scores become a Verdict with scores and issues.

The files. render_and_write hands the render to song::write_folder, which writes song.wav, song.mp3, blueprint.json, song.rhai, project.json, report.json, verdict.json and credits.txt (and stems/ with --stems), and report.rs prints the summary. A save from the studio goes through the same write_folder.

Now the same song in the studio, after claudius studio:

  1. claudius_server::App::new creates the session; claudius_server::spawn serves it on a thread; claudius_ui::run_native opens the window on the main thread.
  2. The studio long-polls GET /api/state?since=N (claudius-ui/src/net.rs). You click a step in the sequencer (panels/sequencer.rs): it pushes Command::SetDrumStep, shows the step at once (edits.rs), and posts it.
  3. http.rs checks the host name, parses the JSON, and calls App::command on a blocking thread (claudius-server/src/app/commands.rs), which has claudius-session make the edit: edit_with changes a copy of the blueprint, commit pushes the old one for undo, and after_change starts a render job (app/jobs.rs).
  4. The job arranges, renders and judges as above, writes <cache>/renders/<pid>-<session>/<version>.wav, and bumps the version. The long poll returns, the studio sees a new render.version, fetches the WAV and plays it from where you were.

And an assistant, through claudius mcp: mcp.rs finds the studio on the port, picks Backend::Remote, and turns a run_script tool call into POST /api/command, which lands in App::run_script and script::run_with, the same path as the studio’s script tab. That is the whole architecture: one session, every client a view of it.

A reading order

A first pass takes a few evenings. Each step says what to look for.

  1. crates/claudius/src/model.rs. The two documents. Notice what a Part stores (a style and a seed, not notes), that every Sound variant is audio, and TrackMix.level_db being relative to a role, not a fader.
  2. crates/claudius/data/genres/house.json. What a genre knows: weighted choices, step probabilities, forms with flags, presets with a|b alternatives, the mix. Most musical changes are edits to files like this one.
  3. compose.rs, generate_inner, then compose/arrange.rs, arrange. The creative step and the layout step. Notice the rng.fork(...) calls, the tempo and tonic drawn even when they are given, and why both matter (Determinism).
  4. theory/bass.rs. A short writer that shows the idea behind all of them: a one-bar motif, written once, transposed onto every chord. Then skim melody.rs for the lead’s A A’ A B phrasing.
  5. render.rs, render(). The whole mix in about 130 lines: sources, the auto-mixer, the sidechain, buses, returns, the master. Then finalize for the loudness search.
  6. judge.rs. What “good” means here, and the issue targets evolution reads.
  7. pattern/mod.rs, query; pattern/mini.rs; script/mod.rs; script/song.rs, track(). How a mini-notation string becomes a tree, how a tree is queried by onset, the work and event budgets, the sandbox limits, and how a pattern becomes a track. script/mix.rs and script/form.rs hold the rest of the song functions.
  8. script/print.rs and songs_print_as_scripts_that_change_nothing in tests/script.rs. The round trip, and the small concessions on the reading side that keep it exact (Printing a song).
  9. evolve.rs. The 25 operators, how issues weight them, the (μ + λ) loop with previews.
  10. crates/claudius-server/src/app/, then http.rs and mcp.rs. The session, its versions and jobs; the guard; the tools and their two backends.
  11. crates/claudius-ui/src/app.rs and net.rs. How the studio holds back server state while you drag, and applies edits optimistically.
  12. crates/claudius-packs/src/resolve.rs and player.rs, and earshot’s README. Names to instruments, zones to sound; how the ears were ported and checked.

Read with claudius running. These make the code concrete:

echo 'song("house", 9);' | claudius script - --print          # a song's decisions, as a script
claudius make --genre house --seed 9 --short --no-ears          # the whole pipeline in ~10 s
CLAUDIUS_DEBUG=1 claudius make --genre house --short --no-ears  # with render timings
claudius serve --no-ears                                        # then: curl -s localhost:7878/api/state
cargo test -p claudius --test script                            # the language, end to end

Conventions you will meet

  • Units. Time in beats from the start of the song, four beats to a bar; pitch in MIDI semitones (60 is middle C); velocity 0 to 1; levels in dB; 48 kHz planar stereo f32 everywhere. Names carry units when they are not these (release_ms, ceiling_db, size_mb).
  • Seeded randomness only. Every random choice draws from rng::Rng, seeded from the song and forked per area, or from a hash (patterns, the pack player). Nothing reads the clock except to pick a seed when none is given.
  • Data over code. Genres are JSON; effects are serde enums; a blueprint is plain data. New fields get serde defaults so older files keep loading.
  • Errors are for people. Messages say what is wrong and what would work: unknown sound 'bdd' (drums: bd kick sd ...), cannot read key 'H minor' (try "A minor", "F#m", "Eb", "D dorian").
  • Comments state constraints, not what the next line does: // a noise-built tail reads as hiss above ~9 kHz: real rooms and plates are darker up there. Doc comments are short lowercase phrases; module comments explain the module’s job in prose.

Code style and review has the rest.

Where to start contributing

Good first changes, roughly from least to most code:

  • An example or a fix in this book. Every js block runs in CI, so examples stay true.
  • A genre tweak. Change a weight, a template or a form in data/genres/*.json, look at the generator snapshot diff, and listen (Making a change).
  • A progression style in theory/progression.rs, or a bass or chord rhythm in theory/.
  • A script function, such as a pattern method Strudel has and claudius lacks (Making a change walks through one).
  • A mutation operator in evolve.rs.
  • A sample pack, if you find a well-mapped, clearly licensed library (Sample packs).

Before anything larger, open an issue and describe what you want to change; the design records in Design decisions explain the choices you might want to revisit, and why they were made.

Development setup

You need Rust, a handful of cargo tools, and on Linux a few system packages. Everything else (ONNX Runtime for the ears, wasm-bindgen for the web studio) is downloaded by the build itself.

Rust

Install rustup. rust-toolchain.toml at the root pins the Rust that CI and the releases build with (1.96.0), with rustfmt, clippy and the wasm32-unknown-unknown target, and rustup installs all of it the first time you run cargo in the repository. Your machine and CI run the same clippy, so its lints do not change under you. Moving to a newer Rust is a pull request of its own, with whatever its new lints ask for. The same goes for Ubuntu: the workflows run on ubuntu-24.04, the image the Linux releases are built on, and not on ubuntu-latest, which GitHub moves to each new release.

rust-version in Cargo.toml is the oldest Rust the workspace builds with: 1.96 too, because 1.95 cannot infer some of the types in claudius. The msrv job in CI checks it.

System packages

macOS: the Xcode command line tools (xcode-select --install), for the C and C++ that some crates compile (SQLite, signalsmith-stretch) and the clang runtime that ONNX Runtime links against.

Linux (Debian and Ubuntu; the list is what a bare ubuntu:24.04 needs on top of a compiler):

sudo apt install build-essential pkg-config libssl-dev libasound2-dev libclang-dev

pkg-config and libssl-dev let ort download ONNX Runtime at build time (only builds with the ears need them), libasound2-dev is ALSA for the studio’s audio output (only builds with the studio window), and libclang-dev is for the bindgen step of signalsmith-stretch. On Fedora: sudo dnf install gcc-c++ pkgconf-pkg-config openssl-devel alsa-lib-devel clang-devel. The native studio window also needs X11 or Wayland and OpenGL at run time, which any desktop has; no -dev packages are needed for them.

The Linux build needs glibc 2.38 or newer (Ubuntu 24.04, Debian 13, Fedora 39), because the ONNX Runtime library that ort downloads was built against it.

Windows builds are experimental and not checked yet: you need the Visual Studio C++ build tools and LLVM (for bindgen). Build without the ears there (below).

Features

claudius has two cargo features, both on by default:

  • ears: earshot’s listening models, through ONNX Runtime. Without it the verdicts use meters and music theory, claudius setup skips the models, and claudius doctor says “ears: not in this build”. ONNX Runtime has no build for Intel Macs, so they never get the ears, and the Windows build leaves them out until someone has run it there with them.
  • studio: the native studio window (egui). Without it claudius studio points you at claudius serve, which still serves the web studio, and the binary links no ALSA, X11 or OpenGL. That is the headless build for Linux servers.

Code that needs earshot goes behind #[cfg(feature = "ears")], the window behind studio. cargo xtask ci checks the builds without each of them, so a gated path cannot stop compiling unnoticed.

Tools

toolwhat it is for
trunk 0.21builds the web studio (WebAssembly)
cargo-nextestruns the tests; cargo xtask ci falls back to cargo test without it
mdBook 0.5builds this book
cargo-denychecks licences, advisories and where crates come from (deny.toml)
typosfinds misspellings (_typos.toml)
git-cliffturns commit messages into release notes (cliff.toml)
lycheechecks the links between the pages of the built site
actionlint, shellcheckcheck the workflows and the scripts in scripts/
gitleaksfinds secrets in commits before they leave your computer (.gitleaks.toml)
osv-scannerchecks the lockfiles against known vulnerabilities (osv-scanner.toml)
Node.js 24runs the website’s smoke test (Playwright)
dmgbuildthe Mac disk image’s window, in scripts/package/macos.sh: pip install --require-hashes -r packaging/macos/requirements.txt

All of them have prebuilt binaries. With cargo-binstall, which downloads those instead of compiling:

cargo binstall trunk cargo-nextest mdbook cargo-deny typos-cli git-cliff lychee

On macOS, Homebrew has all of them too:

brew install trunk cargo-nextest mdbook cargo-deny typos-cli git-cliff lychee actionlint shellcheck node gitleaks osv-scanner

Then turn on the repository’s git hooks, once per clone:

git config core.hooksPath .githooks

pre-commit checks the formatting and scans the staged changes for secrets with gitleaks; pre-push refuses a push to main, which changes only through pull requests.

Building each part

cargo xtask runs the repository’s chores; cargo xtask help lists them. The ones you need day to day:

commandbuildsinto
cargo buildevery crate (the dev profile is optimized, so songs render at a usable speed)target/debug
cargo build -p claudius-cli --no-default-features --features studioclaudius without the ears, as on Intel Macs and Windowstarget/debug
cargo build -p claudius-cli --no-default-features --features earsclaudius without the studio window: the headless buildtarget/debug
cargo xtask webthe web studio, with trunkcrates/claudius-ui/dist
cargo xtask web --plana web studio that runs the scripted plan in its page’s ?plan=, for the site’s end-to-end tests only (the ones that drive the studio, such as record.spec.mjs, download.spec.mjs and phone.spec.mjs; a link could otherwise drive it, the microphone included)target/studio-plan
cargo xtask docsthis booktarget/book
cargo xtask sitethe website: the landing page, the book at /docs/, the studio at /studio/ and the install scripts; --sounds also makes the instruments the studio’s demo plays into /studio/packs/, as the deploy does (web editions of the packs’ pianos, strings, guitars, basses and drum machines, claudius-packs web), downloading the notes they keep into target/demo-soundstarget/site
cargo xtask dista release archive for this machine, as the release workflow builds it (--headless for the Linux server build, --no-ears without the ears)target/dist

The first build downloads ONNX Runtime (about 120 MB) for earshot, into ~/Library/Caches/ort.pyke.io on macOS and ~/.cache/ort.pyke.io on Linux.

For the docs and the site there are live previews: mdbook serve docs rebuilds the book on every save at http://localhost:3000, once cargo xtask docs has written the book’s list of libraries (credits/libraries.md, from Cargo.lock, which git leaves out: without it mdbook stops at a missing chapter); and node site/tests/serve.mjs serves target/site the way Cloudflare does (headers, redirects, the 404 page) at http://127.0.0.1:4321.

Running the studio from source

cargo xtask web                                  # the web studio, once and after changes to the UI
cargo run --release -p claudius-cli -- setup     # the sample packs and the listening models, once (about 4 GB)
cargo run --release -p claudius-cli -- studio    # the native window, with the engine inside
cargo run --release -p claudius-cli -- serve     # or the studio in the browser at http://127.0.0.1:7878

A claudius built in a checkout serves the web studio from crates/claudius-ui/dist of that checkout.

When you work on the UI, NO_COLOR=true trunk serve in crates/claudius-ui rebuilds it on every save and serves it at http://127.0.0.1:8090. Open http://127.0.0.1:8090/?server=http://127.0.0.1:7878 to drive a claudius serve running next to it, or http://127.0.0.1:8090/?mock for the demo that needs no server. (NO_COLOR=true because trunk rejects the common NO_COLOR=1; cargo xtask web sets it for you.)

Before you push

cargo xtask ci runs what every pull request has to pass first: cargo fmt --check, clippy with warnings as errors on every target, clippy and cargo check of the builds without the ears or the studio window, the tests, and the examples in the docs. CI runs more; when you changed the matching part, run it too:

you changedrun
the docs or the sitecargo xtask site, then lychee --offline --include-fragments --root-dir "$PWD/target/site" 'target/site/**/*.html' for the links, and npm ci && npx playwright test in site/
recording or choosing files in the browser (audio/web_record.rs, audio/take.rs, record-worklet.js, pick.rs, the Record window)cargo clippy -p claudius-ui --target wasm32-unknown-unknown --features plan -- -D warnings, then cargo build --bin claudius && cargo xtask web --plan and npx playwright test tests/record.spec.mjs tests/files.spec.mjs in site/, which record in Chromium with a file for a microphone and a MIDI keyboard they play themselves, and choose files as a person would (they skip without those builds)
saying what to do to the palette (claudius_session::hearing, claudius_intent::spoken, the palette’s microphone)CLAUDIUS_WHISTLE_CLIPS=DIR cargo test --release -p claudius-session --test hearing -- --nocapture, with a folder of clips each beside its words; then, with those builds, CLAUDIUS_SPEECH=clip.wav CLAUDIUS_SPEECH_WORDS="turn the bass down by three decibels" CLAUDIUS_WHISTLE_MODEL=whistle.cact npx playwright test tests/palette.spec.mjs in site/, which says the clip to the palette’s microphone in Chromium and waits for its words in the field (it skips without them)
the web studio, the demo or the phone’s pagecargo build --bin claudius && cargo xtask web --plan, then npx playwright test in site/: with those two builds the end-to-end tests that drive the studio run too (without them they skip), as CI’s studio in a browser job runs them
the demo (crates/claudius-ui/src/mock/, its engine’s worker in crates/claudius-web)cargo xtask site, then node site/tests/serve.mjs and listen to http://127.0.0.1:4321/studio/?mock; cargo clippy -p claudius-web --target wasm32-unknown-unknown -- -D warnings
dependenciescargo deny check
anything with words in ittypos
workflows or scriptsactionlint and shellcheck scripts/*.sh scripts/ci/*.sh scripts/package/*.sh .githooks/* .claude/hooks/*.sh
a lockfileosv-scanner scan source --config osv-scanner.toml --lockfile Cargo.lock --lockfile site/package-lock.json
benchmarkscargo bench --no-run
the engine’s main steps (composing, rendering, scripts, judging, encoding, decoding, scratches)CI’s performance job counts their instructions against the base’s and fails one that takes more than 10 % more (Performance tests); cargo xtask perf on Linux with Valgrind counts them as it does. A change that slows one on purpose says so in the description: perf: render +20% (why)
code that the Intel Mac build compilesrustup target add x86_64-apple-darwin, then cargo check --target x86_64-apple-darwin -p claudius-cli --no-default-features --features studio (CI’s intel mac build job)
the engine, as a browser builds itcargo clippy -p claudius --no-default-features --target wasm32-unknown-unknown -- -D warnings (cargo xtask ci runs it)

Making a change

This page walks through one small, complete change: adding a pattern method to the script language, with its test, its documentation, and its pull request. The same steps, in the same order, fit most changes. A genre tweak at the end covers the other common kind.

The change

Strudel has palindrome(): a pattern plays forwards on one cycle and backwards on the next. claudius has rev() and lastOf(), so you can write it as .lastOf(2, |x| x.rev()), but people coming from Strudel look for the name. The change adds .palindrome() as a method on patterns.

First, check it does not exist and see how the neighbours are built:

rg -n 'palindrome' crates/claudius/src            # nothing
rg -n '"rev"|"lastOf"' crates/claudius/src/script/patterns.rs

lastOf(n, f) builds Node::Every(n, n - 1, original, transformed): the transformed pattern plays on every cycle where cycle % n == n - 1. A palindrome is Every(2, 1, p, Rev(p)), so no new kind of node is needed, and queries, the work and event budgets and printing need no changes either.

git switch -c feat/palindrome

The test first

Write the test before the code and watch it fail, so you know it tests the change. Pattern methods are tested in crates/claudius/tests/script.rs:

#![allow(unused)]
fn main() {
#[test]
fn palindrome_plays_backwards_every_other_cycle() {
    let p = script::eval_pattern(r#"s("bd sd hh").palindrome()"#).unwrap();
    let names = |cycle: f64| p.events(cycle, cycle + 1.0).iter().map(|e| format!("{:?}", e.v)).collect::<Vec<_>>();
    let mut backwards = names(0.0);
    backwards.reverse();
    assert_eq!(names(1.0), backwards);
    assert_eq!(names(2.0), names(0.0));
    // the code is kept, so a song with it prints back into itself
    assert_eq!(p.repr, r#"s("bd sd hh").palindrome()"#);
}
}
cargo test -p claudius --test script palindrome

It fails with Rhai’s Function not found: palindrome (Pattern).

A palindrome applied twice gives back the original pattern, which is a law, and laws belong in crates/claudius/tests/pattern_laws.rs, inside the proptest! block next to reversing_twice_is_the_original:

#![allow(unused)]
fn main() {
#[test]
fn palindrome_twice_is_the_original(src in mini_source()) {
    let a = pattern(&format!("s({src:?})"));
    let b = pattern(&format!("s({src:?}).palindrome().palindrome()"));
    prop_assert_eq!(onsets(&a, 0.0, 4.0), onsets(&b, 0.0, 4.0));
}
}

The code

Pattern methods are registered in crates/claudius/src/script/patterns.rs, in register_patterns. The time transformations sit together; add this after rev:

#![allow(unused)]
fn main() {
engine.register_fn("palindrome", |p: &mut Pattern| {
    p.with(Node::Every(2, 1, Box::new(p.node()), Box::new(Node::Rev(Box::new(p.node())))), ".palindrome()")
});
}

Pattern::with wraps the node and appends .palindrome() to the pattern’s repr, which is what makes a track that uses it print back as written. It keeps the pattern’s kind (sounds, notes, degrees, chords) and its track settings, so note("c3 e3 g3").palindrome().s("pluck") works too. Seeds and randomness need nothing: Every and Rev are deterministic.

cargo test -p claudius --test script palindrome    # passes
cargo test -p claudius --test pattern_laws         # 256 generated patterns, palindrome twice included
cargo test -p claudius --test script               # nothing else changed

Then try it the way a user would, and check the round trip by eye:

echo 'blank("house"); track("hats", s("hh hh*2 oh hh").palindrome());' | claudius script - --print

The output should contain track("hats", s("hh hh*2 oh hh").palindrome()); exactly. Render a short song with it and listen: claudius script with the same code and --no-ears writes a song folder in a few seconds.

The documentation

A language change is not finished until the people using the language can find it:

  1. The language reference (docs/src/language/pattern-functions.md): an entry in the section on time, with what it does, an example and what you hear. Use a plain js fence, so docs_examples runs it; once the method exists it passes. On this page the example is marked no-run, because the method does not exist yet:

    track("perc", s("rim ~ rim [rim rim]").palindrome());   // the figure, then the figure backwards
    
  2. The quick reference (docs/src/language/quick-reference.md): one row.

  3. crates/claudius/src/script_reference.md: add .palindrome() to the time row. This file is built into the program; claudius reference, GET /api/reference and the MCP tool script_reference return it, so it is what assistants read before writing scripts. the_reference_examples_run in tests/script.rs runs its examples.

  4. Coming from Strudel, if it lists palindrome as missing.

Then run the examples:

cargo test -p claudius --test docs_examples

Before the pull request

cargo xtask ci

runs formatting, clippy with warnings as errors, every test and the docs examples, as CI will. Fix what it reports rather than silencing it; Code style and review explains the few lints the engine allows and why.

The pull request

The title is a Conventional Commit, written for the people who use claudius, because it becomes the commit message on main and the line in the changelog:

feat(script): add .palindrome() to patterns

The description follows the template: what changes and why (“Strudel users look for palindrome; it is lastOf(2, rev) under a name they know”), how you checked it (the tests, and that you listened to a render), and anything a reviewer should look at closely (here, nothing: no new node, no change to printing).

A maintainer reviews it against the checklist in Code style and review. Changes requested on the branch are pushed as new commits; the pull request is squash-merged with its title, so the history on main stays one line per change. You never touch the version or the released sections of CHANGELOG.md: the release process writes the changelog from the titles (Releasing). A note that needs more than the title, such as an upgrade step, goes under ## [Unreleased] in the same pull request.

A genre tweak

The other common change is musical: a different weight, template or form in a genre. Say house’s hats should play the open hat less often. In crates/claudius/data/genres/house.json, the ohat lane’s template has a probability per sixteenth; lower the ones you want rarer, then:

cargo test -p claudius --test generators       # fails: the house snapshot changed
cargo insta review                             # read the diff, accept it if it is what you meant
claudius make --genre house --seed 42 --short --no-ears    # and listen

The snapshot in crates/claudius/tests/snapshots/generators__house.snap shows the change as step strings, so the reviewer reads drum ohat main (drum open_hat): ..x...x...x...x.|..x...x...x...x.|... becoming something sparser and can judge it without running anything. Say in the pull request how it sounds, before and after. A genre file can also be tried without rebuilding: put a copy with the same name in your genres folder (Files and settings).

Code style and review

The short version: run cargo xtask ci before you push, make the change do one thing, and write code that reads like the code around it. The rest of this page is what that means here, and what a reviewer looks at.

Formatting and lints

  • rustfmt with the repository’s rustfmt.toml: max_width = 120 and use_small_heuristics = "Max", so short expressions stay on one line and lines may run to 120 columns. cargo fmt --all formats everything; CI checks it.
  • clippy must be clean with -D warnings on every target: cargo clippy --workspace --all-targets --locked -- -D warnings. The studio is also checked for wasm32-unknown-unknown, since native builds never compile its web-only code, and the builds without the ears or without the studio window are checked too, since code behind cfg(feature = ...) compiles only there. cargo xtask ci runs all of these except the web one, which is cargo clippy -p claudius-ui --target wasm32-unknown-unknown --locked -- -D warnings.
  • The engine allows four lints crate-wide, in crates/claudius/src/lib.rs: needless_range_loop, too_many_arguments, type_complexity and should_implement_trait. DSP code reads best as index loops over parallel buffers, and processors take their full parameter lists. Do not add allows elsewhere without a comment that says why the lint is wrong in that place.
  • typos checks spelling in code, comments and docs. Domain words it does not know (caf, thr) go in _typos.toml with a comment.
  • Edition 2024 and the minimum Rust version in Cargo.toml (rust-version). Let-chains (if let ... && let ...) are used throughout; use them where they read better than nesting.

How the code reads

  • Like its neighbours. Match the naming, the error style and the density of the module you are in. A new function in theory/ looks like the functions already there.
  • Comments state what the code cannot. A constraint, a reason, a unit, a source: // a noise-built tail reads as hiss above ~9 kHz: real rooms and plates are darker up there, or // SAFETY: set once, before any thread of this test binary reads the environment. Not what the next line does, not the history of the change, not why your version is right; that belongs in the pull request.
  • Doc comments are short lowercase phrases that say what a thing is or returns: /// the sound for a genre's preset entry: alternatives separated by |, the first that exists wins. Module comments (//!) explain the module’s job in a paragraph, so a reader knows whether they are in the right file.
  • Units are in the name when they are not the defaults (beats, MIDI pitch, dB, 48 kHz): attack_ms, size_mb, lufs.
  • Errors are written for the person who will read them. Say what was wrong, show the value, and say what would work: cannot read key 'H minor' (try "A minor", "F#m", "Eb", "D dorian"). Script functions return String errors that surface verbatim in the studio and in MCP replies; binaries use anyhow with context. Nothing panics on user input, a file’s contents or a network answer.
  • Randomness is seeded. Draw from rng::Rng, seeded from the song, forked per area with a label; patterns and the pack player use hashes of event positions. Never a thread-local generator or the clock.
  • Data over code. Musical knowledge goes in genre files, effects are serde data, and new fields in serialised types get #[serde(default)], so older blueprints, genre files and API clients keep working.

What reviewers check

Every pull request is read for these. Pre-empting them in the description saves a round trip.

  1. One thing, explained. The change does one thing, and the description says why, not only what.
  2. Tests. New behaviour is tested; a bug fix comes with a test that failed before it. Music-facing changes show their effect: a snapshot diff, a verdict, or a render you listened to and describe.
  3. Docs. User-visible behaviour changes the book in the same pull request, js examples included, and script_reference.md when the script language changes, since assistants read it.
  4. Determinism. The same seed still gives the same song, or the snapshot diff shows exactly what changed and the description says it is intended.
  5. The round trip. Anything new that a blueprint stores and a script can say prints back into the same blueprint (script/print.rs, and the tests in tests/script.rs).
  6. The sandbox and the file policy. New script functions do no I/O beyond what resolve_sound already does; new commands that take paths check them with config::path_allowed or config::write_allowed; nothing new listens on the network or skips the guard (Security model).
  7. Error messages. Read the failure path: is the message one a person can act on?
  8. Performance. Rendering and pattern queries are hot paths: no allocation per sample, no lock held across a render. For changes there, cargo bench -p claudius before and after. CI’s performance job counts the instructions of the engine’s main steps against the base; a slowdown the description accepts (perf: render +20%) needs its reason there.
  9. Compatibility. The HTTP API’s types and the blueprint format stay readable by older clients and files: every song a release saved still opens, and so do its song folder and history (the two tests/compat.rs hold a change to them), and a new field has a serde default. A change songs cannot take as they are raises BLUEPRINT_FORMAT with an upgrade step; a breaking change is marked ! in the title and explained.
  10. Dependencies. A new crate needs a reason, a licence on deny.toml’s list (permissive, plus MPL-2.0), and preferably no C. Sample data needs a licence that fits 0007.
  11. The title. A Conventional Commit that makes sense as a changelog line to someone who uses claudius.

Reviewing

Review the change, not the person: say what you would do instead and why, and separate what must change from what you would merely prefer. Approve when the checklist holds; small follow-ups can be issues. A maintainer merges with squash, using the pull request’s title, once CI’s ci ok passes.

When you review a pull request written with an AI agent, review it like any other: the author is responsible for it, and Working with AI agents describes what is expected.

Benchmarks

A change to the critic, the analysis of recordings, the stems, the request model or the generator’s choices cannot be read off its diff: a threshold moved, a model taught again or a new way of writing a part may make claudius better or worse, and usually better on some music and worse on other music. So each such change is an experiment, run on a benchmark and compared with the last accepted change before it ships. AGENTS.md has the rules in short; this page says why they are what they are and how to follow them.

Real music is the yardstick

claudius is meant to make music that stands next to the music people listen to, and to hear recordings the way people hear them. Both are measured on real songs. A benchmark built from claudius’s own songs measures claudius against itself: songs made before and after a change and judged by claudius’s own critic tell you whether something broke, never whether claudius got closer to real music, and tuning on them pulls claudius further from it.

A benchmark’s songs are many and varied: many in each genre, across decades, languages and cultures, instruments, and ways of mixing and producing. A handful of songs from one source shows how claudius does on that source. Each song carries where it comes from and under what licence, and the labels it is sliced by (genre, decade, language, source). The audio stays out of the repository; a benchmark names its songs and how to fetch them.

A baseline, and an experiment against it

Every accepted change keeps its benchmark results as the baseline: not only the totals but each item’s result (each request read right or wrong, each song’s section score), so that the next experiment can be paired with it item by item. An experiment runs the same benchmark, at the same settings, on the same items. The baselines are kept in baselines/ at the root of the repository, one file a benchmark, and the pull request whose change is accepted replaces its benchmark’s file with its own results.

Pairing matters because items differ far more than versions do. Two versions’ averages over 300 songs can sit within noise of each other while one version is better on 40 songs and worse on 10; the pairs show that, and the averages hide it.

The statistics

Give each comparison as the difference, its 95% confidence interval and a significance test, overall and in each slice. Which test depends on what each item yields:

Each item yieldsTestInterval
right or wrong (a request read right)McNemar’s exact test on the items right in one version and wrong in the otherbootstrap over items
a score (a song’s section F-measure, a critic’s error on a song)Wilcoxon signed-rank test on the paired differencesbootstrap of the mean difference over items
a measure of the whole set (agreement with people as a rank correlation, a distance between two sets of songs)paired bootstrap: resample the items, recompute the measure for both versionsthe bootstrap’s percentiles

Use at least 10,000 bootstrap resamples. Slices are many tests at once, so correct them together (Holm’s method) before saying a slice got worse. Before running, say how large a difference the benchmark can show: with too few items a real gain is “not shown”, not “no change”, and the answer is more items, not a looser test.

Comparing two runs

cargo xtask bench compare BASE NEW does the comparison above for two runs of a benchmark: the baseline’s results and the experiment’s. Each file holds a line of JSON for each item:

{"item": "a1f3c09e", "slice": {"set": "round10"}, "metrics": {"right": true, "wrong": false},
 "better": {"wrong": "lower"}, "primary": ["right"]}

Each line is one item, here on two lines to fit. item is the same id in every run of the benchmark; slice the labels it is counted under; each metric is true or false (right or wrong) or a number (a score), better higher unless better says lower. primary names the metrics the change is made to improve; the others are guards it must not make worse (without it, every metric is primary, and with it empty, "primary": [], none is: the change is judged on a measure of the whole set by a test of its own, and these are its guards), but for those shown names: compared and shown, never judged, for a level of which neither more nor less is better. The command prints, for each metric, the whole set and every slice with the difference, its interval, the items better and worse and the test, then the ids of the items that got worse, as Markdown for the pull request. Which way a metric went is its test’s: for a score, whether the ranks of the items that got better outweigh those of the items that got worse, so that a few items much better cannot carry a change most items got worse with. It fails unless each primary metric is better overall, its mean too, and no metric is worse overall or in a slice after Holm’s correction, and when there is nothing to compare (no items, or a primary metric no item has); --report prints the same without failing. Its paths are taken from the root of the repository, as every cargo xtask path is.

When a change ships

A change ships when it improves its benchmark significantly and no slice gets significantly worse. Name the items that got worse even then, and look at them: a song made worse is a song a person will hear. When the change does not pass, iterate on it until it does. Never move the bar, drop items or loosen a test to get a pass.

Settings are chosen on one part of a benchmark and the result is reported on another part the tuning never saw. Some sets are sealed: written before the version they measure and read only through their scores, so that nobody working on claudius learns their items. Never print, open or quote a sealed item.

In the pull request

The pull request names the benchmark and the baseline it was compared with, and shows the comparison: the difference with its interval and test, each slice, and the items that got worse. When the change is accepted, its results become the next baseline.

Benchmarks today

  • The request model: the rounds in crates/claudius-intent/tests/asks.rs, typed by people of many kinds before the version they measure. The open rounds print what they miss; the sealed ones only their scores.
  • The critic on real songs: cargo run --release -p claudius --example eval_critic -- DIR judges songs from MTG-Jamendo (independent artists’ releases under Creative Commons licences, in every genre) as they are, and with each of seven flaws a listener hears put into them (clipped, muddy, thin, noisy, gaps, a copy a semitone up, a copy falling out of time), and writes a line for bench compare for each. What a change to the critic is made to improve is how often a song is judged above its flawed copy; it must not judge more real songs bad, nor praise more flawed ones. The total of a song as it is is shown, not judged: a critic rating every song 100 would raise it. Each shard of the dataset is a random one percent of it: choose settings on shards 0 and 1, and report the result on shard 2 (--shards 2..2), which the tuning never saw. It holds no chart hits: what it says of the songs people hear most is still to be measured.
  • The generator against real music: cargo run --release -p claudius --example eval_genres -- embed DIR --shards 0..4,15..19,35 --top-up 40 hears the songs of MTG-Jamendo that stand for claudius’s genres (by their tags), CLAP’s embedding of each: those of eleven shards, and from the other shards, in the order of their track ids’ SHA-256, as many as bring each genre to 40 in each half, each fetched from its shard by byte ranges. run REAL then composes claudius’s songs of each genre and hears them the same way, writing a line for bench compare for each genre: the kernel audio distance to the genre’s real songs (KAD, what a change to the generator is made to lower), how typical its songs are and how often each is heard as its own genre (guards), and how much they differ from one another (shown). Tune on the even shards (--half tune, seeds 1 to 20) and confirm on the odd ones (--half confirm, seeds 101 to 120). A change to one genre or a few is judged on its songs: run --songs FILE writes a line for each, and kad REAL BEFORE AFTER tests the genres’ KAD on two runs’ lines, made with the same seeds, by the paired bootstrap over the seeds; bench compare on the same lines keeps how typical each song is and whether it is heard as its genre as guards. The 2,590 real songs measure 23 genres, 15 songs or more in each half; amapiano, phonk and synthwave have no honest tag, and hardstyle and reggaeton too few songs. The real songs’ embeddings are not kept here: the songs’ licences are the artists’ own.
  • The analysis of sections and of where a cut falls: the examples eval_structure (JamendoLyrics and SALAMI) and eval_cuts (JamendoLyrics), which print their measures.

Writing docs

The docs have three audiences, and each page is written for one of them:

  • People who have never made music. The “Learn to make music” chapters. Every musical word is explained the first time it appears, with something to listen to.
  • Producers and musicians. The “For producers” chapters and the cookbook. They know what a ii–V–I or a sidechain is; tell them how claudius does it and where it differs from their DAW.
  • Engineers. The engineering chapters, the design records and the contributor guide. They want to know how the code works and why it is built that way.

The language reference serves everyone: it is the precise description, and the tutorials link into it.

Voice

Write the way you would explain something to a colleague sitting next to you: plainly, in full sentences, with the thing on screen. Use “you”. Use the present tense. Say what happens, not what “can” or “will” happen.

Be specific. “The kick drops out for the last bar of a build” is useful; “builds add tension” is not. If a sentence would be true of any music software, cut it.

Prefer one good example to three paragraphs of explanation. Show the code, say what you will hear, then explain the part that is not obvious.

Keep paragraphs short. A page that needs a summary at the end is too long or badly ordered.

Words we do not use

These either say nothing or sound like a brochure: comprehensive, robust, seamless, leverage, delve, unlock, empower, elevate, harness, cutting-edge, state-of-the-art, game-changer, effortless, blazing, powerful, world-class, journey, dive in, deep dive, in today’s world, whether you’re X or Y, it’s worth noting, in conclusion.

Avoid simply, just and easy: if the reader is stuck, they now also feel stupid. Avoid exclamation marks and emoji. Do not open a page by restating its title, and do not end it by restating what it said.

Formatting

  • Headings in sentence case: “Song structure”, not “Song Structure”.
  • Code, function names, file names and commands in backticks: track(), song.rhai, claudius serve.
  • Units with a space: 124 BPM, −6 dB, −9 LUFS, 8 kHz. Bars and beats are counted from 1 in prose (“the snare on beats 2 and 4”), steps from 1 too (“a hit on step 5”).
  • Tables are for reference material (function lists, parameters). Explanations go in prose.
  • Link the first mention of a function to its entry in the language reference.

Examples are tested

Every fenced block marked js is run by cargo test -p claudius --test docs_examples, so an example that stops working fails the build. The fence’s info string says how:

fencewhat the test does
```jsruns it with the sample packs switched off, as on CI; it must succeed
```js packsruns it when the sample packs are installed (it uses sampled instruments or kits)
```js errorruns it; it must fail (for showing error messages)
```js no-runshows it without running it (fragments, signatures)

An example runs against an open song: house, seed 9, with the tracks kick clap hat ohat shaker perc bass chords pad lead arp, the sections intro groove break drop outro and the progressions A and B. An example that starts its own song with song(...) or blank(...) does not depend on any of that.

Lines starting with ~ are run but hidden on the page, for setup the reader does not need to see:

blank("house");
tempo(124);
track("kick", s("bd*4"));

When you show output (a verdict, a log line, an error), paste what the program printed. Do not paraphrase it.

Music terms

In the “Learn to make music” chapters, explain a term the first time it is used and give the reader a way to hear it. “A bar is a group of four beats; count 1 2 3 4 along with the kick” is better than a definition from a dictionary.

Elsewhere, assume the reader knows the term, and link to the beginner chapter that explains it.

Accuracy

Run what you describe. If the docs and the program disagree, the program is right and the docs get fixed, or the program has a bug and gets an issue. Do not describe features that do not exist yet.

Checking your work

cargo test -p claudius --test docs_examples   # every example runs
cargo xtask docs                               # builds the book into target/book

Releasing

A release is made by merging a pull request. Nobody bumps a version or pushes a tag by hand: one workflow opens the release PR, and merging it builds the archives, publishes the GitHub release, updates Homebrew and deploys the website. A person can do all of it in the GitHub web interface, and an agent with gh (see Working with AI agents).

Versions

claudius follows semantic versioning. The version lives in one place, version under [workspace.package] in the root Cargo.toml, and every crate that says version.workspace = true has it. (earshot keeps a version of its own, and xtask is never released.)

Before 1.0, the minor version is the one that may break things:

bumpfrom 0.4.2for
patch0.4.3fixes, and changes that leave scripts, saved songs, the HTTP API and the MCP tools working as they did
minor0.5.0new features, and anything that changes the script language, the song format, the API or the tools (the changelog says how)
major1.0.0the promise that none of that breaks again without a major version; a decision, not a routine bump

An exact version works too: 0.5.0-rc.1 makes a pre-release, which GitHub does not mark as the latest, so the install scripts keep installing the last full release (CLAUDIUS_VERSION=0.5.0-rc.1 installs the pre-release). Homebrew and the website stay on the last full release as well.

Commit messages are the changelog

Pull requests are squash-merged, and the PR title becomes the commit message on main, so the title has to be a Conventional Commit: type(scope): what changed, with ! after the type or scope for a breaking change. The pr title check enforces it. When a release is prepared, git-cliff (cliff.toml) sorts the commits since the last tag into the sections of CHANGELOG.md:

titlesection
feat(script): add euclid() to patternsAdded
fix(server): keep the session when a render failsFixed
fix(security): ...Security
perf(render): mix the stems in parallelChanged
docs: a chapter on swingDocumentation
refactor, test, build, ci, choreleft out, unless breaking (refactor!: ...), which goes to Changed

Breaking changes are marked Breaking: in their section, and (#123) at the end of a title becomes a link to the pull request.

Anything worth more than a line (what a release is about, how to update scripts that break) goes under ## [Unreleased] in CHANGELOG.md, in the pull request that makes the change. The release keeps it at the top of its section and adds the generated entries under the headings of the same name.

Every day

claudius releases itself every day that main has something to release. At 16:17 UTC (03:17 in Sydney in summer), daily-release.yml asks cargo xtask release next what the commits since the last release tag call for, from their titles, by the rules of Versions:

since the last releasereleases
a breaking change (type!:, or a BREAKING CHANGE: footer)the next minor version before 1.0, the next major from 1.0
a feature (feat)the next minor version
a fix or a change of performance (fix, perf)the next patch
only docs, refactors, tests, builds, CI and choresnothing: no release that day

When it is a version, the workflow starts release-pr.yml with it (step 1 below), turns on auto-merge for the release PR, waits until GitHub has merged it once ci ok passes (about half an hour), and starts release.yml, which publishes the release (step 4). It does all of that with its own GITHUB_TOKEN. GitHub starts no workflow for what that token does, except a dispatch, so the merge alone would not start release.yml, and the workflow starts it itself. The runs the release PR does start wait for someone to approve them, as an outside contributor’s do (the bot is one to the repository’s approval of workflows), and a waiting run of CI hides the ci ok of the one dispatched from the PR’s checks, so that the PR would never merge: the workflow approves them as they come.

  • gh workflow run daily-release.yml -f dry_run=true says what it would release, and releases nothing.
  • A release PR an earlier day left open (its checks failed, or main moved on before it could merge, since ci ok has to have passed on a branch up to date with main) is closed, and the day’s release starts from main as it is. One opened in the last 20 hours may be someone’s release by hand, so the day’s release waits for it instead.
  • When the version on main has its section in CHANGELOG.md but no release (its release.yml failed), the day’s run starts release.yml again, and nothing new goes out until that version has.
  • A failed day says why in its run, and GitHub emails it, as any failed workflow.

gh workflow disable daily-release.yml stops the daily releases, and gh workflow enable daily-release.yml starts them again. Releasing by hand, below, works the same with or without them.

Making a release

  1. Start it. From the command line:

    gh workflow run release-pr.yml -f bump=minor
    

    or in the web interface: Actions, release pr, Run workflow. The workflow runs cargo xtask release prepare minor, which changes four things and adds a fifth: the version in Cargo.toml (and the version = "..." of path dependencies between workspace crates, which cargo add --path writes), the workspace entries in Cargo.lock, CHANGELOG.md, where Unreleased becomes ## [0.5.0] - <today> with the notes from git-cliff, the version of the Claude Code plugin in skills/.claude-plugin/plugin.json, and the songs 0.5.0 saves with a song’s folder and its history, in crates/claudius/tests/compat/v0.5.0/, which every later release has to open (saved songs keep opening). It commits that to the branch release/v0.5.0 through GitHub’s API, so that GitHub signs the commit (main accepts only signed commits), and opens the PR release: v0.5.0, with the notes in its description.

  2. Let CI run. GitHub starts no workflows for a pull request opened with a workflow’s own GITHUB_TOKEN, so the workflow starts CI on the release branch itself (gh workflow run ci.yml --ref release/v0.5.0); the checks show on the PR as usual. If they are missing, run that command yourself. Runs on the PR that wait for approval (Approve and run on their page, or gh api -X POST repos/devlato/claudius/actions/runs/<id>/approve) hide its checks until they are approved, which the daily release does itself. With the optional RELEASE_TOKEN secret (see below) the PR is opened with that token instead and starts its checks like any other.

  3. Read the notes, then merge. To reword them, edit CHANGELOG.md on the release branch. Merge the PR once ci ok passes.

  4. The release builds itself. The merge changes Cargo.toml on main, which starts release.yml:

    • plan decides whether this commit is a release: it is on main and is the merge of the release PR, CHANGELOG.md has a section for the version in Cargo.toml, and there is no published release for it yet;
    • web studio builds the WebAssembly studio once, for every archive;
    • build runs cargo xtask dist --target <target> on one runner per target (below), on Linux cargo xtask dist --target <target> --headless and scripts/package/linux.sh too, which makes the .deb, .rpm and AppImage, and on Windows scripts/package/windows.ps1, which makes the installer with WiX;
    • macOS app puts each Mac build into Claudius.app and a disk image of its own, one for Apple silicon and one for Intel, with scripts/package/macos.sh, signing and notarizing them when the Apple secrets below are set;
    • release notes writes the notes: cargo xtask release notes 0.5.0 and install instructions;
    • publish checks that each build uploaded only its own archives and that they match their .sha256, writes SHA256SUMS for the archives and the install scripts, signs a build provenance attestation for them, creates the release as a draft, uploads the files, and publishes it, which creates the tag v0.5.0 on the merge commit;
    • homebrew tap updates Formula/claudius.rb in devlato/homebrew-tap;
    • site deploys the website with the new version, changelog and docs.

    No job in release.yml restores a cache: everything a release links is built or downloaded (and checked) in that run, so nothing another workflow wrote into the Actions cache can end up in an archive. publish and homebrew tap, which hold the tokens, run no cargo at all, and run in the environment release, which only main and the hotfix branches may use. When RELEASE_REVIEWERS was given to scripts/github-setup.sh, the run waits at publish until one of them approves it (Review deployments on the run’s page).

  5. Check it. Verifying a release below.

To see what release prepare would do without opening a PR, run it locally and look at the diff, then throw it away: cargo xtask release prepare minor && git diff, then git checkout -- ..

What a release contains

filewhat
claudius-0.5.0-<target>.tar.gz (.zip on Windows)the programs, the web studio and the docs that go with them
claudius-0.5.0-<target>-headless.tar.gz (Linux)the same without the studio window, for servers
claudius-0.5.0-aarch64-apple-darwin.dmg, claudius-0.5.0-x86_64-apple-darwin.dmgClaudius.app for Apple silicon and for Intel Macs, to drag to Applications
claudius-0.5.0-x86_64-pc-windows-msvc.msithe Windows installer: the programs on the user’s PATH and the studio in the Start menu
claudius-0.5.0-<target>.deb, .rpm, .AppImage (Linux)packages for Debian and Ubuntu, Fedora and its relatives, and any distribution, with the studio in the app menu
install.sh, install.ps1the install scripts, which releases/latest/download/install.sh points at
SHA256SUMSthe SHA-256 of every archive and both install scripts; the install scripts check downloads against it

Each archive unpacks into a directory of the same name, laid out the way claudius looks for its files:

claudius-0.5.0-aarch64-apple-darwin/
  bin/claudius
  bin/claudius-packs
  share/claudius/web/        the web studio; claudius finds it at <its own directory>/../share/claudius/web
  README.md  LICENSE  CHANGELOG.md
targetbuilt onarchives
aarch64-apple-darwinmacos-latestthe studio and the ears
x86_64-apple-darwinmacos-latest, cross-compiledno ears: ort has no ONNX Runtime for Intel Macs
x86_64-unknown-linux-gnuubuntu-24.04the studio and the ears, and a -headless one; glibc 2.38 or newer
aarch64-unknown-linux-gnuubuntu-24.04-armthe same
x86_64-pc-windows-msvcwindows-latestexperimental, no ears

Without the ears, verdicts use meters and music theory. xtask/src/dist.rs says which targets leave them out (NO_EARS): ort has no ONNX Runtime for Intel Macs, and its Windows ONNX Runtime always links DirectML and DirectX 12, which nobody has run yet. The -headless Linux archives, claudius-0.5.0-<target>-headless.tar.gz, leave out the studio window, so they need neither ALSA nor a display; they still contain the web studio, which claudius serve serves. install.sh picks the headless archive when ALSA’s libasound.so.2 is missing, or with --headless.

The Windows build is experimental: when it fails, the release goes out without it, and the install script tells people on Windows that there is no build for them. The Linux builds cannot target an older glibc: the ONNX Runtime library they link was itself built against glibc 2.38.

The archives do not include ffmpeg, the sample packs or the listening models. claudius setup downloads the packs and models; ffmpeg is optional.

Verifying a release

gh release view v0.5.0
gh release download v0.5.0 --pattern 'claudius-0.5.0-aarch64-apple-darwin.tar.gz' --pattern SHA256SUMS
shasum -a 256 --check --ignore-missing SHA256SUMS
gh attestation verify claudius-0.5.0-aarch64-apple-darwin.tar.gz --repo devlato/claudius \
  --signer-workflow devlato/claudius/.github/workflows/release.yml --source-ref refs/heads/main

The checksum says the file is the one that was uploaded. The attestation says more: that the archive was built by release.yml in devlato/claudius, from a specific commit on main, on GitHub’s runners. gh attestation verify checks its Sigstore signature and prints the workflow and the commit. Without --signer-workflow and --source-ref it would accept a build by any workflow on any branch of the repository. A hotfix release is built from its branch, --source-ref refs/heads/hotfix/v0.5.1; the release notes give the command with the right one.

The installers come with the release and are in its checksums, so curl ... releases/latest/download/install.sh now installs the new version:

gh release download v0.5.0 --pattern install.sh --pattern SHA256SUMS --clobber
shasum -a 256 --check --ignore-missing SHA256SUMS

The website

The site is on claudius.devlato.com. site.yml builds it with cargo xtask site, without a cache or secrets, and hands it to a deploy job that does nothing but upload it to Cloudflare, in the environment site, as the static assets of the Worker that site/wrangler.toml describes, with its custom domain. It deploys once the repository variable SITE_URL gives the address (gh variable set SITE_URL --body https://claudius.devlato.com) and the Cloudflare secrets below are set. Until then it builds and checks the site and deploys nothing. It deploys main:

  • after a release, in a run release.yml starts once the release is out (a run of its own, as a workflow it called would get none of the environment’s secrets);
  • on pushes to main that change docs/, site/, CHANGELOG.md or the install scripts, so the docs follow main (except the merge of a release PR, which waits for the release, so that the site never shows a version that cannot be downloaded yet);
  • by hand: gh workflow run site.yml.

Pull requests build the site and deploy nothing: a preview would run the Cloudflare token next to a branch nobody has reviewed yet.

cargo xtask site fills in {{version}} (from Cargo.toml), {{site_url}} and {{repo_url}} in the files of site/. The install commands on the site point at the release’s own install.sh and install.ps1, so they work wherever the site is served.

Secrets and settings

secretenvironmentused bywithout it
CLOUDFLARE_API_TOKENsitesite.ymlthe site is built but not deployed (a notice says so)
CLOUDFLARE_ACCOUNT_IDsitesite.ymlthe same
HOMEBREW_TAP_TOKENreleaserelease.ymlthe Homebrew formula is not updated
RELEASE_TOKEN (optional)release-prrelease-pr.ymlthe workflow opens the release PR with its own token and starts CI itself
MACOS_CERTIFICATE, MACOS_CERTIFICATE_PASSWORDreleaserelease.ymlthe Mac app is signed ad hoc, and macOS asks before opening it
MACOS_NOTARY_KEY, MACOS_NOTARY_KEY_ID, MACOS_NOTARY_ISSUERreleaserelease.ymlthe Mac app is signed but not notarized, so macOS still asks

Each secret lives in an environment, not in the repository, so it reaches only the job that needs it, and only when that job runs on main (or, for release, a hotfix branch): a workflow pushed to some other branch cannot read it. Set each one with gh secret set <NAME> --repo devlato/claudius --env <environment>, which reads the value from standard input.

Cloudflare. In the Cloudflare dashboard, My Profile, API Tokens, Create Token: the template Edit Cloudflare Workers, for your account and the zone of the site’s domain, with an expiry date. The account ID is on the Workers & Pages overview. The domain in site/wrangler.toml has to be a zone on the same account: the first deploy creates its DNS record and certificate. That first deploy can be made by hand, after npx wrangler login:

cargo xtask site --site-url https://claudius.devlato.com
npx wrangler deploy --config site/wrangler.toml

The Worker has a Durable Object, the rooms of the relay between the studio demo and a phone (site/worker/room.js): SQLite-backed, as the Workers Free plan allows, and kept by nothing, so the deploy that first carries it creates its class from the [[migrations]] in site/wrangler.toml, and a later one changes it only with a migration of its own.

Apple. Both need a membership of the Apple Developer Program. In Xcode, Settings, Accounts, Manage Certificates, add a Developer ID Application certificate, then export it from Keychain Access as a .p12 file with a password: MACOS_CERTIFICATE is the file in base64 (base64 -i developer-id.p12 | gh secret set MACOS_CERTIFICATE --repo devlato/claudius --env release), and MACOS_CERTIFICATE_PASSWORD its password. For notarization, in App Store Connect, Users and Access, Integrations, Team Keys, make a key with the Developer role: MACOS_NOTARY_KEY is the text of the .p8 file it downloads, MACOS_NOTARY_KEY_ID its key ID, and MACOS_NOTARY_ISSUER the issuer ID above the list. With all five, the macOS app job signs the app and its disk image with the hardened runtime, has Apple notarize both, and staples the tickets to them, so the app opens without a warning.

Homebrew. Create the repository devlato/homebrew-tap (a README is enough). Then a fine-grained personal access token (GitHub, Settings, Developer settings, Fine-grained tokens) for that repository only, with Contents: Read and write.

Release PRs. RELEASE_TOKEN is a fine-grained token for devlato/claudius with Contents and Pull requests: Read and write. A GitHub App token works as well.

Fine-grained tokens expire, after a year at most. When one has, the job that uses it fails with a 401; make a new token and set the secret again.

The repository settings that the release depends on (squash merges with the PR title, the ruleset that requires ci ok on main, the ones that keep v* tags from being moved or deleted and let only admins push hotfix/* branches, immutable releases, the three environments, and permission for workflows to open pull requests, which release-pr.yml needs without RELEASE_TOKEN) are made by scripts/github-setup.sh, once the repository exists, and again once it is public. Running it again is harmless. Two of its variables change how releases work:

  • RELEASE_REVIEWERS=devlato makes every release wait for that person’s approval before publish runs. Without it, merging a release PR releases.
  • REVIEWS=1 requires an approving review on every pull request. It also stops workflows from opening (and so from approving) pull requests, so release-pr.yml then needs RELEASE_TOKEN.

An approval only means a person looked if the person is the only one holding their token. An agent that works with the maintainer’s own gh login can approve as the maintainer; give agents a token or an account of their own.

Homebrew

brew install devlato/tap/claudius

The formula is rendered from scripts/homebrew/claudius.rb.tmpl: the release workflow fills in the version and the checksums from SHA256SUMS and pushes Formula/claudius.rb to the tap. It installs the archive with the studio window on macOS (Apple silicon and Intel) and Linux; on Intel Macs its caveats say that the build has no ears.

When a release fails

A build failed. Nothing was published and no tag exists. Fix the cause in a normal pull request, then start the release again by hand: gh workflow run release.yml. It builds main as it is then, so the release includes the fix. (The workflow starts by itself only for changes to Cargo.toml or CHANGELOG.md, and the daily release starts it again the next day.)

Publishing failed halfway. A draft release may be left over; the next run of release.yml deletes it and publishes again.

Only Windows failed. It is experimental, so the release is out without its archive. Fix it, and it is in the next release.

The Homebrew or site job failed. The release itself is out. Rerun the failed jobs: gh run rerun <run id> --failed.

Rolling back

A published release stays published: people have downloaded it, and the formula points at it. Do not delete it or move its tag. To stop handing it out while a fix is on its way:

gh release edit v0.5.0 --prerelease     # the install scripts stop picking it
gh release edit v0.4.3 --latest         # releases/latest points at the previous one again

then revert the formula commit in devlato/homebrew-tap, and roll the site back in the Cloudflare dashboard (Workers & Pages, the project, Deployments, Rollback on the deployment before). The fix itself goes out as the next patch release.

Hotfix releases

A fix usually ships with a patch release from main. When main already has changes that should not go out yet, release the fix from the last tag instead:

git fetch --tags
git switch -c hotfix/v0.5.1 v0.5.0
git cherry-pick <the fix's commit on main>
cargo xtask release prepare patch
git add --update && git commit -m "release: v0.5.1"
git push -u origin hotfix/v0.5.1
gh workflow run ci.yml --ref hotfix/v0.5.1          # wait for "ci ok"
gh workflow run release.yml --ref hotfix/v0.5.1

Only admins can create and push hotfix/* branches (a ruleset), and release.yml releases from no other branch but main. The release is built and tagged on the hotfix branch; the site is only deployed from main. Then bring the version and the changelog back to main: open a pull request that cherry-picks the release commit, keeping 0.5.1’s section under Unreleased.

Working with AI agents

AI coding agents work on claudius the way people do: on a branch, through a pull request with a Conventional Commit title, with cargo xtask ci run before every push. Everything after that runs on GitHub and is driven with gh, so an agent can take a change from a branch to a published release, and a person can follow every step in the web interface.

Agents read AGENTS.md at the root of the repository. This page shows the same text, so the rules for people and for agents cannot drift apart. Releasing explains what each release step does.

Rules

  • Never work on main. Make a branch named <type>/<topic>, where the type is the kind of change: feat/euclid-patterns, fix/render-error-session, docs/swing-chapter. Branches named release/* and hotfix/* belong to the release process; do not make them unless you were asked to release.
  • Every change goes in through a pull request whose title is a Conventional Commit, because the title becomes the commit on main and the line in the changelog: feat(script): add euclid() to patterns. The type is one of feat, fix, docs, refactor, perf, test, build, ci, chore; a ! after it marks a breaking change (feat(api)!: rename /api/state). Write it for someone reading the changelog.
  • Run cargo xtask ci before you push. It runs formatting, clippy with warnings as errors (also on the builds without the ears or the studio window), the tests and the examples in the docs, which is what CI checks first. Fix what it finds. If you touched the docs, the site, dependencies or workflows, run the matching checks from docs/src/contributing/setup.md too.
  • Keep the skills in step. skills/ teaches assistants the MCP tools, the commands and the script language. A change to a tool, a command, a message or a function they quote changes the skill in the same pull request; their examples run with the docs examples.
  • Keep the credits in step. A model, a port, a font, a source of sounds or a paper claudius newly draws on goes into docs/src/credits.md in the same pull request. The list of libraries writes itself from Cargo.lock.
  • Keep the two features apart. Code that needs earshot goes behind #[cfg(feature = "ears")], code that needs the native window behind studio. The Intel Mac and Windows builds have no ears, and the headless Linux build has no window, so both have to keep compiling.
  • Leave rust-toolchain.toml and the workflows’ ubuntu-24.04 alone in a change of your own. Moving to a newer Rust or a newer Ubuntu is a pull request of its own, with the lints the new clippy brings or the fixes the new image needs.
  • Keep a pull request to one change, and describe in it how you checked it.
  • Notes for the changelog that need more than the PR title (an upgrade step, a highlight) go under ## [Unreleased] in CHANGELOG.md, in the same pull request.

Experiments

Work on anything that learns or listens (the critic, the analysis of recordings, the stems, the request model, the generator’s choices) and every change that might not be an improvement is an experiment, measured before it ships. docs/src/contributing/benchmarks.md (Benchmarks in the contributor guide) explains why and how.

  • Measure against real music. The yardstick is a large, varied corpus of real songs people listen to: many in each genre, across decades, languages and cultures, instruments, and ways of mixing and producing. Never claudius’s own songs: claudius’s songs before and after a change, judged by claudius’s own critic, show breakage and nothing more.
  • Keep a baseline. Every accepted change keeps its benchmark results, item by item, as the baseline the next experiment is compared with.
  • Compare item by item, with statistics. Run the experiment on the same benchmark, pair each item with the baseline’s, and give the difference with a confidence interval and a significance test, overall and in every slice (genre, decade, language, source). Name the items that got worse, not only the averages.
  • Ship only an improvement. A change goes in when it improves the benchmark significantly and no slice gets significantly worse. If it does not, iterate on it until it does. Never loosen a benchmark, a test or the bar to get there.
  • Tune on one part, confirm on another. Choose settings on a tuning split and report the result on a held-out split the tuning never saw. A sealed set is read only through its scores.
  • Show it in the pull request: the benchmark, the baseline, the comparison, its slices and the items that got worse.

Commands

Make a change and open a pull request:

git switch -c feat/euclid-patterns
# edit, then
cargo xtask ci
git add -A && git commit -m "feat(script): add euclid() to patterns"
git push -u origin HEAD
gh pr create --title "feat(script): add euclid() to patterns" --body "What changes, why, and how I checked it."

Watch the checks, and let GitHub merge once the required check, ci ok, passes:

gh pr checks --watch
gh pr merge --auto --squash

If a check fails, read its log (gh run view <run id> --log-failed), fix the cause on the same branch, and push again.

A release goes out by itself every day that main has a feature, a fix or a breaking change since the last one (daily-release.yml; “Every day” in docs/src/contributing/releasing.md), so there is rarely a need to start one. Release by hand only when the person you work for asks for it:

gh workflow run release-pr.yml -f bump=minor      # or patch, major, or an exact version such as 0.4.0
gh run list --workflow release-pr.yml --limit 1   # the run; `gh run watch <id>` follows it
gh pr view release/v0.4.0                          # the release PR, "release: v0.4.0"; read its notes
gh pr checks release/v0.4.0 --watch                # if no checks appear: gh workflow run ci.yml --ref release/v0.4.0
gh pr merge release/v0.4.0 --squash                # this publishes the release

Then check what was published:

gh run list --workflow release.yml --limit 1       # `gh run watch <id>` until it finishes
gh release view v0.4.0
gh release download v0.4.0 --pattern 'claudius-0.4.0-aarch64-apple-darwin.tar.gz' --pattern SHA256SUMS
shasum -a 256 --check --ignore-missing SHA256SUMS
gh attestation verify claudius-0.4.0-aarch64-apple-darwin.tar.gz --repo devlato/claudius \
  --signer-workflow devlato/claudius/.github/workflows/release.yml --source-ref refs/heads/main
gh release download v0.4.0 --pattern install.sh --pattern SHA256SUMS --clobber && shasum -a 256 --check --ignore-missing SHA256SUMS

Never

  • Push to main or force-push it, or rewrite its history.
  • Get a check to pass by going around it: no --no-verify, no #[allow(...)], #[ignore] or deleted assertions to silence a failure, no edits to workflows or deny.toml that drop a failing check. If a check is wrong, say so in the pull request.
  • Commit secrets, tokens, .env files, downloaded models or sample packs, or anything from target/ and out/.
  • Change the version in Cargo.toml, the released sections of CHANGELOG.md, or v* tags by hand. Versions change only through the release PR that release-pr.yml opens.
  • Start a release or merge a release PR without being asked to.

Claude Code

Claude Code reads CLAUDE.md, which loads AGENTS.md and adds what is particular to Claude Code. .claude/settings.json has it run .claude/hooks/guard.sh before each command and each edit, to hold it to the rules above that a script can check:

  • An edit to a file git tracks needs a branch named <type>/<topic>: not main, and not a detached commit unless a rebase, merge or cherry-pick is under way.
  • --no-verify is refused, and so is pushing a v* tag.
  • git push and gh pr create wait until cargo xtask ci has passed on the commit, with nothing left uncommitted.

The checks run through .claude/hooks/ci.sh, which you can also start yourself. It runs cargo xtask ci the way GitHub’s runners see a machine: with CLAUDIUS_PACKS pointing at nothing and a home of its own, so the packs and models on your computer do not change what the tests do, and with the settings CI builds with (no incremental builds, and debug information only for line tables) unless your environment sets its own. It writes its log to target/claude-ci.log and remembers each tree it passed on, in any worktree of the repository, so a push of that tree from any of them goes out without a second run. One run goes at a time in the repository, because a build in each of two checkouts at once can fill a disk.

Settings of your own go in .claude/settings.local.json, and notes for your own sessions in CLAUDE.local.md; git leaves both out. /effort max lasts only for the session it is typed in; with {"env": {"CLAUDE_CODE_EFFORT_LEVEL": "max"}} in .claude/settings.local.json, every session in the repository starts at the highest effort, at the cost of more tokens.

Credits

claudius is built on other people’s work: the libraries it is made of, the code it ports, the models it listens with, the fonts it draws with, the sounds it plays and the research its engine follows. This page names them, each under its licence. Every library is on Libraries, which the book writes from Cargo.lock.

Models

claudius runs these on the computer itself, on ONNX Runtime or, for Cactus’s models, needle-infer. Each is downloaded from Hugging Face the first time something needs it, and none of them writes music: they listen, tag and read (design 0011, 0014, 0015).

ModelWhat claudius does with itFromLicence
CLAP, larger generalthe ears: how much a sound, a phrase or a song is like words (“a person singing”), and finding sounds by meaningLAION (Wu et al., ICASSP 2023); the ONNX export is Xenova’sApache-2.0
AST, fine-tuned on AudioSetthe ears: which of AudioSet’s sounds a recording holdsMIT (Gong, Chung & Glass, Interspeech 2021); the ONNX export is Xenova’sBSD-3-Clause
CED-Tinythe ears: whether a voice sings in a recording’s separated vocals or an instrument the separation left thereDinkel et al. (CED, ICASSP 2024), as its authors export it to ONNXApache-2.0
Basic Pitchthe notes played or sung in a take or a recordingSpotify (Bittner et al., ICASSP 2022)Apache-2.0
Spleeter, four stemsa recording taken apart into its voice, drums, bass and the restDeezer (Hennequin et al., JOSS 2020), MIT; the ONNX export is Best-Practice’s, Apache-2.0MIT, Apache-2.0
Audiobox Aestheticsthe critic: how much listeners would enjoy a song, and how well it is madeMeta (Tjandra et al., 2025); the ONNX export is Microck’sCC BY 4.0
potion-base-8Mfinding a command, a sound or a genre by the meaning of the words for itMinish Lab (Model2Vec)MIT
Needlereading a request in plain words, in the paletteCactus ComputeApache-2.0
Whistlehearing a request said aloudCactus ComputeApache-2.0

Code it ports

CrateA port ofLicence
earshotearshot, the Python library of “ears” for code: its models run on ONNX Runtime, its signal processing (mel front ends, loudness, onsets, the beat grid) written again in RustMIT
claudius (dsp::stretch)Signalsmith Stretch 1.3.1 and the STFT of its linear library, by Geraint Luff / Signalsmith Audio: the time-stretch and pitch-shift every recording plays through, in the app and the browserMIT
whistleCactus’s JAX reference for Whistle (cactus-compute/cactus at bafcf73: whistle.py, architecture.py, export.py, quantize.py) and the engine’s behaviour Cactus documentsApache-2.0

claudius’s patterns follow TidalCycles’ and Strudel’s mini-notation and spread Euclidean rhythms with Bjorklund’s algorithm as they run it (design 0004): the notation is theirs, the implementation claudius’s own, with none of their code.

Encoders, decoders and the programs it may call

MP3, FLAC and Opus are written by rusty_mp3, flacenc and opus-pure, and Ogg Vorbis by libvorbis with aoTuV’s and Lancer’s tuning (aotuv_lancer_vorbis_sys, BSD-3-Clause), built in (Exporting). symphonia reads the recordings claudius opens, and opus-pure decodes the Opus among them. AAC and Apple Lossless come from the system’s encoder, Core Audio’s afconvert on macOS, and ffmpeg elsewhere and for a file symphonia cannot read, when it is installed: claudius runs them as programs and ships neither.

Fonts and icons

FontWhereLicence
Interthe studio’s text, and Infinite Radio’s pageSIL Open Font License 1.1
Lucidethe studio’s icons, and Infinite Radio’s page’sISC
the fonts egui ships (epaint_default_fonts: Hack, Noto Emoji, Ubuntu, and emoji-icon-font)the studio, for what Inter does not covereach its own, as that crate lists them

Words

The command palette never takes an English word for a slip of another. The English words it knows (crates/claudius-intent/data/english.txt) are SCOWL’s list of size 35, in American and British spelling, from Kevin Atkinson’s English Speller Database, whose words come mostly from Alan Beale’s 12dicts and ENABLE2K, both in the public domain. Its notice:

Copyright 2000-2026 by Kevin Atkinson

Permission to use, copy, modify, distribute, and sell any part of the English Speller Database (ESDB, previously known as SCOWLv2), or word lists created from it, is hereby granted without fee, provided that the above copyright notice appears in all copies and that both the above copyright notice and this notice appear in supporting documentation. Kevin Atkinson makes no representations about the suitability of this database for any purpose. It is provided “as is” without express or implied warranty.

Sounds

The sample packs are public domain, CC0 and CC BY recordings, each credited as its licence asks (their credits, design 0007). A song that samples a recording from Freesound, Wikimedia Commons, Openverse, ccMixter or Jamendo keeps that recording’s credit with what plays it (credits).

Research

What the engine draws on, by the part of it that does. A paper new to the engine goes here in the pull request that uses it.

Listening to a recording

  • Ellis (2007), “Beat tracking by dynamic programming”, Journal of New Music Research 36(1): doi:10.1080/09298210701653344. The beats.
  • Krumhansl & Kessler (1982), “Tracing the dynamic changes in perceived tonal organization in a spatial representation of musical keys”, Psychological Review 89(4): doi:10.1037/0033-295X.89.4.334. The key.
  • de Cheveigné & Kawahara (2002), “YIN, a fundamental frequency estimator for speech and music”, JASA 111(4): doi:10.1121/1.1458024. The pitch of a voice.
  • Mauch et al. (2015), “Computer-aided melody note transcription using the Tony software: accuracy and efficiency”, TENOR 2015: paper. The notes a voice sings.
  • Moulines & Charpentier (1990), “Pitch-synchronous waveform processing techniques for text-to-speech synthesis using diphones”, Speech Communication 9(5-6): doi:10.1016/0167-6393(90)90021-Z. TD-PSOLA, which moves a voice to the song’s key with its formants kept.
  • ITU-R BS.1770, “Algorithms to measure audio programme loudness and true-peak audio level”: recommendation. Loudness.
  • Foote (2000), “Automatic audio segmentation using a measure of audio novelty”, ICME 2000: doi:10.1109/ICME.2000.869637. Where a section starts: the novelty of how alike the bars either side are.
  • Paulus, Müller & Klapuri (2010), “Audio-based music structure analysis”, ISMIR 2010: paper. Sections by novelty, by what repeats, and by what holds alike.
  • Goto (2006), “A chorus section detection method for musical audio signals and its application to a music listening station”, IEEE Transactions on Audio, Speech, and Language Processing 14(5): doi:10.1109/TSA.2005.863204. A chorus is what comes back.
  • Smith, Burgoyne, Fujinaga, De Roure & Downie (2011), “Design and creation of a large-scale database of structural annotations”, ISMIR 2011, and its annotations, SALAMI (CC0), which measure where the analysis hears sections start and what they are.

Sampling a recording

  • Bohak & Marolt (2012), ISMIR 2012: paper. A singer’s rests part the phrases.
  • Nakano, Ogata, Goto & Hiraga (2008), “Analysis and automatic detection of breath sounds in unaccompanied singing voice”, ICMPC 2008: paper. And so do their breaths.
  • Jehan (2005), “Creating music by listening”, PhD thesis, MIT: thesis. A cut goes back to the quiet before an onset.
  • Kool, van Hoof & Welling (2019), “Stochastic beams and where to find them: the Gumbel-top-k trick for sampling sequences without replacement”, ICML 2019: arXiv:1903.06059. Another take of the pieces, and of a flip, drawn among the good ones.
  • Stoller, Durand & Ewert (2019), “End-to-end lyrics alignment for polyphonic music using an audio-to-character recognition model”, ICASSP 2019: arXiv:1902.06797. JamendoLyrics, the songs whose every word is timed, which measure how often a cut falls inside one, and, by their stanzas, where sung sections start and which come back.

Rhythm and feel

  • Toussaint (2005), “The Euclidean algorithm generates traditional musical rhythms”, Bridges 2005: paper. Euclidean rhythms.
  • Longuet-Higgins & Lee (1984), “The rhythmic interpretation of monophonic music”, Music Perception 1(4): doi:10.2307/40285271. Syncopation.
  • Hennig et al. (2011), “The nature and perception of fluctuations in human musical rhythms”, PLOS ONE 6(10): doi:10.1371/journal.pone.0026457. The drift a player’s timing wanders with.

Effects and the mix

  • Bristow-Johnson, “Cookbook formulae for audio equalizer biquad filter coefficients”, published by the W3C as the Audio EQ Cookbook. An equalizer’s and a filter’s bands, as the renderer runs them and the signal flow draws their curves.

The critic

The critic’s page says what each of them does in it.

Libraries

Every Rust crate claudius is built of, 651 of them: those of the app, the command line, the server and the studio in the browser, on every platform it runs on, as normal and build dependencies. Each has the versions Cargo.lock holds and the licence it comes under, and links to its source. claudius uses them as they are published, changing none. The book writes this page from Cargo.lock each time it is built, so it never goes out of date; the rest of what claudius is built on is in Credits.

CrateVersionLicence
[accesskit](https://github.com/AccessKit/accesskit (*))0.25.1MIT OR Apache-2.0
accesskit_atspi_common0.21.0MIT OR Apache-2.0
[accesskit_consumer](https://github.com/AccessKit/accesskit (*))0.39.1MIT OR Apache-2.0
accesskit_ios0.2.1MIT OR Apache-2.0
accesskit_macos0.27.1MIT OR Apache-2.0
accesskit_unix0.24.0MIT OR Apache-2.0
accesskit_windows0.35.1MIT OR Apache-2.0
accesskit_winit0.34.1Apache-2.0
adler22.0.10BSD OR MIT OR Apache-2.0
agent-client-protocol5.2.0Apache-2.0
agent-client-protocol-derive5.2.0Apache-2.0
agent-client-protocol-schema1.17.0Apache-2.0
[ahash](https://github.com/tkaitchuck/ahash (*))0.8.12MIT OR Apache-2.0
[aho-corasick](https://github.com/BurntSushi/aho-corasick (*))1.1.5Unlicense OR MIT
alloc-no-stdlib2.0.4BSD-3-Clause
[alloc-stdlib](https://github.com/dropbox/rust-alloc-no-stdlib (*))0.2.2BSD-3-Clause
allocator-api20.2.21MIT OR Apache-2.0
[alsa](https://github.com/diwic/alsa-rs (*))0.11.0Apache-2.0/MIT
alsa-sys0.4.0MIT
android-activity0.6.1MIT OR Apache-2.0
android-build0.1.4MIT
android-properties0.2.2MIT
android_system_properties0.1.6MIT OR Apache-2.0
[anstream](https://github.com/rust-cli/anstyle.git (*))1.0.0MIT OR Apache-2.0
anstyle1.0.14MIT OR Apache-2.0
anstyle-parse1.0.0MIT OR Apache-2.0
anstyle-query1.1.5MIT OR Apache-2.0
anstyle-wincon3.0.11MIT OR Apache-2.0
anyhow1.0.104MIT OR Apache-2.0
aotuv_lancer_vorbis_sys0.1.6BSD-3-Clause
arboard3.7.0MIT OR Apache-2.0
arrayref0.3.9BSD-2-Clause
arrayvec0.7.8MIT OR Apache-2.0
as-raw-xcb-connection1.0.1MIT OR Apache-2.0
async-broadcast0.7.2MIT OR Apache-2.0
[async-channel](https://github.com/smol-rs/async-channel (*))2.5.0Apache-2.0 OR MIT
async-compression0.4.49MIT OR Apache-2.0
[async-executor](https://github.com/smol-rs/async-executor (*))1.14.0Apache-2.0 OR MIT
[async-io](https://github.com/smol-rs/async-io (*))2.6.0Apache-2.0 OR MIT
[async-lock](https://github.com/smol-rs/async-lock (*))3.5.0Apache-2.0 OR MIT
[async-process](https://github.com/smol-rs/async-process (*))2.5.0Apache-2.0 OR MIT
async-recursion1.1.1MIT OR Apache-2.0
async-signal0.2.14Apache-2.0 OR MIT
async-task4.7.1Apache-2.0 OR MIT
[async-trait](https://github.com/dtolnay/async-trait (*))0.1.92MIT OR Apache-2.0
atomic-waker1.1.2Apache-2.0 OR MIT
atspi0.29.0Apache-2.0 OR MIT
[atspi-common](https://github.com/odilia-app/atspi (*))0.13.0Apache-2.0 OR MIT
atspi-proxies0.13.0Apache-2.0 OR MIT
autocfg1.5.1Apache-2.0 OR MIT
axum0.8.9MIT
axum-core0.5.6MIT
base640.23.1, 0.13.1, 0.22.1MIT OR Apache-2.0
base64ct1.8.3Apache-2.0 OR MIT
bit-set0.8.0Apache-2.0 OR MIT
bit-vec0.8.0Apache-2.0 OR MIT
[bitflags](https://github.com/bitflags/bitflags (*))2.13.2, 1.3.2MIT OR Apache-2.0
blake31.8.7CC0-1.0 OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception
block0.1.6MIT
block-buffer0.10.4, 0.12.1MIT OR Apache-2.0
[block2](https://github.com/madsmtm/objc2 (*))0.6.2, 0.5.1MIT
[blocking](https://github.com/smol-rs/blocking (*))1.7.0Apache-2.0 OR MIT
brotli8.0.4BSD-3-Clause AND MIT
brotli-decompressor5.0.0BSD-3-Clause/MIT
built0.7.7MIT
bumpalo3.20.3MIT OR Apache-2.0
[bytemuck](https://github.com/Lokathor/bytemuck (*))1.25.2Zlib OR Apache-2.0 OR MIT
bytemuck_derive1.12.1Zlib OR Apache-2.0 OR MIT
byteorder1.5.0Unlicense OR MIT
byteorder-lite0.1.0Unlicense OR MIT
bytes1.12.1MIT
[calloop](https://github.com/Smithay/calloop (*))0.13.0, 0.14.5MIT
calloop-wayland-source0.3.0, 0.4.1MIT
[candle-core](https://github.com/huggingface/candle (*))0.11.1MIT OR Apache-2.0
candle-nn0.11.1MIT OR Apache-2.0
castaway0.2.4MIT
[cc](https://github.com/rust-lang/cc-rs (*))1.8.0MIT OR Apache-2.0
cesu81.1.0Apache-2.0/MIT
cfg-if1.0.5MIT OR Apache-2.0
cfg_aliases0.2.2MIT
cgl0.3.2MIT / Apache-2.0
chacha200.10.2MIT OR Apache-2.0
[chrono](https://github.com/chronotope/chrono (*))0.4.45MIT OR Apache-2.0
clap4.6.7MIT OR Apache-2.0
clap_builder4.6.7MIT OR Apache-2.0
clap_derive4.6.7MIT OR Apache-2.0
clap_lex1.1.1MIT OR Apache-2.0
clipboard-win5.4.1BSL-1.0
color0.3.3Apache-2.0 OR MIT
colorchoice1.0.5MIT OR Apache-2.0
[combine](https://github.com/Marwes/combine (*))4.6.9MIT
compact_str0.9.1MIT
compression-codecs0.4.44MIT OR Apache-2.0
compression-core0.4.34MIT OR Apache-2.0
[concurrent-queue](https://github.com/smol-rs/concurrent-queue (*))2.5.0Apache-2.0 OR MIT
const-oid0.10.2Apache-2.0 OR MIT
const-random0.1.18MIT OR Apache-2.0
const-random-macro0.1.16MIT OR Apache-2.0
constant_time_eq0.4.2CC0-1.0 OR MIT-0 OR Apache-2.0
convert_case0.10.0MIT
[core-foundation](https://github.com/servo/core-foundation-rs (*))0.10.1, 0.9.4MIT OR Apache-2.0
core-foundation-sys0.8.7MIT OR Apache-2.0
core-graphics0.23.2, 0.25.0MIT OR Apache-2.0
core-graphics-types0.1.3, 0.2.0MIT OR Apache-2.0
coreaudio-rs0.14.2MIT/Apache-2.0
coremidi0.9.2MIT
coremidi-sys3.2.1MIT
[cpal](https://github.com/RustAudio/cpal (*))0.18.2Apache-2.0
[cpufeatures](https://github.com/RustCrypto/utils (*))0.3.1MIT OR Apache-2.0
crc3.4.0MIT OR Apache-2.0
crc-catalog2.5.0MIT OR Apache-2.0
[crc32fast](https://github.com/srijs/rust-crc32fast (*))1.5.2MIT OR Apache-2.0
crossbeam-channel0.5.17MIT OR Apache-2.0
crossbeam-deque0.8.8MIT OR Apache-2.0
crossbeam-epoch0.9.21MIT OR Apache-2.0
crossbeam-utils0.8.23MIT OR Apache-2.0
crunchy0.2.4MIT
crypto-common0.1.7, 0.2.2MIT OR Apache-2.0
cursor-icon1.2.0MIT OR Apache-2.0 OR Zlib
daachorse3.0.3MIT OR Apache-2.0
[darling](https://github.com/TedDriggs/darling (*))0.20.11, 0.24.1MIT
[darling_core](https://github.com/TedDriggs/darling (*))0.20.11, 0.24.1MIT
darling_macro0.20.11, 0.24.1MIT
dary_heap0.3.9MIT OR Apache-2.0
dasp_sample0.11.0MIT OR Apache-2.0
der0.8.2Apache-2.0 OR MIT
deranged0.5.8MIT OR Apache-2.0
derive_builder0.20.2MIT OR Apache-2.0
derive_builder_core0.20.2MIT OR Apache-2.0
derive_builder_macro0.20.2MIT OR Apache-2.0
derive_more2.1.1MIT
derive_more-impl2.1.1MIT
digest0.10.7, 0.11.3MIT OR Apache-2.0
[dirs](https://codeberg.org/dirs/dirs-rs (*))7.0.0MIT OR Apache-2.0
dirs-sys0.5.0MIT OR Apache-2.0
dispatch0.2.0MIT
[dispatch2](https://github.com/madsmtm/objc2 (*))0.3.1Zlib OR Apache-2.0 OR MIT
[displaydoc](https://github.com/yaahc/displaydoc (*))0.2.7MIT OR Apache-2.0
[dlib](https://github.com/elinorbgr/dlib (*))0.5.3MIT
dlopen20.9.0MIT
[document-features](https://github.com/slint-ui/document-features (*))0.2.12MIT OR Apache-2.0
downcast-rs1.2.1MIT/Apache-2.0
dpi0.1.2Apache-2.0 AND MIT
dyn-clone1.0.20MIT OR Apache-2.0
[dyn-stack](https://codeberg.org/sarah-quinones/dyn-stack (*))0.13.2MIT
dyn-stack-macros0.1.3MIT
ecolor0.37.0MIT OR Apache-2.0
eframe0.37.0MIT OR Apache-2.0
[egui](https://github.com/emilk/egui (*))0.37.0MIT OR Apache-2.0
egui-winit0.37.0MIT OR Apache-2.0
egui_glow0.37.0MIT OR Apache-2.0
ehttp0.7.3MIT OR Apache-2.0
either1.19.0MIT OR Apache-2.0
[emath](https://github.com/emilk/egui/tree/main/crates/emath (*))0.37.0MIT OR Apache-2.0
endi1.1.1MIT
enum-as-inner0.6.1MIT/Apache-2.0
[enumflags2](https://github.com/meithecatte/enumflags2 (*))0.7.12MIT OR Apache-2.0
enumflags2_derive0.7.12MIT OR Apache-2.0
enumn0.1.14MIT OR Apache-2.0
env_filter2.0.0MIT OR Apache-2.0
env_logger0.11.11MIT OR Apache-2.0
epaint0.37.0MIT OR Apache-2.0
epaint_default_fonts0.37.0(MIT OR Apache-2.0) AND OFL-1.1 AND Ubuntu-font-1.0
equivalent1.0.3Apache-2.0 OR MIT
[errno](https://github.com/lambda-fairy/rust-errno (*))0.3.14MIT OR Apache-2.0
error-code3.4.0BSL-1.0
esaxx-rs0.1.10Apache-2.0
euclid0.22.14MIT OR Apache-2.0
[event-listener](https://github.com/smol-rs/event-listener (*))5.4.2Apache-2.0 OR MIT
[event-listener-strategy](https://github.com/smol-rs/event-listener-strategy (*))0.5.4Apache-2.0 OR MIT
extended0.1.0MIT
fallible-iterator0.3.0MIT/Apache-2.0
fallible-streaming-iterator0.1.9MIT/Apache-2.0
fancy-regex0.17.0MIT
fastrand2.5.0Apache-2.0 OR MIT
fax0.2.7MIT
fdeflate0.3.7MIT OR Apache-2.0
fearless_simd0.4.1Apache-2.0 OR MIT
find-msvc-tools0.1.14MIT OR Apache-2.0
fixedbitset0.5.7MIT OR Apache-2.0
flacenc0.5.1Apache-2.0
[flate2](https://github.com/rust-lang/flate2-rs (*))1.1.10MIT OR Apache-2.0
float80.7.0MIT
fnv1.0.7Apache-2.0 / MIT
foldhash0.2.0, 0.1.5Zlib
[font-types](https://github.com/googlefonts/fontations (*))0.12.7MIT OR Apache-2.0
[foreign-types](https://github.com/sfackler/foreign-types (*))0.3.2, 0.5.0MIT/Apache-2.0
foreign-types-macros0.2.4MIT/Apache-2.0
foreign-types-shared0.1.1, 0.3.1MIT/Apache-2.0
[form_urlencoded](https://github.com/servo/rust-url (*))1.2.3MIT OR Apache-2.0
fs41.1.0MIT OR Apache-2.0
[futures](https://github.com/rust-lang/futures-rs (*))0.3.34MIT OR Apache-2.0
[futures-channel](https://github.com/rust-lang/futures-rs (*))0.3.34MIT OR Apache-2.0
futures-concurrency7.7.1MIT OR Apache-2.0
futures-core0.3.34MIT OR Apache-2.0
futures-executor0.3.34MIT OR Apache-2.0
futures-io0.3.34MIT OR Apache-2.0
[futures-lite](https://github.com/smol-rs/futures-lite (*))2.6.1Apache-2.0 OR MIT
futures-macro0.3.34MIT OR Apache-2.0
futures-sink0.3.34MIT OR Apache-2.0
futures-task0.3.34MIT OR Apache-2.0
[futures-util](https://github.com/rust-lang/futures-rs (*))0.3.34MIT OR Apache-2.0
gemm0.19.0MIT
gemm-c320.19.0MIT
gemm-c640.19.0MIT
[gemm-common](https://github.com/sarah-ek/gemm/ (*))0.19.0MIT
gemm-f160.19.0MIT
[gemm-f32](https://github.com/sarah-ek/gemm/ (*))0.19.0MIT
gemm-f640.19.0MIT
[generic-array](https://github.com/fizyk20/generic-array.git (*))0.14.7MIT
gethostname1.1.0Apache-2.0
[getrandom](https://github.com/rust-random/getrandom (*))0.4.3, 0.2.17, 0.3.4MIT OR Apache-2.0
[gl_generator](https://github.com/brendanzab/gl-rs/ (*))0.14.0Apache-2.0
glob0.3.4MIT OR Apache-2.0
[glow](https://github.com/grovesNL/glow (*))0.17.0MIT OR Apache-2.0 OR Zlib
[glutin](https://github.com/rust-windowing/glutin (*))0.32.3Apache-2.0
glutin-winit0.5.0MIT
glutin_egl_sys0.7.1Apache-2.0
glutin_glx_sys0.6.1Apache-2.0
glutin_wgl_sys0.6.1Apache-2.0
guillotiere0.7.0MIT/Apache-2.0
[half](https://github.com/VoidStarKat/half-rs (*))2.7.1MIT OR Apache-2.0
harfrust0.12.0MIT
hash320.3.1MIT OR Apache-2.0
[hashbrown](https://github.com/rust-lang/hashbrown (*))0.17.1, 0.16.1, 0.15.5MIT OR Apache-2.0
hashlink0.12.2MIT OR Apache-2.0
heapless0.8.0MIT OR Apache-2.0
heck0.5.0MIT OR Apache-2.0
hermit-abi0.5.3MIT OR Apache-2.0
hex0.4.3MIT OR Apache-2.0
hmac-sha2561.1.15ISC
hound3.5.1Apache-2.0
[http](https://github.com/hyperium/http (*))1.5.0MIT OR Apache-2.0
[http-body](https://github.com/hyperium/http-body (*))1.1.0MIT
[http-body-util](https://github.com/hyperium/http-body (*))0.1.5MIT
http-range-header0.4.2MIT
httparse1.10.1MIT OR Apache-2.0
httpdate1.0.3MIT OR Apache-2.0
[hybrid-array](https://github.com/RustCrypto/hybrid-array (*))0.4.15MIT OR Apache-2.0
[hyper](https://github.com/hyperium/hyper (*))1.12.0MIT
hyper-util0.1.21MIT
iana-time-zone0.1.65MIT OR Apache-2.0
iana-time-zone-haiku0.1.2MIT OR Apache-2.0
[icu_collections](https://github.com/unicode-org/icu4x (*))2.3.0Unicode-3.0
[icu_locale_core](https://github.com/unicode-org/icu4x (*))2.3.0Unicode-3.0
icu_normalizer2.3.0Unicode-3.0
icu_normalizer_data2.3.0Unicode-3.0
icu_properties2.3.0Unicode-3.0
icu_properties_data2.3.0Unicode-3.0
[icu_provider](https://github.com/unicode-org/icu4x (*))2.3.1Unicode-3.0
ident_case1.0.1MIT/Apache-2.0
idna1.1.0MIT OR Apache-2.0
idna_adapter1.2.2Apache-2.0 OR MIT
[image](https://github.com/image-rs/image (*))0.25.10MIT OR Apache-2.0
[indexmap](https://github.com/indexmap-rs/indexmap (*))2.14.2Apache-2.0 OR MIT
is_terminal_polyfill1.70.2MIT OR Apache-2.0
itertools0.14.0, 0.15.0MIT OR Apache-2.0
itoa1.0.18MIT OR Apache-2.0
java-locator0.1.9MIT/Apache-2.0
jiff0.2.38Unlicense OR MIT
jiff-core0.1.1Unlicense OR MIT
jiff-static0.2.38Unlicense OR MIT
[jni](https://github.com/jni-rs/jni-rs (*))0.22.4, 0.21.1MIT/Apache-2.0
jni-macros0.22.4MIT OR Apache-2.0
jni-min-helper0.3.4MIT OR Apache-2.0
[jni-sys](https://github.com/jni-rs/jni-sys (*))0.4.1, 0.3.1MIT OR Apache-2.0
jni-sys-macros0.4.1MIT OR Apache-2.0
jobserver0.1.35MIT OR Apache-2.0
[js-sys](https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/js-sys (*))0.3.106MIT OR Apache-2.0
khronos_api3.1.0Apache-2.0
kurbo0.13.1Apache-2.0 OR MIT
lazy_static1.5.1MIT OR Apache-2.0
libc0.2.190MIT OR Apache-2.0
libloading0.8.9, 0.7.4ISC
libm0.2.16MIT
[libredox](https://gitlab.redox-os.org/redox-os/libredox.git (*))0.1.25MIT
libsqlite3-sys0.39.1MIT
linebender_resource_handle0.1.1Apache-2.0 OR MIT
linux-raw-sys0.12.1, 0.4.15Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
litemap0.8.3Unicode-3.0
litrs1.0.1MIT OR Apache-2.0
lock_api0.4.14MIT OR Apache-2.0
log0.4.35MIT OR Apache-2.0
lzma-rust20.15.8Apache-2.0
mac-notification-sys0.6.15MIT/Apache-2.0
mach20.6.0BSD-2-Clause OR MIT OR Apache-2.0
macro_rules_attribute0.2.3Apache-2.0 OR MIT OR Zlib
macro_rules_attribute-proc_macro0.2.3Apache-2.0 OR MIT OR Zlib
malloc_buf0.0.6MIT
matchit0.8.4MIT AND BSD-3-Clause
md-50.10.6MIT OR Apache-2.0
memchr2.8.3Unlicense OR MIT
[memmap2](https://github.com/RazrFalcon/memmap2-rs (*))0.9.11MIT OR Apache-2.0
memoffset0.9.1MIT
midir0.11.1MIT
mime0.3.17MIT OR Apache-2.0
mime_guess2.0.5MIT
minimal-lexical0.2.1MIT/Apache-2.0
miniz_oxide0.9.1, 0.8.9MIT OR Zlib OR Apache-2.0
mio1.2.4MIT
monostate0.1.18MIT OR Apache-2.0
monostate-impl0.1.18MIT OR Apache-2.0
moxcms0.8.1BSD-3-Clause OR Apache-2.0
native-tls0.2.18MIT OR Apache-2.0
[ndk](https://github.com/rust-mobile/ndk (*))0.9.0MIT OR Apache-2.0
ndk-context0.1.1MIT OR Apache-2.0
[ndk-sys](https://github.com/rust-mobile/ndk (*))0.6.0+11769913MIT OR Apache-2.0
[needle-core](https://github.com/geekgineer/needle-rs (*))0.3.1MIT
[needle-infer](https://github.com/geekgineer/needle-rs (*))0.3.1MIT
nix0.31.3MIT
nohash-hasher0.2.0Apache-2.0 OR MIT
nom7.1.3, 8.0.0MIT
notify-rust4.19.0MIT OR Apache-2.0
num-bigint0.4.8MIT OR Apache-2.0
[num-complex](https://github.com/rust-num/num-complex (*))0.4.6MIT OR Apache-2.0
num-conv0.2.2MIT OR Apache-2.0
num-derive0.4.2MIT OR Apache-2.0
[num-integer](https://github.com/rust-num/num-integer (*))0.1.47MIT OR Apache-2.0
num-rational0.4.2MIT OR Apache-2.0
[num-traits](https://github.com/rust-num/num-traits (*))0.2.19MIT OR Apache-2.0
num_cpus1.17.0MIT OR Apache-2.0
[num_enum](https://github.com/illicitonion/num_enum (*))0.7.6BSD-3-Clause OR MIT OR Apache-2.0
num_enum_derive0.7.6BSD-3-Clause OR MIT OR Apache-2.0
objc0.2.7MIT
objc-sys0.3.5MIT
[objc2](https://github.com/madsmtm/objc2 (*))0.6.5, 0.5.3MIT
[objc2-app-kit](https://github.com/madsmtm/objc2 (*))0.3.2, 0.2.2Zlib OR Apache-2.0 OR MIT
[objc2-audio-toolbox](https://github.com/madsmtm/objc2 (*))0.3.2Zlib OR Apache-2.0 OR MIT
objc2-avf-audio0.3.2Zlib OR Apache-2.0 OR MIT
[objc2-core-audio](https://github.com/madsmtm/objc2 (*))0.3.2Zlib OR Apache-2.0 OR MIT
[objc2-core-audio-types](https://github.com/madsmtm/objc2 (*))0.3.2Zlib OR Apache-2.0 OR MIT
[objc2-core-foundation](https://github.com/madsmtm/objc2 (*))0.3.2Zlib OR Apache-2.0 OR MIT
[objc2-core-graphics](https://github.com/madsmtm/objc2 (*))0.3.2Zlib OR Apache-2.0 OR MIT
objc2-encode4.1.0MIT
[objc2-foundation](https://github.com/madsmtm/objc2 (*))0.3.2, 0.2.2MIT
objc2-ui-kit0.2.2, 0.3.2Zlib OR Apache-2.0 OR MIT
[ogg_next_sys](https://github.com/ComunidadAylas/vorbis-rs (*))0.1.5BSD-3-Clause
[once_cell](https://github.com/matklad/once_cell (*))1.21.4MIT OR Apache-2.0
once_cell_polyfill1.70.2MIT OR Apache-2.0
openssl0.10.81Apache-2.0
openssl-macros0.1.1MIT/Apache-2.0
openssl-probe0.2.1MIT OR Apache-2.0
[openssl-sys](https://github.com/rust-openssl/rust-openssl (*))0.9.117MIT
option-ext0.2.0MPL-2.0
opus-pure0.2.2BSD-3-Clause
orbclient0.3.55MIT
[ordered-stream](https://github.com/danieldg/ordered-stream (*))0.2.0MIT OR Apache-2.0
ort2.0.0-rc.15MIT OR Apache-2.0
ort-sys2.0.0-rc.15MIT OR Apache-2.0
os_pipe1.2.3MIT
parking2.2.1Apache-2.0 OR MIT
[parking_lot](https://github.com/Amanieu/parking_lot (*))0.12.5MIT OR Apache-2.0
parking_lot_core0.9.12MIT OR Apache-2.0
paste1.0.15MIT OR Apache-2.0
pastey0.2.3MIT OR Apache-2.0
pem-rfc74681.0.0Apache-2.0 OR MIT
peniko0.6.1Apache-2.0 OR MIT
percent-encoding2.3.2MIT OR Apache-2.0
petgraph0.8.3MIT OR Apache-2.0
phf0.14.0MIT
phf_generator0.14.0MIT
phf_macros0.14.0MIT
phf_shared0.14.0MIT
[pin-project](https://github.com/taiki-e/pin-project (*))1.1.13Apache-2.0 OR MIT
pin-project-internal1.1.13Apache-2.0 OR MIT
pin-project-lite0.2.17Apache-2.0 OR MIT
piper0.2.5MIT OR Apache-2.0
pkg-config0.3.34MIT OR Apache-2.0
plain0.2.3MIT/Apache-2.0
[png](https://github.com/image-rs/image-png (*))0.18.1MIT OR Apache-2.0
[polling](https://github.com/smol-rs/polling (*))3.11.0Apache-2.0 OR MIT
pollster0.4.0, 1.0.1Apache-2.0/MIT
polycool0.4.0MIT OR Apache-2.0
portable-atomic1.15.0Apache-2.0 OR MIT
portable-atomic-util0.2.8Apache-2.0 OR MIT
potential_utf0.1.6Unicode-3.0
powerfmt0.2.1MIT OR Apache-2.0
ppv-lite860.2.21MIT OR Apache-2.0
primal-check0.3.4MIT OR Apache-2.0
[proc-macro-crate](https://github.com/bkchr/proc-macro-crate (*))3.5.0MIT OR Apache-2.0
[proc-macro2](https://github.com/dtolnay/proc-macro2 (*))1.0.107MIT OR Apache-2.0
process_path0.1.4MIT/Apache-2.0
profiling1.0.18MIT OR Apache-2.0
pulp0.22.3MIT
pulp-wasm-simd-flag0.1.1MIT
pxfm0.1.30BSD-3-Clause OR Apache-2.0
qrcodegen1.8.0MIT
quick-error2.0.1MIT/Apache-2.0
quick-xml0.41.0MIT
[quote](https://github.com/dtolnay/quote (*))1.0.47MIT OR Apache-2.0
r-efi6.0.0, 5.3.0MIT OR Apache-2.0 OR LGPL-2.1-or-later
[rand](https://github.com/rust-random/rand (*))0.9.5, 0.10.3MIT OR Apache-2.0
rand_chacha0.9.0MIT OR Apache-2.0
rand_core0.10.1, 0.9.5MIT OR Apache-2.0
[rand_distr](https://github.com/rust-random/rand_distr (*))0.5.1MIT OR Apache-2.0
[raw-cpuid](https://github.com/gz/rust-cpuid (*))11.6.0MIT
raw-window-handle0.6.2MIT OR Apache-2.0 OR Zlib
[rayon](https://github.com/rayon-rs/rayon (*))1.12.0MIT OR Apache-2.0
rayon-cond0.4.0Apache-2.0/MIT
rayon-core1.13.0MIT OR Apache-2.0
[read-fonts](https://github.com/googlefonts/fontations (*))0.41.0MIT OR Apache-2.0
[realfft](https://github.com/HEnquist/realfft (*))3.5.1MIT
reborrow0.5.5MIT
redox_syscall0.9.4, 0.5.18, 0.4.1MIT
redox_users0.5.3MIT
ref-cast1.0.27MIT OR Apache-2.0
ref-cast-impl1.0.27MIT OR Apache-2.0
[regex](https://github.com/rust-lang/regex (*))1.13.1MIT OR Apache-2.0
[regex-automata](https://github.com/rust-lang/regex (*))0.4.18MIT OR Apache-2.0
regex-lite0.1.9MIT OR Apache-2.0
regex-syntax0.8.11MIT OR Apache-2.0
rfd0.17.2MIT
rhai1.27.0MIT OR Apache-2.0
rhai_codegen3.3.0MIT OR Apache-2.0
[ring](https://github.com/briansmith/ring (*))0.17.14Apache-2.0 AND ISC
rmcp3.9.0Apache-2.0
rmcp-macros3.9.0Apache-2.0
rodio0.23.0MIT OR Apache-2.0
[ron](https://github.com/ron-rs/ron (*))0.12.2MIT OR Apache-2.0
rsqlite-vfs0.1.1MIT
rusqlite0.41.1MIT
rustc-hash2.1.3Apache-2.0 OR MIT
[rustc_version](https://github.com/djc/rustc-version-rs (*))0.4.1MIT OR Apache-2.0
[rustfft](https://github.com/ejmahler/RustFFT (*))6.4.1MIT OR Apache-2.0
[rustix](https://github.com/bytecodealliance/rustix (*))1.1.6, 0.38.44Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
rustls0.23.46Apache-2.0 OR ISC OR MIT
[rustls-pki-types](https://github.com/rustls/pki-types (*))1.15.1MIT OR Apache-2.0
rustls-webpki0.103.16ISC
rustversion1.0.23MIT OR Apache-2.0
rusty_mp31.0.5Apache-2.0
ryu1.0.23Apache-2.0 OR BSL-1.0
safetensors0.8.0, 0.6.2Apache-2.0
same-file1.0.6Unlicense/MIT
schannel0.1.29MIT
[schemars](https://github.com/GREsau/schemars (*))1.2.3MIT
schemars_derive1.2.3MIT
scoped-tls1.0.1MIT/Apache-2.0
scopeguard1.2.0MIT OR Apache-2.0
security-framework3.7.0MIT OR Apache-2.0
[security-framework-sys](https://github.com/kornelski/rust-security-framework (*))2.17.0MIT OR Apache-2.0
self_cell1.3.0Apache-2.0 OR GPL-2.0-only
semver1.0.28MIT OR Apache-2.0
send_wrapper0.6.0MIT/Apache-2.0
seq-macro0.3.6MIT OR Apache-2.0
[serde](https://github.com/serde-rs/serde (*))1.0.229MIT OR Apache-2.0
[serde_core](https://github.com/serde-rs/serde (*))1.0.229MIT OR Apache-2.0
[serde_derive](https://github.com/serde-rs/serde (*))1.0.229MIT OR Apache-2.0
serde_derive_internals0.30.0MIT OR Apache-2.0
[serde_json](https://github.com/serde-rs/json (*))1.0.154MIT OR Apache-2.0
serde_path_to_error0.1.20MIT OR Apache-2.0
[serde_repr](https://github.com/dtolnay/serde-repr (*))0.1.21MIT OR Apache-2.0
serde_urlencoded0.7.1MIT/Apache-2.0
serde_with3.24.0MIT OR Apache-2.0
serde_with_macros3.24.0MIT OR Apache-2.0
[sha2](https://github.com/RustCrypto/hashes (*))0.11.1MIT OR Apache-2.0
shell-words1.1.1MIT/Apache-2.0
shlex2.0.1MIT OR Apache-2.0
[signal-hook-registry](https://github.com/vorner/signal-hook (*))1.4.8MIT OR Apache-2.0
simd-adler320.3.10MIT
[simd_cesu8](https://github.com/seancroach/simd_cesu8 (*))1.2.0Apache-2.0 OR MIT
simdutf80.1.5MIT OR Apache-2.0
siphasher1.0.4MIT OR Apache-2.0
[skrifa](https://github.com/googlefonts/fontations (*))0.44.0MIT OR Apache-2.0
slab0.4.12MIT
slotmap1.1.1Zlib
[smallvec](https://github.com/servo/rust-smallvec (*))1.16.3MIT OR Apache-2.0
smartstring1.0.1MPL-2.0+
smithay-client-toolkit0.19.2, 0.20.0MIT
smithay-clipboard0.7.3MIT
smol_str0.2.2MIT OR Apache-2.0
[socket2](https://github.com/rust-lang/socket2 (*))0.6.5MIT OR Apache-2.0
souvlaki0.9.3MIT
spm_precompiled0.1.4Apache-2.0
sqlite-wasm-rs0.5.5MIT
sse-stream0.2.6MIT OR Apache-2.0
stable_deref_trait1.2.1MIT OR Apache-2.0
static_assertions1.1.0MIT OR Apache-2.0
strength_reduce0.2.4MIT OR Apache-2.0
strict-num0.1.1MIT
strsim0.11.1MIT
strum0.28.0MIT
strum_macros0.28.0MIT
subtle2.6.1BSD-3-Clause
symphonia0.6.1MPL-2.0
symphonia-bundle-flac0.6.1MPL-2.0
symphonia-bundle-mp30.6.1MPL-2.0
symphonia-codec-aac0.6.1MPL-2.0
symphonia-codec-adpcm0.6.1MPL-2.0
symphonia-codec-alac0.6.1MPL-2.0
symphonia-codec-pcm0.6.1MPL-2.0
symphonia-codec-vorbis0.6.1MPL-2.0
[symphonia-common](https://github.com/pdeljanov/Symphonia (*))0.6.1MPL-2.0
[symphonia-core](https://github.com/pdeljanov/Symphonia (*))0.6.1MPL-2.0
symphonia-format-caf0.6.1MPL-2.0
symphonia-format-isomp40.6.1MPL-2.0
symphonia-format-mkv0.6.1MPL-2.0
symphonia-format-ogg0.6.1MPL-2.0
symphonia-format-riff0.6.1MPL-2.0
[symphonia-metadata](https://github.com/pdeljanov/Symphonia (*))0.6.1MPL-2.0
[syn](https://github.com/dtolnay/syn (*))3.0.9, 2.0.119MIT OR Apache-2.0
sync_wrapper1.0.2Apache-2.0
[synstructure](https://github.com/mystor/synstructure (*))0.14.0MIT
sysctl0.6.0MIT
tauri-winrt-notification0.8.1MIT OR Apache-2.0
[tempfile](https://github.com/Stebalien/tempfile (*))3.27.0MIT OR Apache-2.0
thin-vec0.2.21MIT OR Apache-2.0
[thiserror](https://github.com/dtolnay/thiserror (*))2.0.21, 1.0.69MIT OR Apache-2.0
thiserror-impl2.0.21, 1.0.69MIT OR Apache-2.0
tiff0.11.3MIT
time0.3.55MIT OR Apache-2.0
time-core0.1.9MIT OR Apache-2.0
tiny-keccak2.0.2CC0-1.0
tiny-skia0.11.4BSD-3-Clause
tiny-skia-path0.11.4BSD-3-Clause
tinystr0.8.4Unicode-3.0
tinyvec1.13.3Zlib OR Apache-2.0 OR MIT
[tokenizers](https://github.com/huggingface/tokenizers (*))0.23.2Apache-2.0
[tokio](https://github.com/tokio-rs/tokio (*))1.54.1MIT
tokio-macros2.7.2MIT
tokio-stream0.1.19MIT
[tokio-util](https://github.com/tokio-rs/tokio (*))0.7.20MIT
toml_datetime1.1.2+spec-1.1.0MIT OR Apache-2.0
toml_edit0.25.18+spec-1.1.0MIT OR Apache-2.0
[toml_parser](https://github.com/toml-rs/toml (*))1.1.5+spec-1.1.0MIT OR Apache-2.0
toml_writer1.2.0+spec-1.1.0MIT OR Apache-2.0
[tower](https://github.com/tower-rs/tower (*))0.5.3MIT
tower-http0.7.1MIT
tower-layer0.3.3MIT
tower-service0.3.3MIT
[tracing](https://github.com/tokio-rs/tracing (*))0.1.44MIT
tracing-attributes0.1.31MIT
tracing-core0.1.36MIT
transpose0.2.3MIT OR Apache-2.0
tree_magic_mini3.2.2MIT
typed-path0.13.0MIT OR Apache-2.0
typeid1.0.3MIT OR Apache-2.0
typenum1.20.1MIT OR Apache-2.0
[uds_windows](https://github.com/haraldh/rust_uds_windows (*))1.2.1MIT
unicase2.10.0MIT OR Apache-2.0
unicode-general-category1.1.0Apache-2.0
unicode-ident1.0.27(MIT OR Apache-2.0) AND Unicode-3.0
unicode-normalization-alignments0.1.12MIT/Apache-2.0
unicode-properties0.1.4MIT/Apache-2.0
unicode-segmentation1.13.3MIT OR Apache-2.0
unicode-xid0.2.6MIT OR Apache-2.0
unicode_categories0.1.1MIT OR Apache-2.0
untrusted0.9.0ISC
[ureq](https://github.com/algesten/ureq (*))3.5.1MIT OR Apache-2.0
[ureq-proto](https://github.com/algesten/ureq-proto (*))0.7.1MIT OR Apache-2.0
url2.5.9MIT OR Apache-2.0
utf8-zero0.8.1MIT OR Apache-2.0
utf8_iter1.0.4Apache-2.0 OR MIT
utf8parse0.2.2Apache-2.0 OR MIT
[uuid](https://github.com/uuid-rs/uuid (*))1.28.0Apache-2.0 OR MIT
vcpkg0.2.15MIT/Apache-2.0
vello_common0.2.0Apache-2.0 OR MIT
vello_cpu0.2.0Apache-2.0 OR MIT
version_check0.9.5MIT/Apache-2.0
vorbis_rs0.5.6BSD-3-Clause
[walkdir](https://github.com/BurntSushi/walkdir (*))2.5.0Unlicense/MIT
wasi0.11.1+wasi-snapshot-preview1Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
wasip21.0.4+wasi-0.2.12Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
[wasm-bindgen](https://github.com/wasm-bindgen/wasm-bindgen (*))0.2.129MIT OR Apache-2.0
[wasm-bindgen-futures](https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/futures (*))0.4.79MIT OR Apache-2.0
wasm-bindgen-macro0.2.129MIT OR Apache-2.0
wasm-bindgen-macro-support0.2.129MIT OR Apache-2.0
[wasm-bindgen-shared](https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/shared (*))0.2.129MIT OR Apache-2.0
[wayland-backend](https://github.com/smithay/wayland-rs (*))0.3.17MIT
[wayland-client](https://github.com/smithay/wayland-rs (*))0.31.15MIT
[wayland-csd-frame](https://github.com/rust-windowing/wayland-csd-frame (*))0.3.0MIT
[wayland-cursor](https://github.com/smithay/wayland-rs (*))0.31.14MIT
[wayland-protocols](https://github.com/smithay/wayland-rs (*))0.32.13MIT
wayland-protocols-experimental20250721.0.1MIT
wayland-protocols-misc0.3.12MIT
wayland-protocols-plasma0.3.12MIT
[wayland-protocols-wlr](https://github.com/smithay/wayland-rs (*))0.3.12MIT
[wayland-scanner](https://github.com/smithay/wayland-rs (*))0.31.11MIT
[wayland-sys](https://github.com/smithay/wayland-rs (*))0.31.11MIT
[web-sys](https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/web-sys (*))0.3.106MIT OR Apache-2.0
[web-time](https://github.com/daxpedda/web-time (*))1.1.0MIT OR Apache-2.0
webbrowser1.2.4MIT OR Apache-2.0
webpki-root-certs1.0.11CDLA-Permissive-2.0
webpki-roots1.0.11CDLA-Permissive-2.0
weezl0.1.12MIT OR Apache-2.0
[winapi](https://github.com/retep998/winapi-rs (*))0.3.9MIT/Apache-2.0
winapi-i686-pc-windows-gnu0.4.0MIT/Apache-2.0
[winapi-util](https://github.com/BurntSushi/winapi-util (*))0.1.11Unlicense OR MIT
winapi-x86_64-pc-windows-gnu0.4.0MIT/Apache-2.0
[windows](https://github.com/microsoft/windows-rs (*))0.62.2MIT OR Apache-2.0
windows-collections0.3.2MIT OR Apache-2.0
[windows-core](https://github.com/microsoft/windows-rs (*))0.62.2MIT OR Apache-2.0
windows-future0.3.2MIT OR Apache-2.0
windows-implement0.60.2MIT OR Apache-2.0
windows-interface0.59.3MIT OR Apache-2.0
windows-link0.2.1MIT OR Apache-2.0
windows-numerics0.3.1MIT OR Apache-2.0
windows-result0.4.1MIT OR Apache-2.0
windows-strings0.5.1MIT OR Apache-2.0
[windows-sys](https://github.com/microsoft/windows-rs (*))0.61.2, 0.52.0, 0.45.0MIT OR Apache-2.0
[windows-targets](https://github.com/microsoft/windows-rs (*))0.52.6, 0.42.2MIT OR Apache-2.0
windows-threading0.2.1MIT OR Apache-2.0
windows-version0.1.7MIT OR Apache-2.0
windows_aarch64_gnullvm0.52.6, 0.42.2MIT OR Apache-2.0
windows_aarch64_msvc0.52.6, 0.42.2MIT OR Apache-2.0
windows_i686_gnu0.52.6, 0.42.2MIT OR Apache-2.0
windows_i686_gnullvm0.52.6MIT OR Apache-2.0
windows_i686_msvc0.52.6, 0.42.2MIT OR Apache-2.0
windows_x86_64_gnu0.52.6, 0.42.2MIT OR Apache-2.0
windows_x86_64_gnullvm0.52.6, 0.42.2MIT OR Apache-2.0
windows_x86_64_msvc0.52.6, 0.42.2MIT OR Apache-2.0
[winit](https://github.com/rust-windowing/winit (*))0.30.13Apache-2.0
winnow1.0.4MIT
wit-bindgen0.57.1Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
wl-clipboard-rs0.9.4MIT OR Apache-2.0
writeable0.6.4Unicode-3.0
[x11-dl](https://github.com/AltF02/x11-rs.git (*))2.21.0MIT
[x11rb](https://github.com/psychon/x11rb (*))0.13.2MIT OR Apache-2.0
x11rb-protocol0.13.2MIT OR Apache-2.0
xcursor0.3.11MIT
xkbcommon-dl0.4.2MIT
xkeysym0.2.1MIT OR Apache-2.0 OR Zlib
xml-rs0.8.29MIT
xshell0.2.7MIT OR Apache-2.0
xshell-macros0.2.7MIT OR Apache-2.0
[yoke](https://github.com/unicode-org/icu4x (*))0.8.3Unicode-3.0
yoke-derive0.8.4Unicode-3.0
[zbus](https://github.com/z-galaxy/zbus/ (*))5.19.0, 6.2.1MIT
[zbus-lockstep](https://github.com/luukvanderduim/zbus-lockstep (*))0.5.2MIT
zbus-lockstep-macros0.5.2MIT
[zbus_macros](https://github.com/z-galaxy/zbus/ (*))5.19.0, 6.2.1MIT
[zbus_names](https://github.com/z-galaxy/zbus/ (*))4.3.5MIT
[zbus_utils](https://github.com/z-galaxy/zbus/ (*))6.1.0MIT
[zbus_xml](https://github.com/z-galaxy/zbus/ (*))5.2.1MIT
[zcheapstr](https://github.com/z-galaxy/zcheapstr/ (*))1.2.0MIT
[zerocopy](https://github.com/google/zerocopy (*))0.8.63BSD-2-Clause OR Apache-2.0 OR MIT
zerocopy-derive0.8.63BSD-2-Clause OR Apache-2.0 OR MIT
[zerofrom](https://github.com/unicode-org/icu4x (*))0.1.8Unicode-3.0
zerofrom-derive0.1.8Unicode-3.0
zeroize1.9.1Apache-2.0 OR MIT
[zerotrie](https://github.com/unicode-org/icu4x (*))0.2.5Unicode-3.0
[zerovec](https://github.com/unicode-org/icu4x (*))0.11.8Unicode-3.0
zerovec-derive0.11.6Unicode-3.0
[zip](https://github.com/zip-rs/zip2 (*))9.3.0MIT
zlib-rs0.6.8Zlib
zmij1.0.23MIT
zruntime0.2.2MIT
zune-core0.5.3MIT OR Apache-2.0 OR Zlib
[zune-jpeg](https://github.com/etemesi254/zune-image/tree/dev/crates/zune-jpeg (*))0.5.15MIT OR Apache-2.0 OR Zlib
[zvariant](https://github.com/z-galaxy/zbus/ (*))5.15.1MIT
zvariant_derive5.15.1MIT
[zvariant_utils](https://github.com/z-galaxy/zbus/ (*))4.2.0MIT

Changelog

All notable changes to claudius are listed here. The format follows Keep a Changelog, and claudius uses semantic versioning: until 1.0, a minor version may change the script language or the API, and the changelog says how.

Unreleased

0.16.0 - 2026-11-29

Added

  • ui: The radio is called Infinite Radio, in the app and on the site (#429)
  • radio: Infinite Radio samples as each genre does, in the app: recordings gathered before a song, credited on air and beside a saved song, opened in the studio as heard (#430)
  • radio: Infinite Radio samples on the site too: recordings found through the site’s search, chosen and cut by the engine, credited on air, handed to the studio (#433)
  • compose: A new song’s name fits its genre: each family’s own words and ways of naming songs (#435)
  • sampler: Its vocals: a recording’s whole voice sung through the song open, the song’s sections following the recording’s (#437)
  • radio: Not every song samples, a station of two genres or more fuses two of them now and then, and a skip mixes the next song in (#439)
  • studio: Send feedback, in the studio, the web demo, Cmd+K, the site and for assistants (#441)
  • radio: Songs blend as a DJ mixes them on a three-band mixer, club songs over their whole beat-only intro, and a record stops only after hip hop and R&B (#442)
  • studio: + Track’s Sampled tab finds a break, a phrase, a texture, a voice or a stab for the song’s genre in the free libraries, and holds the first find to sample (#443)
  • genres: Any number of genres fuse into one, in a new song, a remake of a recording and Change the genre (#444)
  • studio: + Track opens Add a track, a window with a card for each kind of track, as Add a recording is (#445)
  • site: Infinite Radio’s page is a player: a round play button beside the song on air, its progress, what comes next and the controls in one card (#447)
  • studio: Record a take, Play from a phone, Publish, Connect an assistant and the command palette in the windows’ new look (#452)
  • studio: The mixer’s strips give their faders the room: each track’s icon by its name, and mute, solo and its level in one row under the fader (#453)
  • studio: Infinite Radio’s window is a player, as the site’s page: a round play button beside the song on air, its progress and what comes next in one card (#455)
  • studio: Infinite Radio in plain sight: a radio button on the top bar, and Listen to Infinite Radio before a song is open (#465)
  • studio: Keys for the common actions: add a recording or a track, the phone, the chat, the radio, render, stop (#467)
  • radio: The browser’s songs draw on more instruments, fetched in the background after the first song (#470)
  • studio: A project file keeps what Publish was given, the details and the cover, and opening it brings them back (#479)
  • studio: The app saves a song as a project file too, and an assistant and the command line write one with export (#480)
  • linux: A file manager shows a project file by the cover it carries (#482)
  • macos: A project the app saves shows the cover it carries as its icon in the Finder (#483)

Fixed

  • genres: A song never draws General MIDI’s programs (FreePats’ synth strings, brass, basses, leads and pads) (#427)
  • studio: On a Mac the window’s own buttons sit on the top bar’s line, not above it (#431)
  • setup: Claudius setup installs only the packs it asks about, and says a small update’s size in MB (#432)
  • palette: Cmd+K offers and finds only what works now, so before a song is open nothing that needs one (#434)
  • ui: The desktop app’s notifications say what is ready and what came of it in plain words, never the log’s line (#436)
  • ui: Choosing a recording’s phrases or pieces is a step of the Add a recording window, not a window over it (#438)
  • config: A Linux computer whose user folders were never set up saves songs in ~/Music/claudius (#440)
  • radio: A blend hands the beat over on a downbeat when the outgoing song’s outro or the next one’s intro has none (#446)
  • studio: The phone’s turntable and the recorder keep up on a slow computer, which the studio’s browser tests now check in CI (#416)
  • radio: A skip lands on the next song’s beat: an intro without drums plays its last two bars under the mix (#448)
  • studio: The Add a recording window’s phrase boxes, and what a click plays, are each phrase as the sampler cuts it (#450)
  • ui: In a browser the Add a recording window says that its sung phrases are rough, found in the whole mix (#451)
  • studio: On a Mac only the studio’s windows have their buttons moved onto the top bar, not the Open and Save panels (#457)
  • site: Infinite Radio credits every recording a song plays, after a skip too, and the studio link carries them all (#458)
  • studio: Cmd+K offers Cancel only for a job the toolbar’s Cancel stops (#459)
  • studio: A long job’s notice waits for the job to end, and says a failure as one (#460)
  • sampler: Its vocals takes a file chosen in the studio, and the song’s own takes play on from its first section (#461)
  • studio: Add a recording draws one window a frame as its phrases are chosen, and its picker’s playback is drawn as it goes (#462)
  • radio: A fused song counts as each of its genres played, so neither follows it while another can (#463)
  • studio: Restart to update puts the new Claudius in place in the background, the window answering meanwhile (#464)
  • studio: The genre search forgives a typo, a word found as typed first (#466)
  • site: Infinite Radio’s page redrawn as a player: drawn icons, a pointer on every control, genre chips that keep their shape (#468)
  • studio: A held MIDI note keeps its length on a busy page, and the microphone test waits for the microphone to open (#469)
  • site: The samples Worker searches Openverse as the site’s registered application, so the radio samples again (#471)
  • studio: A window keeps its height while a search changes its list (#472)
  • studio: A project the app saves on a Mac shows as its name in the Finder, its .claudius hidden (#473)
  • feedback: A message is counted in characters as the studio counts them, and Send feedback says your system goes with it (#475)
  • palette: Cmd+K reads a genre typed with a slip as the genre, and a short word with two letters swapped as the word (#477)
  • studio: A Sampled track’s search takes up its first find only until the person searches, brings a recording or closes the window (#478)
  • studio: A genre chosen to lead a new song leaves the genres fused with it, and the one it replaced does not come back (#481)
  • studio: The Add a track window holds the studio’s keys, as New song and Change the genre do (#485)
  • studio: The dock grows to fit a whole mixer strip when the Mixer tab is chosen (#486)
  • radio: An echo or a record stop cuts a song where its hook ends, not eight bars into it (#487)
  • phone: On a slow page the turntable flings the record only when the finger lifts moving, and a new scratch starts in time (#488)
  • deps: The security scan passes again: cookie 0.18.3, and heapless’s nine unsound notices marked as not reaching claudius (#489)
  • studio: The demo’s engine describes an opened project’s cover as the project opens, not after the song renders (#492)
  • studio: A MIDI take in the browser ends at Stop, and a key let go just before Stop keeps its length (#493)
  • studio: The dock fits a whole mixer strip, its mute, solo and level too (#494)
  • studio: A scripted plan’s Analyze and Remake wait for the file chosen, which a slow computer hands over seconds after its dialog opens (#496)

Documentation

  • site: Claudius is a music producer that listens to its own songs, not only a beatmaker (#497)

0.15.0 - 2026-11-22

Added

  • genres: A drum lane can drift from bar to bar as a drummer’s does, and play its ghost notes on the steps a style names; neither by default (#408)
  • genres: House as it is made now: a DJ intro, an element every eight bars, its own hats and claps, swing, and chords on piano and organ (#409)
  • audio: Claudius reads Opus recordings itself, in Ogg, WebM or MP4, so every format it exports opens as a source (#410)
  • genres: Hip hop’s drums are played on drum machines, the TR-808 and uzu’s kit, in place of synthesized drums (#411)
  • genres: Techno with its rumble under the kick, and its builds swept by filters rather than snare rolls (#412)
  • mix: An effect can be switched off in its chain, kept in its place with all its settings and not heard (#414)
  • ui: The signal flow as the song’s lanes: each track through its effects as blocks that show what they do, zoomed and panned, everything edited where it is (#415)
  • genres: R&B as a band plays it now: 84 to 108 BPM, a live kit beside the 808, a finger bass on neo-soul and funk lines (#420)

Fixed

  • remix: In the web studio, a sung hook a little outside a genre’s tempo plays at its own speed, which a sampler meets, not at the range’s edge (#417)
  • analysis: A recording heard whole keeps its bars on the beat through a band’s riffs and drift, and starts them on its downbeat more often (#418)
  • genres: The genre benchmark’s beats are heard with the stems’ model downloaded when missing, and the beat’s change says it needs eight pairs at both lags (#419)
  • packs: A pack installed before claudius gained instruments in it says what it lacks, and downloading fetches only those (#422)
  • genres: A slow jam is 90s R&B, now that R&B is played mid-tempo by a band (#423)

Documentation

  • site: The landing page leads with what claudius does that no DAW does (#425)

0.14.0 - 2026-11-21

A song saved from the demo is a project file of its own, Song.claudius, in place of a .zip: Safari unpacked the zip it downloaded into a folder, which Open could not take. claudius opens a .claudius file wherever it opened a project (Open, the MCP tool open, the command load), and still opens the .zip projects earlier demos saved.

Double-clicked, a .claudius file opens in the Claudius app: on a Mac (the Finder, the Dock, Open With), on Windows, and on Linux from the .deb or .rpm. claudius studio FILE opens a song in the studio as it starts.

Added

  • mcp: Arrange makes a change asked for in the person’s words, as the palette reads it, as one change (#347)
  • songs: A bridge, a section of its own kind: under its neighbours, on the drums that keep time, on chords of its own that lead into the next section (#350)
  • songs: Build-ups stack their styles, take the bars asked at a section’s end, and gaps last the beats asked (#351)
  • studio: A song renamed takes its folder and its history along (#352)
  • studio: New song from the microphone: up to a minute recorded, then made a song of as a recording chosen is (#353)
  • ui: Themes: a look of your own or a community’s, as a file of the colours it changes, added from Look and kept (#355)
  • ui: The arrangement, the signal flow and the script are the song’s three views, switched over it, and Paint is a tool of the arrangement (#360)
  • ui: The signal flow as a board to work on: every track a row with its level, pan, mute, solo, meter and effects, wired into its bus, its sends and the master (#362)
  • ui: The pointer says what a press does: the hand, the grab, a knob’s arrows, a tool’s crosshair, and the sign of a button that is off (#363)
  • studio: A song saved from the demo is a project file of its own, Song.claudius, which a browser keeps whole and every claudius opens (#364)
  • ui: The signal flow board changes a track’s sends and the returns’ settings where they are (#366)
  • studio: A .claudius project double-clicked opens in the Claudius app, on a Mac, on Windows and on Linux (#370)
  • compose: Every song of a genre more its own: other grooves, more ways to write each part, more kits and sounds, each song’s drums glued its own way (#399)

Fixed

  • studio: A section added is set as the song’s own of its kind, else as the genre writes it, or like a section named (#344)
  • critic: A window Audiobox Aesthetics rates as not a number is left out, so no song gets a total that is not one (#354)
  • packs: A pack’s zip is extracted in Rust, so a computer without unzip installs every pack (#357)
  • studio: Cancel, or closing the New song window, stops the remake it started, and the song stays as it was (#361)
  • audio: A cache’s first read keeps the file it reads, and a trim takes out first the files larger than the cache keeps now (#367)
  • ui: A dock shorter than a mixer strip scrolls up and down, the tracks’ strips and the master’s together (#369)
  • studio: In the page, a play pressed while the first render is on its way holds across the next, and a song played to its end stays there when its next render arrives (#373)
  • studio: In the demo, a change that renders at once takes the place of a mix change’s wait rather than waiting it out (#374)
  • ui: A window made smaller shrinks the dock before the arrangement, which keeps the room its rows take (#375)
  • history: A section renamed together with one added at the end or the last taken out is not said to put the sections in another order (#378)
  • mcp: Trim_take says its seconds are the recording’s own, which a take stretched to the song’s tempo plays faster or slower than (#379)
  • mcp: Status gives the answer of each call whose work went on past it, a song made so in plain words (#380)
  • site: A skip while the next song mixes in goes to the one after it, Tune in starts after a failed list of genres, and the demo opens a fusion typed into its address (#382)
  • ui: The radio in the app lets go of the songs it has played, which a change kept for as long as the station played (#383)
  • studio: A section added to a fusion is set as the fusion writes it, with the drums its second genre plays (#385)
  • mcp: Arrange makes a reading as the palette does: its edits as one change, and undo, redo and going back as steps of their own (#386)
  • genres: The variety example takes genres alone, with no count before them, and counts a transition turned off as none (#387)
  • ui: The studio shows a section’s build-up and gap as the song plays them: its switches set before the lengths that turn them on, and a gap as long as the whole section (#388)
  • studio: A song renamed while a save renders stays one project, exports into the folder it lives in, and a rename or split the session refuses is put back in the studio (#389)
  • phone: A scratch follows the finger as smoothly as it moves, a record pulled back past its start is silent, and a take keeps every stroke and cut as it was played (#390)
  • ui: New song’s recording from the microphone ends when its tab is left and goes when the dialog closes, and waits for a browser’s Allow as the palette does (#391)
  • site: The web demo plays the drum machines its genres ask for that the site may pass on (uzu’s kit, FreePats’ synthesizer percussion) instead of synthesized stand-ins (#392)
  • ui: Themes whose names make one file name are kept apart, a theme named in symbols alone is kept too, and a theme kept again is written whole before its old file goes (#393)
  • ui: An editor the inspector opens shows in the arrangement’s dock, and the view the main area shows is kept between runs (#394)
  • studio: Closing New song stops its remake by the remake’s ticket, wherever the remake is: under way, its file still on its way, or not sent yet (#395)
  • ui: The board’s master loudness keeps the value dragged to, a return no track sends to opens in the inspector, and a track’s meter is silent where it does not sound (#396)
  • ui: The studio’s buttons and faders that are off show the sign that they cannot be pressed, and a section shows the grab from the frame its drag starts (#397)
  • analysis: A whole mix’s tempo heard at the octave people tap, not at twice or half of it (#398)
  • critic: The critic hears a recording clipped or cut to silence over and over, and stops praising it (#400)
  • remake: A trip hop flip plays a sung hook at its own speed in half time, not stretched by a quarter, on trip hop’s drums (#402)

Documentation

  • site: The landing page says what claudius is now, with a sitemap and structured data for search (#365)
  • design: 0017 says the licence of HTDemucs’s weights is not clear, as its author now writes, and that none go in until it is (#368)

0.13.0 - 2026-11-19

analyze hears a song’s own sections: each found to the bar and at any length (a verse of 17 bars stays 17), named for what it is (intro, verse, pre-chorus, chorus, bridge, instrumental, outro; intro, build, drop, break and outro in a track no one sings in), with the letter of the music it plays, where it builds into the next, and the phrases sung, to the beat. A remake’s hook comes from the choruses, and a rework’s and a rebuild’s sections are named for what they are (verse2, pre_chorus, chorus3), and a flip’s build plays the recording’s own build up to where its chorus starts, so its drop lands where the recording’s does. What read analyze’s section lines (bar 8 +16 groove energy 0.94 kick bass hats) reads bars 9-24 drop (B) energy 0.94, kick bass hats now, its bars counted from 1, and its JSON has each section’s label, group, build_bars, cut and sung, each bar’s start (bar_starts) and the phrases sung.

A save writes each track’s stem only when asked for (save with stems: true over the MCP and the API; Export, Each track on its own, in the studio): a song’s stems take a gigabyte or more, and every save wrote them twice, into the song’s folder and the render cache. A save the disk has no room for is refused before it writes the audio, saying what it takes and what is free, and no file is left half-written. What wants a song folder’s stems/ asks for them now.

With the ears, a guitar riff or a synth line that separating a recording left in its vocals is no longer heard as singing: a small tagger, CED-Tiny (6.7 MB, which claudius setup downloads), hears whether a voice is what sings there. On 78 songs with timed lyrics, a voice is heard in 9.6% of the time far from any sung line, against 14.7%, and in as much of the singing as before (88.4% of it, against 88.6%). It adds 1.5 to 3.5 seconds to a song’s analysis on an M1 Max, once: what it heard is kept with the recording.

Added

  • studio: The search fields find genres and sounds by meaning too, as the palette does (#292)
  • analysis: A song’s own sections: where each starts, which repeat, what each is, where a build resolves, and the phrases sung (#293)
  • remake: A flip’s build plays the recording’s own build up to where its chorus starts, so its drop lands where the recording’s does (#295)
  • ui: A light look with real contrast: the music on white, clean colours, a grid that shows and a pale LCD (#297)
  • studio: On a Mac the top bar is the window’s title bar, with the window’s buttons in it (#298)
  • ui: A small design system: one primary button, a window’s foot, a segmented control and an option card (#299)
  • sections: Set_section’s source sets where a section starts in the takes, to the beat (#301)
  • takes: Take:<name> names a recording the open song keeps wherever a command takes a recording’s path (#303)
  • sections: Split_section cuts a section in two that play on as it played (#304)
  • studio: The live mix, first by windows: a fader moved while the song plays is heard in a moment (#305)
  • ui: Every dialog opens as a window does: a title band with its close button, and the design system’s foot (#314)
  • ui: A choice of one of a few is a segmented control: a section’s length and drum pattern, and the drums’ variant (#315)
  • takes: Stems:<part> names a part of the recording claudius heard last wherever a command takes a recording (#318)
  • studio: The web studio hears the live mix: its player on Web Audio blends each window into the song as it plays (#320)
  • ui: Play from a phone ends in a window’s foot: Done leaves the page served, beside Stop serving the page (#324)
  • studio: The demo hears the live mix: its engine makes windows of a change to the mix while the song plays, and renders it once the song stops (#339)
  • site: The radio keeps to the genres chosen, skips on the beat, hands the song on air over as an MP3 and opens it in the studio (#342)
  • ui: The radio in the app: a station with an engine of its own, each change rendered as audio, skip, save and open in the studio (#343)

Fixed

  • takes: Each section keeps its own stretch of a take, so a section added, removed or moved leaves the others playing what they played (#296)
  • save: A song is saved without each track’s stem unless asked for, and a save the disk has no room for is refused (#300)
  • analysis: A recording’s sections are the same the first time it is heard and every time after (#306)
  • analysis: A riff or a synth line left in the separated vocals is no longer heard as singing (#307)
  • quick_fix: A take put to the song’s tempo keeps its length, and each section the moment of it that it played (#311)
  • studio: Duplicate is one change, which one undo takes back whole (#313)
  • audio: The decoded and stretched caches stop filling the disk: short sounds only, under a cap, the least used going first (#316)
  • studio: A section split in the studio starts its second half’s takes where the section had reached them, in bars (#317)
  • studio: The live mix comes back after a switch of connection and after a window that failed to come (#319)
  • analysis: The voice tagger is loaded once the ears allow its download, not kept absent for the session (#321)
  • xtask: Bench compare fails a comparison of nothing, takes a score’s direction from its ranks, and reads its paths from the repository’s root (#325)
  • critic: Bench compare compares each metric on the items that measure it, and a stopped critic run resumes with each item once (#327)
  • ui: The Change the genre window closes from its title band’s close button (#328)
  • studio: The app’s open and save dialogs open as sheets beside its frame, so resizing one no longer crashes it (#329)
  • ui: A section whose drum pattern no lane writes still shows it as chosen (#330)
  • audio: Each cache is trimmed on its first use in a process, and a long recording decoded before is dropped when read (#332)
  • ui: A mixer strip stands whole in the dock, its fader the height left over, and the master strip stays at the right (#333)
  • ui: The Notes tab has the page’s margins, and its part, progression and grid are segmented controls (#334)
  • ui: The Signal flow tab’s bar keeps the page’s margin in the dock, as every tab does (#335)
  • ui: In small windows the arrangement’s tracks stay above the master’s band, and the top bar fits a browser window down to 780 points (#337)
  • studio: The page keeps a play or pause pressed while a render is on its way, and plays a change’s live-mix windows through without a dip (#338)
  • history: A section given another name is said to be renamed, not taken out with another added (#340)
  • mcp: A call whose work outlasts 45 s says it is still going, and status gives its answer once it is done (#341)

Documentation

  • contributing: Every change to the critic, the analysis or a model is an experiment on real music against the last accepted change, and xtask bench compare judges it (#308)
  • site: The landing page’s pictures of the studio show it as it looks now (#336)

0.12.1 - 2026-11-17

Fixed

  • palette: The English word list reads on Windows too, whose checkout ends its lines with a carriage return (#287)

0.12.0 - 2026-11-15

A remake’s flip is built on the pieces the Sample window would offer first: the loop of the hook that comes back most, loops most cleanly and plays most alone, another passage unlike it, and the drums where they play alone. Made again, it draws them anew among the good ones. sample_song samples a recording’s phrases as the window offers them, sung whole, so a held note is never cut: a phrase longer than the bars asked for is refused with how many it takes, rather than cut on a bar line. With kinds, it samples a recording’s best drum break, bass line, loop or stab in one go.

Added

  • sampler: A remake’s flip and sample_song choose pieces as the Sample window does, and sample_song takes kinds (#283)
  • palette: Cmd+K answers questions about the song, from the song as it is (#284)
  • palette: A word typed with a slip is read as the word meant, and the palette says so (#285)

Documentation

  • design: 0018 processors and 0019 libraries of sounds and effects (#42)

0.11.0 - 2026-11-14

Add a recording shows what claudius hears in a recording before it asks anything: its length, tempo and key, whether a voice sings in it, and its sections over its waveform with each phrase its voice sings marked, to click and hear. The ways it goes in are cards (whole, its sung phrases, a passage, chops, a stab), and where it plays and how often its phrases come round are plain choices. The phrases to pick come numbered as they are in the recording.

Sampling a recording offers what producers take from records, not only its voice. Pieces of it offers loops of its hook and of another passage, its drum breaks, its bass lines and stabs of its chords, each scored as its kind and saying why. They come as a varied choice: two different grooves, say, rather than two cuts of one. Each goes in whole or on pads: chopped at its hits onto drum lanes that play it as it was, to play otherwise in the Drums tab or from a phone. Assistants have the same in sample_pieces (kinds) and keep_pieces (chopped).

Added

  • studio: Add a recording shows what claudius hears in a recording first, and offers its ways as cards (#265)
  • studio: The web studio’s page draws the studio’s outline and how much of it has arrived while it loads (#272)
  • sampler: Offer a recording’s drum breaks, bass lines and loops beside its sung phrases, each scored as its kind (#274)
  • studio: Hovering a track’s name says what the critic says of it, and a dot says there is something (#270)
  • studio: Pieces of it offers a recording’s drum breaks, bass lines and loops in the Sample window, each saying what it is (#275)
  • sampler: A varied offer of every kind of piece, more of the kinds producers and the song’s genre sample, and another take of other pieces (#276)
  • studio: An older claudius on the studio’s port can be stopped, its song saved to open here, and its port taken (#277)
  • mcp: A version tool says which claudius an assistant drives and whether a studio follows it (#278)
  • sampler: Pieces kept chopped onto pads at their onsets, and stabs of a recording’s instruments (#280)

Fixed

  • app: MacOS asks before claudius opens Downloads, Desktop or Documents, and a file it cannot open says how to set it right (#279)

Documentation

  • The Mac app is notarized, so the site and the guides no longer send people to Open Anyway (#266)
  • Credit the libraries, models, ports, fonts, sounds and papers claudius is built on (#262)

0.10.0 - 2026-11-13

A song can change its genre: click the genre under its title (or Variations, Change the genre…), choose another or two fused, and the same song plays in it. Its form, chords and key, its lead’s melody, its recordings and the notes written on it stay; the genre’s drums, bass, parts, sounds and mix play it. Undo brings it back. Assistants have change_genre, and the command line claudius change-genre.

If you installed claudius with the install script before and use the app now, the copy in ~/.local/bin may be the one your assistant starts, and an assistant connected to it knows only what that version could do. The studio now says so in a banner and runs beside it: connect the assistant again (?, Connect an assistant), remove the old copy or update it, and restart the assistant.

Added

  • sampler: Say how often a sampled phrase comes round, or let the song’s genre and sections decide (#257)
  • mcp: Assistants without the skills read them with guide, and the instructions map what claudius does (#264)
  • song: Change a song’s genre, keeping its form, chords, melody and recordings (#271)

Fixed

  • assistants: The studio and assistants no longer drive an older claudius left on the port (#263)
  • studio: Every control the keyboard reaches has the focus ring, egui’s own and every area that takes a click (#267)
  • analysis: A recording that changes little is heard as sections of 32 bars at most, and none a drop unless it is louder (#269)
  • studio: The inspector’s fields are as tall as what they hold, so a row that wraps no longer runs into the next (#268)

0.9.0 - 2026-11-13

Added

  • studio: Wear the dark look until you choose another, with its switch beside the score (#259)

0.8.0 - 2026-11-13

Added

  • sampler: A recording’s pieces are its phrases sung whole, never cut inside a word (#255)
  • remix: A flip made again draws its hook, its other passage and its drums anew among the good ones (#256)

Documentation

  • design: 0017 separates with HTDemucs, whose models are MIT; the community RoFormers have no licence (#254)

0.7.0 - 2026-11-12

What claudius hears in a recording is a window to use rather than a block of text. See what is in it, as it plays (it was Only say what claudius hears) shows its tempo, key, feel and loudness; its form, with the chord of each bar under it and the playhead going through both as it plays; its beat as a step grid; and its bass. Its voice, drums, bass and the rest play alone, as claudius took them apart, so you hear what it heard in each. Make a song like it makes a new song in any genre on its tempo, key, chords, form and swing, and Its tempo and Its key and chords give them to the open song. Assistants get the same with the new song_like tool, after analyze. POST /api/analyze answers with what was heard as data (heard) beside the words, and GET /api/listened/{id}/{track} plays the recording and its parts until claudius analyzes another.

A flip (Flip it into a song, remake with flip: true) keeps much more of the recording. It played its hook and one other passage, four bars each, round and round, and its voice in a phrase or two of a bar or two. Now each section plays as many of the recording’s bars on end as it has itself (up to 32), of its kind, from where the recording has the most no section played before, each on its own bars’ chords, and its voice sings on in them, never sped up out of its key. Flipped into deep house, the cookbook’s house song plays all 64 of its bars somewhere, where it played 8. The history says which section plays which bars.

The studio can be worked from the keyboard alone, and with a screen reader. ? lists every key. New are N (a new song), R (record a take), 1 to 9 (the tabs), Cmd+O and Cmd+S (open, save) and Cmd+P (the palette, beside Cmd+K). Tab moves through the controls with an orange ring on the one that has the keyboard, which Space or Enter presses and whose knob or fader the arrows move; Escape lets go of it, then closes the window opened last. A key now does exactly what its action in the palette does. The app’s window speaks to the system’s screen reader (VoiceOver, Narrator, Orca), each control saying what it is, its name and its state; in a browser, ? > Speak what has the keyboard has the page say aloud the control Tab moves to.

The app is at home on your computer. Its window’s title is the song’s. The keyboard’s media keys and the system’s Now Playing (Control Center, the Windows media overlay, MPRIS on Linux) play, pause and stop the song, move through its sections and seek in it, showing its title, genre and length. When Improve, a remake or listening to a recording finishes while another window is in front, a notification says so and the Dock or the taskbar asks for your attention; so does an assistant that asks for a take.

You can talk to your assistant from the studio. An assistant connected over MCP listens with the new wait_for_message tool and answers with send_message; while it listens, the status bar says so and the Chat window takes what you write, and its answers come in there, each saying which message it answers (with a notification when the app is in the background). The chat is kept between runs until you clear it. The commands are chat_say, chat_answer, chat_listen and clear_chat, and the state’s chat.

Or have claudius start an agent for the chat itself: the Chat window offers Claude Code, Gemini CLI and Codex, which claudius runs on your computer and talks to over the Agent Client Protocol, with its own tools and nothing else. What you write is its prompt, and its answer comes in as it writes it (POST /api/chat/agent).

Added

  • studio: See and hear what claudius hears in a recording, and make a song like it (#244)
  • remix: A flip goes on through the recording, its voice singing in it, rather than round two short pieces (#245)
  • studio: Work the studio from the keyboard alone, and with a screen reader (#246)
  • studio: The app’s window with the system: its title, the media keys, Now Playing and notifications (#247)
  • studio: Talk to your assistant from the studio, as it listens over MCP (#248)
  • studio: Have claudius start Claude Code, Gemini CLI or Codex for the chat, over ACP (#251)

Documentation

  • design: 0017 a rebuild that sounds like the recording (#252)

0.6.0 - 2026-11-11

The examples’ studies of famous records are gone. They were named after the records but played melodies of their own, so they didn’t sound like the songs they were named for, and a record’s melodies belong to its writers. In their place are seven famous pieces in the public domain, each played as it was written and named for itself, in the styles the studies were in:

  • Bach’s Toccata and Fugue in D minor as rap rock;
  • Mozart’s Rondo alla Turca as club rap;
  • the Moonlight Sonata as dark, minimal hip hop;
  • Für Elise as minimal electropop;
  • Eine kleine Nachtmusik as synth-pop;
  • Grieg’s Morning Mood as slow-building electronic pop;
  • the Habanera from Carmen as synth-funk rap.

in_the_end_study, in_da_club_study, yonkers_study, bad_guy_study, anti_hero_study, chihiro_study and big_poe_study no longer open. Their replacements are toccata_and_fugue, rondo_alla_turca, moonlight_sonata, fur_elise, eine_kleine_nachtmusik, morning_mood and habanera.

The command palette (Cmd+K) finds actions by what your words mean as well as by their names: “make it sound better” finds Improve the song, “sing over it” Record a take, “go back” Undo. A small model finds them on your computer, on any processor and without a graphics card: Model2Vec’s potion-base-8M, 8 MB, which claudius downloads from Hugging Face the first time you type in the palette (the web demo fetches it from the site). Until then, names find everything. The palette now does more as well: Try variations, Improve the song, Fix what the critic found, Stop what claudius is doing, Render the tracks, Download the sample packs, Release the song, Connect an assistant and the Script reference. GET /api/find?q= answers with what the palette finds.

A song keeps its history: every change made to it, as a log that only grows, saved with the song (history.jsonl). Opening the folder again brings undo and redo back as they were. Each change says what it did in words (“added the whistle track (lead), playing the synth whistle”). The new go_back command takes the song back to before any change undo can still reach, undoing it and everything since in one step, and redo brings them back one at a time. Assistants get the history and go_back tools for “go back to before we added the whistles”. The state lists the last 200 changes (history).

The palette finds what you did, too: “go back to before we added the whistles” offers to take the song back to before the change that added them, found by what each change did, by name and by meaning, on your computer. Each change is described in the words people use for it (“faster”, “louder”, “transposed”, “a middle eight”).

The palette does what you ask of the song in plain words: “more reverb on the snare”, “lets increase overload for guitar track to 95%”, “swap all toms for snares”, “cut the guitar from 1:02”, “undo the last 5 changes”, “mute everything except the vocals”. It shows a button for each reading of your words, saying what it changes from what to what (“Increase guitar’s drive from 20% to 95%”), and nothing changes until you pick one. Undo takes it back in one step. It reads requests on your computer in a fraction of a millisecond, by their words and by the examples nearest them in meaning, and it is measured on 330 example requests, phrased in many ways. The new together command makes several edits one change, and GET /api/find answers with what the words ask (proposed).

Requests the palette cannot make out go to a second small model on your computer: Cactus’s Needle 3, which claudius teaches to read its requests, in Rust (claudius-tune), with no Python anywhere. While it reads, about half a second, the palette says Reading your words…, and what it reads is a button like the others, which says it is the model’s reading when you point at it. When it cannot tell what you ask, it offers nothing. So far it reads a few of the requests the palette misses (“bring the choir in again”); teaching it on more of the ways people ask comes next. It is 35 MB, downloaded from Hugging Face the first time it is needed, and reads in the app, not yet in the web demo. GET /api/find says when it is still reading (reading), and which proposals it read (by_model).

You can say what you want to the palette: click the microphone at the end of its field, say “mute the drums” or “undo the last two changes”, and pause. Your words go into the field, read as if you had typed them, and nothing changes until you pick a button. claudius hears English on your computer with Cactus’s Whistle, ported to Rust (17 MB, downloaded the first time you speak), and keeps nothing of what you say. A word heard near one claudius knows is taken as it (“undu” as undo, “the base” as the bass). The palette also reads times and numbers as they are said, typed or spoken: “cut the guitar from one minute two seconds”, “set the tempo to ninety five”. POST /api/hear hears a WAV file of what was said. The microphone is in the app and in the web studio a claudius serves, not in the demo on the website.

claudius radio: a station of songs claudius writes as it plays them, one genre after another, each mixed into the next as a DJ would. Three songs in four mix in beat for beat, written at exactly the playing song’s tempo (or twice or half of it) and in a key of its notes, coming in on a bar line of its outro with their bass swapped halfway; a song in another tempo comes in after an echo out or a record stop. It all runs in the page, on the studio demo’s engine.

The studio has a light look as well as its dark one, and follows your computer’s appearance unless you pick one: ? > Look (Dark, Light, As the system is), or “light mode” in the command palette. Text reads at 4.5:1 or more on every panel of both looks, and so does a label on a filled button or a lit cell (white on the light look’s orange); the dark look’s faintest text is a little brighter for it, where it stood on a raised panel.

What you set survives any update, from any version: the studio’s settings, the voice a pitch check heard, the answer about usage statistics and whether to update by itself. Each settings file now says which version of it claudius wrote, and is read a setting at a time, so one a later claudius changed costs only itself, and one an earlier claudius does not know is kept when it writes the file. The studio’s settings move from RON under eframe’s key to JSON under settings; the old ones are read the first time and kept as JSON from then on.

Evolution and the studio’s Variations now revise a song’s form as a producer would: a verse and hook or a drop played again, a section left out, a bridge or a lift, a shorter intro or outro, two sections that sound as one set apart, a build-up of another style or strength. The critic judges the whole song’s form, even where evolution renders only a preview of it, against its genre’s own forms and on what listeners have been found to hear of a form: how long it runs, how soon it gets going, whether its sections can be told apart, and whether its hook comes back. The order of its sections, which listeners hardly hear, is left alone. Its form issues have targets of their own (form:short, form:long, form:intro, form:same, form:section, form:peaks- and form:peaks+), where a song’s length had form; the arc and a section out of its 4-bar phrases keep form.

They revise its instruments too: a part its genre writes that the song left out, or a layer a more layered song of its genre plays (a pad, a counter-melody, an arpeggio, a double, a clap, a shaker, a percussion line), or one that only colours the song taken out; a stacked sound’s layers rebalanced; a drum step programmed as a drum machine’s trig (by chance, rolled where the genre rolls its hats, flammed, laid back, tuned); an effect’s setting moved, an insert effect added or taken off as the track’s role takes one, and an equalizer move on the band the critic finds too loud or too quiet; and a sampled break or phrase re-chopped, in the genres that chop them.

The critic hears how much listeners would enjoy a song and how well it is produced, as Meta’s Audiobox Aesthetics rates them: a model trained on what listeners said of recordings, whose ratings of natural music follow theirs closely (0.89 for production quality, 0.75 for enjoyment). It is a new part of the score, aesthetics, worth as much as the genre’s; a genre whose sound is a dusty or distorted recording is held to its enjoyment alone, and the model’s two other readings are reported, not scored. The ears download its model (133 MB) with their first verdict, or with claudius setup, and score without it until then.

Three rock genres, played on a distorted guitar. alt_rock is alternative rock and grunge, loud, quiet, loud: a clean guitar picking its chords in the verses, two distorted guitars hard left and right in the choruses, a solo in the last. pop_punk drives power chords in eighths over a punk beat, with the skate beat in the last chorus and a guitar hook. nu_metal is rap metal: low power chords chugged off a hip hop groove, a bass locked to the kick, an eerie clean guitar in the verses and a half-time breakdown. Two comping idioms play their guitars: palm, the power chord palm-muted in eighths, and chug, the root palm-muted in sixteenths with the whole chord hit off the beat. The guitars are FreePats’ distorted electric guitar, a new instrument of the freepats pack (freepats:dist_guitar, CC0), which grows to 225 MB installed: run claudius-packs install freepats again to add it to a pack installed before; the web demo plays it too. No other genre draws it unless it names it. The critic no longer holds a part of power chords alone to voice leading: a guitarist moves a power chord as one shape. “rock” and “alternative rock” now find alt_rock, where they found art_rock.

Basses go deeper and are no longer the loudest thing in a song. A synth bass with nothing under its note gets a sine sub under it in the sub octave, below 90 Hz (a rack layer’s new fold: [28, 40] keeps it there), so it is felt on a subwoofer and heard on a phone. The mix holds its low end to its genre’s: where the bass and the kick together would fill more of the sub or the low band than the genre’s masters do, the louder of the two in that band comes down (low_end_db in the report), so the bass no longer buries a song’s sampled phrase or its chords. Trap, the drills, phonk, rage, hip hop and the genres near them lift their bass 1.5 to 2 dB less than they did. And a song’s first verse or hook no longer drops its bass to thin itself out; it leaves out another part.

A recording’s tempo is heard better. Where the tracker took the tempo its onsets repeated at most, near 120 BPM, it now also asks how well each tempo’s grid lies on the onsets, so a syncopated kick or a dotted rhythm no longer makes it hear a song a third or a quarter off its tempo (a hip hop song at 85 heard at 141, drum and bass at 117), and whether the kit plays a backbeat at it, so a slow song is less often heard at twice its tempo; it hears from 55 to 200 BPM, where it heard from 70 to 180. On claudius’s own songs the whole mix is heard at its tempo 65 times in 82 where it was 47. A rework halves the recording’s tempo when that is nearer the genre’s (one bar of the song to two of the recording’s, where the recording holds its chords two bars), as it doubled it: a 170 BPM song reworked as hip hop plays at 85, no longer at drum and bass’s speed.

A remake hears that a recording is louder in some places than in others. A flip’s pieces, cut from all over it, are each brought to its hook’s level, so a piece of a quiet verse no longer drops away beside one of the chorus; and a rework brings the recording’s sections halfway to one level, so a quiet verse is not lost under the genre’s drums, which keep one level all through.

The web studio demo plays real instruments: a song there draws on web editions of the sample packs, as the app draws on the packs (the Salamander piano, a Wurlitzer, strings, brass, flute, harp, mallets and sax from VSCO 2 and VCSL, guitars, basses, a choir, an acoustic kit, the TR-808 and TR-707; some 70 instruments in 24 MB, each song fetching its own), where every part played on a synth. A song asks for a Rhodes most of all, and no Rhodes recording may be passed on freely, so the Wurlitzer plays it there. claudius-packs web makes such editions of any installed instrument.

Added

  • evolve: Revise sections and length, judged on the whole song’s form (#218)
  • evolve: Change instruments, drum trigs, effects and sample chops (#219)
  • ears: Rate how much listeners would enjoy a song and how well it is produced (#220)
  • web: The studio demo plays real sampled instruments (#224)
  • genres: Alternative rock, pop punk and nu metal, on a distorted guitar (#227)
  • site: A radio of songs written as they play, mixed like a DJ set (#225)
  • studio: Find the palette’s actions by what the words mean, on the device (#230)
  • session: A song keeps its history, a log that only grows, and goes back to before any change (#232)
  • studio: The palette finds what was done to the song and goes back to before it (#233)
  • Breaking: examples: Famous public-domain pieces played as written, in place of the studies named after copyrighted records (#234)
  • studio: The palette does what you ask of the song in plain words, once you confirm it (#235)
  • palette: Read the requests the rules miss with Needle 3, taught in Rust (#238)
  • settings: Settings any later claudius reads, a field at a time (#241)
  • palette: Say what to do, heard on the device by Whistle in Rust (#239)
  • studio: A light look, and the system’s, beside the dark one (#242)

Fixed

  • mix: Basses go deeper and no louder than their genre’s low end (#221)
  • drums: A song’s added percussion line plays a conga, not a cowbell (#222)
  • analysis: A recording’s tempo is heard better, and a rework can play it in half time (#223)
  • remix: A flip’s pieces and a rework’s sections play at one loudness (#226)
  • studio: The web studio may use the microphone, and the app says how to allow one that hears nothing (#228)
  • critic: A song buried in noise no longer scores high, with the listening models or without them (#229)

0.5.0 - 2026-11-09

A recording can be rebuilt as a song of its own parts, every note of them yours to change: claudius remake --rebuild, Rebuild it in the studio’s New song dialog, or remake with rebuild: true for an assistant. Its drums are struck as it strikes them, each section on a pattern of its own; its bass and the rest of it are the notes Spotify’s Basic Pitch hears in their stems, on the genre’s sounds; its voice stays on a track of its own and the melody it sings is written out. On the cookbook’s house song nearly every kick and hat is right, nine bass notes in ten and two in three of the rest. Basic Pitch (Apache-2.0) is ported to Rust in earshot, and claudius setup downloads its model (0.2 MB) with the others; until it is there, a rebuild plays the genre’s bass and chords on the recording’s chords.

Twelve more genres, sixty-three in all. Festival EDM: big room (which “edm” now names along with electro house, future bass and trance), progressive house and slap house. The hard styles: hardstyle, hard techno and gabber, their kicks always synthesized and distorted in their own lanes, with a drummer of their own who rolls the kick into the next phrase. And the scenes of the last few years: hyperpop, Jersey club (its five-kick bounce, and a drummer whose kick bursts into triplets), afro house, melodic techno, baile funk on the tamborzão, and breakcore. Each has its forms, drums, parts, mix and what the ears listen for, and a starting point in the skill.

claudius is now released every day that it has a new feature, a fix or a change of performance, rather than whenever someone starts a release, so what is fixed on main reaches claudius update, the studio’s own update check, Homebrew and the install scripts by the next morning in Sydney.

A track can be played by several sounds at once, as a modern bass or lead is built: a clean sub for the weight, a distorted mid for the growl, a bright top for the edge. rack() in a script and set_layers for an assistant give a part, a drum lane or a pattern track’s sound up to eight layers, each playing its notes with its own sound, the band of frequencies it keeps (through crossovers that add up to the whole), its level against the others, its pan, transpose, duck under the kick and effects; a tremolo or a gate in a layer pulses that band alone. The rack sums them before the track’s own effects, so the track stays one row and one fader. The new band effect keeps one band of a sound, which also splits one sound into bands to treat each on its own in a parallel effect’s chains.

The ears run on the CPU on a Mac, as they do everywhere else. ONNX Runtime had been putting them on CoreML: every claudius that listened compiled its models into the temp folder, about 200 files, and one that was killed rather than quit, as assistants end claudius mcp, left them there, from a few megabytes to a few hundred each time. A judgement now takes two thirds of the time, with the same verdict. What earlier versions left is in $TMPDIR as onnxruntime-*: macOS clears it after three days unused, or delete it while claudius is closed.

A sample chopped onto the song’s grid keeps time inside each slice too. Each half beat of it used to play whole at the record’s own speed from the song’s half beat, so its second sixteenth landed a quarter of a sixteenth or more off the song’s: a break at 93 BPM chopped into lofi at 71 put every other hit 50 ms early against the song’s hats. Now each sixteenth of a slice plays from the song’s sixteenth, cut short or followed by a gap as an MPC chops by the hit. The critic now hears a boom bap song’s chopped phrase and break keep its 93.88 BPM exactly.

Tracks are balanced as a mix engineer stages them.

  • A track whose sound is more than 6 dB from its role’s level goes into its effects 6 dB from it. Before, a pad made 20 dB hot went into its saturator and compressor that hot, distorted, and was only turned down after. Its effects now work on it as they were set to; a sound made near its role’s level is unchanged.
  • A recording that plays under −45 LUFS, what a stem leaves of what it took out, is raised 12 dB at most, not the 30 dB that put a near-silent hook’s hiss on top of a song.
  • A rework’s voice sits 2 dB higher, where it is heard over the genre’s drums and bass. It was 3.5 dB under the kick.
  • A recording kept in memory (a page’s file, a test’s) is told from another kept under the same name by what it holds. Before, a loop warped from one could be reused for the other from the disk cache.

The studio says what it is doing with a recording, and shows what came of it. Sample its vocals into the song and Take its groove used to print where each phrase went inside the New song dialog, and nothing else: the dialog stayed open over the song they had changed, and nothing said whether claudius was still working, waiting for a click, or had failed.

  • While claudius works on a file, the dialog and the busy line at the top say what it is doing: taking it apart into its voice, drums, bass and the rest (with how far it has got), listening to it, sampling its voice, taking its groove, remaking it.
  • When the song has changed, the dialog closes, so that the song shows with its new tracks. The toast says what came of it in a line (“sampled 2 phrases of song.mp3 into the song: vox3, vox4”), and the render starts on the busy line.
  • The whole answer stays in the dialog and the Log.
  • A sample’s answer (and its undo) now starts with that line.
  • Analyze hears a recording with its stems apart, as a remake does.

The critic hears whether a song’s recordings keep its time. A remake whose recording played a few percent off the song’s tempo, its drums flamming against the genre’s, could score 90 or more: nothing it measured, and nothing CLAP hears, notices time. Now each track that plays a recording (a remake’s original, its hook, passages and break, a loop, a take) has its onsets measured where the renderer makes it: how tightly they gather on the song’s sixteenths, on those of the tempo near it they keep best, and how far they wander. A recording keeping a tempo of its own, or wandering more than 40 ms off the beat, is an issue naming the track (time:<track>), and the verdict keeps at most 35 % of its total. A remake declared 0.7 % off its recording’s tempo now scores 32 where it scored 91. Voices are not judged: their syllables keep no grid, and they keep the time of the rest of their recording. The verdict’s new time score and the measures time_<track>_on_grid, _own, _own_bpm and _drift_ms show it.

A remake plays a recording’s voice on tracks of its own, and no longer turns a singer into a chipmunk.

  • A rework plays its voice all through on a track of its own, vocals, mixed as a voice, beside the rest of it on original, so that the voice can be turned up, treated or muted on its own.
  • A flip builds on its hook without its voice, and the voice comes in on its own tracks, vox1, vox2 and so on.
  • A hook that keeps its voice (without the ears, or when the voice is most of it) plays in its own key, stretched or at its own tempo. It used to be sped up as much as five semitones to meet the genre’s tempo, its singer’s voice with it. Chipmunk soul, whose sound that is, still speeds it up (speeds_voices in a genre’s profile).
  • Every track with the vocal role (a sampled phrase, a take) is stretched rather than resampled, and moved to the song’s key with its formants kept where they were, so that a voice three semitones down still sounds like the same singer.

A recording is taken apart into its vocals, its drums, its bass and the rest before a remake or the auto-sampler uses it, with Deezer’s Spleeter (its four nets, MIT, about 160 MB, downloaded with the ears’ models by claudius setup or the first time they are needed; separating a four-minute song takes about 8 s, and the stems of the last three recordings are kept). Until now “without its drums” meant without what strikes, by harmonic-percussive filtering, which left the rest of the recording’s sound in the “vocal” and a smear of its drums in everything, playing against the genre’s.

  • A sampled vocal is the voice, on its own, in stereo.
  • A rework plays the recording’s voice and the rest without its drums or its bass, under the genre’s.
  • A flip’s hook is everything but the drums, and its break the drums alone.
  • The analysis hears the beats and drum habits in the drums, the chords without the voice’s melody over them, and where the voice and the kit come and go.

A recording with no kit, which used to be read as a kick on every sixteenth, now has no drum habits. Without the ears (Intel Macs, Windows) a recording is heard in its mix as before. claudius doctor says whether the nets are there.

A recording of a band keeps time with the song made from it. Its tempo used to be read as one, a grid fitted to the whole recording, and a band that speeds up and slows down drifts off any one tempo: a phrase cut from late in the song started half a beat or more off its bar, and a rework’s recording drifted against the genre’s drums. Now claudius follows the beats the band plays when they drift off the grid, cuts every piece (a sampled vocal, a remix’s hook, its break, a rework’s whole recording, a chop) on the bars as they were played, and stretches each of its bars to one length, so that the piece keeps one tempo and lands on the song’s grid. The chords, the drum habits and the sections it hears in a recording are measured over those bars too. The grid of a recording that keeps one tempo is finer than it was: its tempo is fitted to all its beats rather than the median gap between two, which was a whole number of 5 ms frames and could leave the grid a tenth of a beat off by the end of a song.

Leads are written the way each genre’s are, in 20 idioms, instead of one random motif for every genre:

  • G-funk’s portamento whine and trap’s dark bells;
  • drill’s piano bouncing in triplets and afrobeats’ flute;
  • reggaeton’s hook on the tresillo;
  • synthwave’s octave leaps and trance’s gated riff;
  • house’s organ riff and disco’s octaves;
  • horn riffs and reggae’s lazy horn lines;
  • the synth riff of grime and rage, and garage’s chopped vocal;
  • lo-fi’s sevenths, R&B’s runs down the scale and a rock lead;
  • ambient’s long notes, techno’s hypnotic stab, phonk’s cowbell and the 90s’ dark piano riff.

They follow the chords and end their phrases on a turn. The genres’ leads play them (part("lead", #{ style: "trap_bells" }) in a script); motif is still there.

Drums end their phrases the way each genre’s drummers do, instead of the same snare roll in every genre. Twenty drummers play turns at the end of four bars and fills at the end of eight and of a section, the same across the lanes:

  • boom bap’s kick pickups and kick and snare trading eighths;
  • trap’s hat rolls in thirty-seconds, triplet snares and a beat dropped out for the tag;
  • drill’s skipping triplet hats;
  • house’s clap rolls and the kick left out;
  • trance’s snare roll through the bar;
  • drum and bass’s snare rushes and break edits;
  • reggae’s rim into the next bar and its triplet roll into the drop;
  • reggaeton’s timbal;
  • afrobeats’ conga runs;
  • funk’s ghost notes and four on the snare;
  • rock’s and synthwave’s toms down the kit.

A fill goes on the nearest lane the kit has, a snare fill on the clap or a tom run pitched on the snare, and it fills up to the beat of silence before the next section. Drums generated from another genre bring its drummer. Trap, cloud rap, emo rap, phonk, plugg, rage, Chicago drill and alt R&B now fill in their verses and hooks.

A track can be written the way any genre plays it, into the song as it is: + Track, In a style, then what (drums, percussion, bass, chords, keys, pad, strings, lead or arp) and the genre. A part is written as that genre’s own part of the role is, in its idiom, on a sound from its palette, in its register and with its mix, as a new track or in place of one of the song’s parts; drums write the genre’s lanes from its templates and kits in place of the song’s lanes of their names, and percussion adds its shakers and rims beside them. A row’s menu has Another take, a lane’s written again as the genre it came from plays it, and Vary it, the same take with other details (a part keeps its rhythm, a drum lane its strong hits), and the Parts tab Vary. A lane remembers that genre in the script as lane("kick", #{ genre: "reggaeton" }). Assistants have generate_track and vary_track, and the API the commands of those names.

Chord parts comp the way each genre’s players do, in 18 idioms written in chords: house’s stabbed piano, gospel and neo-soul’s pushes and slips into the changes, lo-fi’s lazy jazz chords, trap’s held keys with the top voice picked out, reggae’s skank and organ bubble, funk’s chicken scratch, a strummed guitar, highlife’s picking, a ballad’s arpeggio, and for strings and horns a held legato, a driving ostinato, pizzicato, disco’s stabs and runs, tremolo and horn stabs. The genres’ keys, guitar, string and horn parts play these, and a strings track generated in a genre plays as its family’s arrangers write them.

Bass lines are played the way each genre’s bassists play them, in 29 idioms written bar by bar as those players would: reggae’s one drop, which leaves the one empty and plays around the drop on three; funk’s slap, its dead notes between octaves popped on the offbeats; disco’s octaves walking up into the next chord; UK garage’s skipping line; reggaeton’s dembow on the tresillo; afrobeats’ pushes; amapiano’s log drum; a jazz walk with chromatic approaches and enclosures; neo-soul’s ghosts and slides; G-funk’s Moog; boom bap’s held roots and pickups; drum and bass’s two-step; and more, with 808s that glide up into a trap hook’s phrase ends (glide) or slide from note to note as drill’s do (drill). A line plays in phrases that end on a turnaround, and varies its details from bar to bar (a dead note, an octave, an approach into the next chord, a note pushed ahead of the bar), instead of one bar over and over. The genres’ bass parts play these now (part("bass", #{ style: "one_drop" }) in a script), and a new seed is another take.

A sound you do not like is a click from another. Hover a part’s or a drum lane’s name in the arrangement (or a lane’s in Steps, or a part’s sound in Parts) and click the swap button: the track plays the next sound that fits it, its genre’s own first, then what the genre draws for that role, then further afield, never one another part plays; a drum lane goes through the installed kits and its synthesized voice. Right-click the row for every sound it could play. Sounds, after Mutate, swaps the whole song’s at once: every part’s sound and the drums’ kit, or just one of the two. The notes, patterns and mix stay, and Undo swaps back. Assistants swap with the new swap_sound tool, and the API’s swap_sound command; a track’s view lists its swaps, the one it is playing and its next_swap, and the song’s lists the kits.

FLAC files come out smaller and in a fraction of the time: claudius encodes them frame by frame, each frame in the smaller of the encoder’s two ways of choosing predictors, and a frame both misjudge (4,096 samples, half silence and half noise, came to 1.3 GB either way) holds its samples verbatim instead of being written out first. A three-minute song’s FLAC took 6 seconds and 12.7 GB of memory and came out as large as its samples; it now takes under a second and 82 % of them. Keeping a recording as a take no longer takes gigabytes, or stops claudius on Windows.

A melody of single notes gets chords under it: Add chords under it, in a part’s menu in the arrangement (or harmonize for an assistant, or part("lead_chords", #{ role: "keys", harmonizes: "lead" }) in a script), adds a part that plays chords fitting the melody’s notes and the song’s own chords. The song’s chord stays where the melody’s notes are its chord tones or pleasant extensions (a 9th, a 6th, a 7th); over a held note that clashes with it, the key’s chord that holds the note takes its place, as a player would reharmonize it. A chord on each note (block, on the melody’s own sound, voiced under it with smooth voice leading) makes the melody itself sound in chords; a pad, stabs or offbeats play the chords in a chord part’s rhythm. The chords follow the melody through edits, mutations and a new seed, and play only where it does. Removing a part now also lets the parts that doubled or harmonized it play their own, so the song’s script still runs.

The studio looks sharper and quieter: its text is set in Inter instead of egui’s default font, its buttons’ icons are Lucide’s, one line weight throughout, instead of shapes drawn by hand, and its controls are filled, rounded and outlined only under the pointer, with a slim slider handle. The status bar’s keys and the arrangement’s legend of section kinds no longer run over what is beside them in a narrow window.

claudius keeps count of how fast it runs: each render, each listening of the ears and each recording decoded, the seconds of audio and the seconds they took. claudius serve answers GET /api/metrics with the totals in Prometheus’ text format, for a scraper or a look. The usage statistics, for those who turned them on, now also send each kind’s speed (seconds of audio a second, to two figures) at most once a day, so that a release that renders slower shows; the events have a value for it ("v": 2), and older versions’ events still count.

The phone’s turntable plays records a DJ would reach for: the song’s samples (the phrase it was built on, a flip, a take), its voices, its parts, a sampled break, or the whole mix, never a lone kick or clap. With the motor on, the record spins in time with the song, and a pitch fader moves it up to 16 % either way, with a button back to time. A finger holds it as a DJ’s does: resting, it drags the record slower the harder it presses (read from how large the fingertip’s touch is, since a phone measures no force) and stops it under a firm press; moving, it grabs it to scratch or spin it by hand; and let go mid-swipe, the record runs on faster, or spins back, until the slipmat brings it back. The motor brings the platter up to speed and the brake stops it in a third of a second, as a DJ’s turntable does. It also puts on samples from the library: the phrases, vocal chops and breaks gathered for the song’s genre, and Apple Loops and your own loops of its kinds, each spinning at the speed that plays it in time with the song, and a scratch on one credits it in the song’s credits.txt. ● mic records a record off the phone’s microphone, up to 8 seconds, where the browser lets the page use one (the demo’s page, or the page opened on the computer running claudius); a scratch on it is a take like any other (add_scratch has a recording).

Songs play with a feel. humanize no longer jitters each hit on its own by a few milliseconds, too little to hear: each hit now drifts with the ones around it, behind the beat for a while and ahead for a while, as a player’s does (a 1/f drift, which listeners prefer in Hennig et al.’s study), by about 15 ms at 1, the kick less and the hats more. The drum lanes share part of the drift, as one drummer’s limbs. A lane or a part can also play every hit behind or ahead of the beat on purpose (lane("snare", #{ late: 25 }), part("bass", #{ late: 15 }), set_lane’s and set_part’s late_ms, a feel slider in the sequencer’s lane settings), as an MPC’s shift timing moves a pad: J Dilla’s snare late and kick early. The genres that play that way do it from the start: a neo-soul snare 18 to 38 ms behind and its bass 12 to 30, a boom bap or lo-fi backbeat laid back, reggae’s rim and bass behind, a funk drummer’s hats pushed. Songs made before sound a little looser than they did.

Hip hop sounds like hip hop rather than a lounge: no more vibraphone leads, organ, pizzicato, choir or soul-jazz vamps, but dark minor loops of a few chords on a piano or a Rhodes, strings under them now and then, a ticking hat, and a distorted 808 or sub. And a song sounds of the 80s only where its genre does: the FM tine piano, leads, basses and mallets, the square and pulse-width leads and pads, the string machine and the chip are drawn only in a genre whose palette is retro (synthwave) or whose parts name them (grime’s square lead, UK garage’s FM bass), and so are an installed FM piano, CP-80 or Pianet and General MIDI’s synth patches, the cheap polyphony of an old sound card; General MIDI’s other sounds play only where nothing else of their kind is installed. Alternative hip hop, neo-soul and R&B play Rhodes and Wurlitzers, pianos, real strings and warm or vocal synths instead of a DX7 piano, an FM lead standing in for a flute and a string machine.

Genres can be searched, and are grouped by family. The New song dialog has a search box above the genres, which it lists under their families (hip hop, house, bass music …) until one types: then it shows those that answer, best first. A search finds a genre by its name, by the other names, eras, scenes and artists it goes by (aliases: “90s hip hop”, “golden age”, “west coast”, “r&b”), by its family and by its sound (“dusty”). So does claudius genres WORDS, GET /api/genres?q=WORDS and the MCP tool find_genre; catalog lists the genres by family with their other names, and new_song and remake take another name that is no other genre’s (“90s hip hop” is boom bap). A genre file of your own can say its family and aliases too.

Fourteen more genres, most of them the hip hop and R&B people asked for by name: G-funk (the West Coast’s Minimoog bass and the whine of a new synth lead that glides a long way, glide_lead), gangsta rap (the 90s’ hardcore dark piano and string loops on dusty breaks), jazz rap (the Native Tongues’ jazz records, upright bass and horns), chipmunk soul (the 2000s’ soul records sped up until the voices rise), crunk, cloud rap, emo rap (built on a guitar loop), rage, plugg, NY drill, Chicago drill, 90s R&B (hip hop soul and slow jams on the DX7 piano), new jack swing and alternative R&B. Each is searched by what it is called (west coast, 90s r&b, pbr&b, sped up soul …). drill now finds all three drills rather than naming UK drill.

Remake keeps the song recognizable: it reworks the recording rather than building a new song on its hook. All of it plays through, from its first downbeat to its end, at its own speed and pitch, its voice, chords and melodies as they are, without its drums and with its low end cut; the song is its own sections bar for bar, on its chords bar by bar and in its swing; and the genre plays under it, its drums, its bass on those chords’ roots in place of the recording’s, its break and textures and its treatment of a sampled phrase, its mix. It plays at the recording’s tempo, or double it, so that nothing is stretched. The remix it made before, a new song of the genre on the recording’s hook, a passage of its verses, its drums, a flip of it and its sung phrases, is Flip into in the New song dialog, and flip: true in remake (--flip, ?flip=true).

The online demo listens to the recordings you choose, as claudius does, instead of making up what it hears: Analyze analyzes the file, Remake reworks it and Flip into flips it, Sample its vocals into the song samples them (it said “the demo samples no recordings: start claudius serve to sample one”), and Take its groove takes it (it said “the demo hears no grooves”). It all runs in the page, and what a song keeps of a recording goes in the project you save.

Your own recordings go into a song from the studio: drop a song or a sound anywhere on it, or press the new + after the record button and choose one, and Add a recording adds it whole as a track from the section you pick, or samples its vocals into the song. A take’s menu in the arrangement has Trim…, which keeps part of its recording, from a start to an end, so a whole song added as a track starts later in itself or stops sooner; effects go on it in the mixer as on any track. Undo brings a trimmed take back whole. Assistants trim takes with the new trim_take tool (and command), and the state gives each take’s length (seconds). It works the same in the online demo.

The same window searches the free online libraries (CC0, public domain and CC BY): type a few words, press ▶ to hear a recording, and Use it to add it whole as a track or sample its vocals; the song credits it. Wherever a command takes a recording’s path (add_take, sample_song, analyze, remake), library:<id> names one a search found, which claudius downloads; assistants search with the new search_recordings tool, and the HTTP API has /api/library/search and /api/library/audio. A take added from a downloaded recording, and each phrase sampled from one, now credits it too, as a song that plays the file did.

Sample it…, in the same window, opens the new Sample window: up to four pieces the auto-sampler found in the recording, each to hear as it was cut and through a treatment side by side (dusty tape, an echo into a hall, lo-fi crushing, a phaser, a telephone’s band, a stutter, a reversed tail). Keep each as it was or treated, or leave it, and Regenerate draws another take: other phrases, other lengths, other treatments. Assistants have sample_pieces, redraw_pieces and keep_pieces; the HTTP API has POST /api/sample/pieces and GET /api/pieces/FILE, and the state the pieces. It works in the online demo too.

The demo records takes too: the record button, which only the app and a claudius’ own page had, records a voice or an instrument over the song in the browser, and the take joins the song and the project you save. A take’s menu in the arrangement works there as in claudius: How is it sung? hears how it is sung, Turn it into drums turns a played or beatboxed beat into the drum lanes, and Turn the melody into notes plays what was sung as a part, which the demo turned down before (it said “the demo hears no singing” and “the demo hears no drums”). Tune it tunes a take there too, and Check my pitch hears the phrases you sing back (it said “the demo hears no singing: start claudius serve for a pitch check”); the voice it hears tunes your takes from then on, as in claudius, for as long as the page is open.

Added

  • telemetry: Count how fast claudius renders, listens and decodes (#144)
  • phone: Spin the song’s records in time on the turntable, and brake, scratch or fling them with a finger (#145)
  • phone: Put a sample from the library on the turntable, spinning in time with the song (#147)
  • phone: Record a record off the microphone, and scratch it into a take (#148)
  • render: Play with a feel: a player’s 1/f drift, and lanes and parts behind or ahead of the beat (#149)
  • genres: Hip hop that sounds like hip hop, and the 80s sounds only in the genres of that era (#150)
  • genres: Search the genres by name, other names, era, scene and sound, grouped by family (#151)
  • genres: Fourteen hip hop and r&b genres, from g-funk and jazz rap to rage, plugg, drill and 90s r&b (#153)
  • remake: Rework a recording so it stays the song it is, with the genre under it; the old remix is the flip (#152)
  • demo: The demo listens to the recordings you choose: analyze, rework, flip, sample their vocals, take their groove (#154)
  • demo: Record takes in the online demo, and hear and transcribe them there (#156)
  • demo: Pitch checks and tuning in the online demo (#157)
  • studio: Add a recording of your own whole as a track, and trim takes (#158)
  • studio: Search the free libraries for a recording, hear it and add it (#159)
  • studio: The Sample window offers the auto-sampler’s pieces, raw and treated, to hear, regenerate and keep (#160)
  • studio: A sharper, quieter look: Inter for text, Lucide’s icons, filled controls (#161)
  • theory: Chords under a melody: harmonize a part with chords that fit its notes and the song’s (#162)
  • studio: Swap a track’s sound for the next that fits, or the whole song’s at once (#164)
  • theory: Bass lines played the way each genre’s bassists play them, in idioms with phrases and turnarounds (#165)
  • studio: Write a track the way any genre plays it, as a new track or in place of one, and vary it (#166)
  • theory: Chord parts comp the way each genre’s players do (#167)
  • theory: Drums end their phrases the way each genre’s drummers do (#168)
  • theory: Leads written the way each genre’s are, in 20 idioms that follow the chords (#169)
  • remake: Separate a recording’s vocals, drums, bass and the rest with Spleeter, and hear and sample them apart (#171)
  • studio: A toolbar in plain words, with menus and the render’s state at its right end (#179)
  • studio: An arrangement, a section and a verdict easier to read (#180)
  • studio: A New song dialog in two halves, from a genre or from a recording (#182)
  • mcp: Every studio command checked and named for assistants, and install_packs (#181)
  • mcp: Make_song from a person’s words, and the song in plain words for them (#185)
  • Example songs in the style of each decade’s hits, to open from the studio, an assistant or the command line (#186)
  • Eighteen more example songs, from boom bap to amapiano, and three classics remade (#187)
  • studio: + Track adds a recording: a file, a search of the free libraries, or a take recorded (#191)
  • studio: A (?) beside every setting that is not plain, in plain words, with a link to the docs (#193)
  • engine: Layered sounds: a track played by several sounds at once, each in its band (#190)
  • examples: Three songs built of layered sounds (#195)
  • sampler: Four ways to sample a recording: its phrases, a passage, chops or a stab (#196)
  • studio: A click selects a cell of the arrangement, and a track inspector shows the track (#192)
  • studio: The signal flow opens large, in the arrangement’s place (#194)
  • studio: A command palette, and menus grouped under what they act on (#198)
  • studio: The track card explains its settings and shows a layered sound’s layers (#199)
  • critic: Quick fixes for what one change fixes, at a click (#200)
  • form: A build-up’s style and how hard it builds (#201)
  • studio: The script says what its numbers set, and Alt+arrows turn a number (#203)
  • genres: Bass-heavy genres stack their bass for headphones and subwoofers (#204)
  • examples: Studies of seven famous songs, from In the End to bad guy (#205)
  • demo: The demo opens the projects it saved (#202)
  • studio: Say in words what the studio’s names and numbers are (#207)
  • genres: Twelve more genres, from big room and hardstyle to hyperpop, Jersey club and afro house (#211)
  • earshot: Hear the notes one instrument plays, chords and all, with Spotify’s Basic Pitch (#213)
  • remake: Rebuild a recording as a song of its own parts, every note of it editable (#216)

Fixed

  • takes: Credit what a scratch’s record was cut from, even once the song no longer plays it (#146)
  • studio: The New song dialog says what Remake and Flip into do (#155)
  • encode: Encode FLAC frame by frame, a frame the encoder misjudges kept verbatim instead of written out in gigabytes (#163)
  • analysis: Follow a band’s beats when they drift off one tempo, and cut pieces on its bars (#170)
  • remake: A recording’s voice on tracks of its own, its pieces from where it plays, and no chipmunk vocals (#172)
  • judge: A recording out of the song’s time is named and cuts the verdict (#173)
  • studio: Say what is being done with a recording, and show what came of it (#174)
  • mix: Stage each track’s gain into its effects, and leave what a stem left out quiet (#175)
  • sampling: A loop chopped onto the song’s grid keeps it inside each slice too (#176)
  • studio: An Instruments row that fits, with its density as a percent (#183)
  • ears: Run the models on the CPU, so they stop leaving CoreML copies in the temp folder (#188)
  • studio: The Sample window plays its pieces, and says how to put them in the song (#189)
  • studio: Rows wrap instead of overlapping in narrow windows, and the dock keeps its height (#206)
  • deps: Update rusqlite to 0.41 and rmcp to 3.9 for RUSTSEC-2026-0457, 0459, 0461 and 0462 (#209)
  • studio: Rows never widen the panel that holds them, so the Sounds tab keeps room for its sounds (#208)
  • analysis: A clap struck with the kick is heard, and an open hat is no snare (#215)
  • analysis: A steady track whose beats slip onto its offbeats keeps its grid and its first bar (#214)

0.4.0 - 2026-11-06

The phone plays the song in the studio as well as following it: ▶ plays it and ■ stops it, so a take needs no trip to the computer. With the song stopped, ● starts it a bar before the section it is at, and the take starts with that section.

Remake remixes a recording in the genre you pick, rather than writing a new song only on its skeleton. The new song is built on the recording’s own sound. Its hook without its drums plays in the hooks, and the song takes its key and chords. Another passage of it plays in the other sections, and its drums are the break where the genre plays one. A flip of it, half beats cut from all over it on the hook’s chords, plays in the intro and the outro, and its sung phrases come in where they agree with the chords. The genre plays it at the recording’s own tempo, or at a multiple of it as a sampler would. sampled: false (--skeleton on the command line) remakes the skeleton only, as before.

A new genre, alt_hip_hop: alternative hip hop in the vein of Tyler, the Creator’s records, layered as its producers layer it. It has lush ninth and eleventh chords (a new progression style, lush_soul, with its minor iv borrowed and chromatic mediants) on a Rhodes stacked on warm synths, strings and a flute; a distorted 808 with a fuzzy synth bass an octave over it; a swung kit with a clap on the snare; soul records chopped under it; and a beat switch into half time before the last hooks. Its songs are layered at complexity 0.8 unless asked otherwise.

A new song can be as layered as you like: Layers in the New song dialog, --complexity on the command line and complexity in new_song and song(), from 0 to 1. At 0.5 a song is its genre as written; toward 1 its harmony and lead are doubled on second instruments (an octave up, or in unison on another sound), its bass an octave up through a high-pass, and a counter-melody, an arpeggio over the hooks, a pad, a clap on the snare, a shaker and a percussion line come in where the song lifts, with more of the samples a sampled genre colours its songs with and the drums a break stands in for played over it. Toward 0 it is thinned to its core. A double is a part that plays another part’s notes (doubles and octave in part()), so it follows that part through edits and mutations.

A sample doesn’t always play slowed down or sped up to the song’s tempo. A phrase can also be chopped onto the song’s grid at its own pitch, at two thirds, three quarters, four thirds or three halves of its tempo, as an MPC chops a record: each half beat plays from the song’s half beat, so its bars and chords line up. A 120 BPM record plays at its own pitch in a boom bap song at 90. The song’s seed picks among the ways that suit the record and the genre: chopping suits a record with a clear pulse in a genre that chops, and house still speeds its records up. A break off the song’s tempo is chopped onto the grid too, rather than stretched, so its hits stay crisp. In the web demo, where nothing stretches, a phrase no speed fits now plays chopped instead of being left out.

On a phone playing along, a quick second tap plays again instead of zooming the page in, wherever it lands, and two fingers apart are two fingers rather than a pinch. The pads and the keys are drawn on a canvas, where every finger is its own, so several play at once and a finger slid along the keys glides from key to key.

A scratch sounds like a turntable’s, on the phone and in the take it makes. The platter follows the finger as a platter follows a hand, its speed changing smoothly through each turn back, where it jumped every few milliseconds. A record moved fast whistles no highs folded back: the needle reads it from a copy whose highs are taken out as far as its speed needs. The crossfader opens within a hair of its travel, as a scratch DJ’s does. The record waits at its first sound, which a sticker marks, and the deck takes a voice, a sample, a lead or a stab when the song has one. Let go, the record comes up to speed (or to rest) in a fraction of a second, as a real one does.

The studio demo mutates and evolves songs, as claudius does. Its engine judges the variations one after another in the page, without the ears, and keeps the best when it beats the song; Stop keeps the best judged so far.

The studio demo’s download button hands over the song as FLAC, lossless at about half the size of the WAV it gave before. Its export menu offers WAV, AIFF, FLAC, MP3 and Opus, which the demo’s engine writes in its Web Worker, so the page doesn’t stop while a song encodes.

A song begun in the demo can be carried on in claudius. The export menu’s claudius project (.zip) holds the song, every sample it plays (cut from the free libraries’ recordings, in lossless FLAC) and, beside each, the recording it came from: its page, who made it and its licence, with their credits in credits.txt. Open the zip in the studio, or open it from an assistant, and claudius unpacks it into a song folder of its own under ~/Music/claudius and opens it there, samples and all. The blueprint.json of the folder Safari unpacks the zip into opens the same way.

Some genres sample a bass note, as their records do: funk a slap bass, reggae a dub bass, phonk a distorted 808, boom bap, lo-fi and trip-hop an upright’s pluck, and the disco, soul and hip hop genres a bass guitar, a fretless or an 808 now and then. The song’s bass keeps its notes and plays them on the note, as a sampler would. A note is cut from its attack, at the pitch it sounds at: an 808’s C1 is found, and so is a low note whose fundamental is weaker than its octave. A kick, a drum loop, a whole song or a note out of a full mix isn’t kept.

The mix balances each track on how loud its hits are. It measured a track over 3-second windows, which hear a clap on two and four with the silence between its hits, so the sparse tracks played louder than their levels said: snares and claps by about 4 dB, crashes by 3, impacts by 5 and reverse crashes by 7, an impact as loud as the kick. Measured over the 0.4-second windows that hear each hit, every track now plays within about a dB of its level, and the snares, claps and transitions no longer crowd the bass and the chords.

The critic hears each track against the others. It judged the mix by meters on the master alone, so a song with its chords 9 dB too loud could still score in the high 80s. Now a track more than 3 dB from the level its genre makes it at is named and costs the mix (chords is 9.0 dB louder than the chords level, target level:chords+), and evolution turns it back. A part playing a sound its genre has no place for costs the song (sound:<part>). The critic is held to this by tests that break a song it passes, one fault at a time.

Eight new genres, thirty-six in all:

  • hip hop: modern, between boom bap and trap.
  • R&B: lush ninths on Rhodes over an 808, with rolling hats and snaps.
  • funk: on the one, with ghost-note snares, clavinet, rhythm guitar and horns.
  • tech house: a rolling offbeat bass under looping percussion.
  • ambient: pads, drones and field recordings that swell and fade.
  • grime: jagged 140 BPM drums with square-wave bass and eski synths.
  • phonk: a distorted 808, with a new cowbell_lead preset playing the melody the way an 808’s cowbell does.
  • reggae: the one drop, with a skank on the offbeats and dub’s echo.

Each digs for its own kinds of record when it samples.

A song of any genre can be built on samples from free libraries, as records built on samples are: a phrase the song takes its key, tempo and chords from, a drum break, a texture. Each genre digs for its own kinds of record (house for disco, gospel and philly soul, trap for orchestral strings, choirs and flutes, afrobeats for highlife guitar), tried in an order each song’s seed picks, or for words of your own (new_song with sample_search: "70s soul", claudius make --sample-search). A phrase plays as a sampler plays a record, faster or slower by whole semitones until it falls in the genre’s tempo, and the song takes the tempo and key that come of it, so it is resampled, not stretched, and in tune. Lo-fi, jungle, big beat and filter house are now built on samples by default, like trip-hop and boom bap; sampled: false (--unsampled) makes them of their own sounds. A genre’s collection grows a few recordings with each new song (Songs built on samples). The studio demo samples every genre the same way, from Freesound, Jamendo and Wikimedia Commons: claudius itself cuts each recording in the page, a phrase out of a whole song as the app cuts one, where the demo cut only loops whose titles stated a tempo. In the studio and the demo alike, the New song dialog’s auto-sample from free libraries turns it on or off for the song, and its field takes the kind of record to search the phrase for.

A song built on samples plays two passages of its record, as records built on samples change what they play from one part to the next: the phrase, now chosen from bars the recording plays again, so that it loops as the record does, and two bars from another section of the recording (or on other chords). The louder of the two plays where the song lifts, in its drops and hooks, and the other in its verses, breaks, intro and outro, each on its own chords (the sample and sample2 tracks).

A song treats its phrase as producers treat a record, with one move that its seed picks from those its genre makes: held behind a filter that opens as the song lifts, darkened, narrowed to a telephone’s band in the intro and the breaks, overloaded or smashed, or crushed to 12 bits. Trip-hop darkens and filters, big beat overloads, lo-fi darkens and crushes, and filter house keeps its own sweep. The song’s history names the move.

Songs chop vocals from other records, as garage, house and future bass do: a gathering finds a note a voice holds on an a cappella or a vocal sample (the steadiest and loudest of about a third of a second), and a new part, vox, plays it on the song’s chords in the drops and hooks, moved from the note it was sung at as a sampler would, as a motif or an arpeggio within a fifth of it. Eleven genres dig for vocals, each for its own kind (R&B vocals for garage, gospel and diva vocals for house, ragga for jungle), and it works in the web demo too, since a note has no tempo to fit.

Songs play only sounds their genre has a place for. A part that leaves its genre’s own sound plays another synth of the same family (the other electric piano, another analog bass, another soft lead), any synth pad for a pad, or an installed instrument of a kind its genre’s palette lists. Bells, winds and brass, whose sound pierces a mix, play only where the genre plays one of their kind itself. So a house or drum & bass lead no longer rings a bell or whistles, an installed glockenspiel or tubular bells play only where the genre plays bells (trap, UK drill, IDM), and a flute or a saxophone only where one of the genre’s parts names it. Where a song’s sampled phrase plays, its lead and arpeggio step aside, so the record carries the melody.

Searches for samples leave out the recordings of papers’ supplementary material, which Wikimedia Commons holds by the thousand under their journals’ names for them (…-pone.0062397.s008.oga): a vowel recorded for a study of voices holds a note, but it is no music. The studio demo’s searches leave them out too.

A recording decodes ten times as fast: converting its rate (44.1 kHz, most often) to claudius’ 48 kHz works out its filter’s weights once for each position between samples, where it worked them out for every sample, and what comes out agrees to a rounding of a 32-bit float. The demo cuts a 3.6-minute song into a phrase in about 4.5 s where it took 18.

An edit renders again only the tracks it changed: a level, a pan, a send or the master renders no track again, and another track’s notes only that track, so mixing waits for the mix alone (a level change in the web demo takes about 13 s where the whole song takes 31). What comes out is the same to the sample as a fresh render. The tracks it keeps leave out their silent stretches, about half of a song, so they take half the memory, which matters most in the web demo on a phone.

In the studio demo, an edit is heard where you are listening within a second: the twelve seconds from the playhead, rendered again with the edit through the same effects as the whole song (within a rounding of it, at the loudness of the render before), while the whole song renders again behind them. Where the browser has cores to spare, the demo renders a song’s tracks side by side in copies of its engine, as the app does on threads, and comes out the same: a four-minute song renders whole in about 19 s where it took 29. The heaviest track, a song’s chords or pads, is shared out too, each copy rendering the notes of a stretch of it.

A phone plays along: the studio’s new phone button shows a QR code that opens drum pads, keys and a turntable on a phone on the same Wi-Fi, with the song’s own sounds. The phone plays them itself, so a tap sounds at once, and follows the studio as it plays, so a take lands where it was heard. A take on the pads becomes the song’s drum lanes, on the keys a new part, and a scratch a take of its own (Playing from a phone). The studio demo plays along with a phone too, on any network, through a relay on the site. A MIDI controller plugged into what opens the page plays its pads, keys and turntable, the jog wheel and crossfader learned once, and MIDI drum pads in the Record window play the song’s drum lanes by the General MIDI drum map. Assistants and scripts reach the same through the new add_hits and add_scratch commands.

The studio demo runs claudius itself: the same composer, edits, script language, renderer and critic as the app, in a Web Worker of the page, in place of the stand-in that made every genre sound alike. Its songs are the app’s, every track and section of them, on claudius’ own synths and drums; a script runs as in the app, and a song file opens. A new song plays its first 16 bars a few seconds after it is made, and the whole of it once that has rendered. What needs a computer of one’s own, such as recording, packs and evolution, the demo says it leaves to the app.

Trap’s and UK drill’s 808 hits like a subwoofer: 6 dB louder than before, lower, driven through a saturator and kept dry and centred, so it is the loudest thing in the song. Every track has a drive in the mixer (drive, 0 to 36 dB, in mix() and set_mix too) that overloads it at the loudness its level gives it. The critic takes an 808 genre’s heavier sub as its sound rather than a fault, and Evolve no longer sends a bass or the kick into the reverb or pans them.

Boom bap is built on samples too: a dusty drum break, a soul or jazz phrase from a record, chopped and crushed to 12 bits, and vinyl crackle, gathered from free libraries as trip-hop’s are. The ears no longer hear it as stock ukulele music; they hear the hip hop family, lo-fi hip hop (boom bap’s offspring) first.

The web demo samples too: a trip-hop song in the studio demo is built on loops from Freesound under CC0 or CC BY, found as the song is made. Its tempo, key and chords come from the phrase, and a drum break (re-chopped in the fills) and vinyl crackle play with it, each credited in its track and in the log. The browser asks only the site, whose Worker asks Openverse and Freesound.

The studio and assistants gather samples on demand too: the first new trip-hop song gathers its break, phrase and crackle as a job, with progress and its log, then makes the song with them. claudius studio --offline and a shared claudius gather nothing.

Four genres play their signature sounds instead of whatever the palette drew, and the ears hear the first three as themselves more often:

  • dubstep’s wobble bass, a sine sub and a big snare-and-clap on the third beat, on an 808 kit, with hats no longer on the offbeat, which the ears heard as techno;
  • future bass’s supersaw chords, plucked and vocal leads, and no chip or mallet sounds, which the ears heard as chiptune;
  • synthwave’s saw and Moog basses, string-machine and PWM pads, saw and square leads, chorus and a wobbling tape;
  • amapiano’s log drum, a new synth preset (log_drum): a pitched, woody knock that glides from note to note. The ears still hear its close kin, afrobeats, first.

Art rock plays like a band rather than a dance track. It has an acoustic kit with fills, a pick or finger bass that distorts in the climaxes, piano, strings, a clean guitar arpeggio, and two distorted power-chord guitars panned wide in the rise and the climaxes, over dark minor and phrygian chords. EDM risers, impacts and downlifters, harps, mallets and music-box bells are gone. Chord parts can be voiced as power chords ("voicing": "power": the root, its fifth and the octave).

Trip-hop is built on samples now, as trip-hop records are: a slowed drum break whose own hits the drum lanes play, a dark phrase from a recording that the song takes its key, tempo and chords from, and vinyl crackle under it. claudius make gathers them first from free online libraries, cuts them on their beat grids and lets the ears choose the ones that sound right; claudius samples gather <genre> gathers on its own, and --offline plays what was gathered. Other genres can do the same with a sampling section in their profile (Genres built on samples).

claudius samples finds sounds in free online libraries (Freesound and Wikimedia Commons through Openverse, Commons itself, ccMixter) and downloads them: drum breaks, vinyl crackle, field recordings, stems, old records. It keeps only what the licence lets you publish music made with (CC0, public domain, CC BY), leaves out uploads that say they were cut from someone’s record, and every song that plays a downloaded sound credits it in its credits.txt (Samples from free online libraries).

Verdicts are stricter about style. Every genre is now measured against stock library music too (corporate background music, children’s piano music, ukulele music, chiptune), and a song that sounds as much like it as like its genre loses up to 40 % of its score, with an issue saying so. Songs that scored 90 while sounding like an advert’s background music now score in the 60s (The critic).

Added

  • samples: Samples from free online libraries, kept only under licences that allow publishing (#95)
  • genres: Trip-hop built on samples from free libraries (#96)
  • genres: Art rock plays like a band, with power chords (#99)
  • genres: Dubstep, future bass, synthwave and amapiano play their signature sounds (#100)
  • server: The studio and assistants gather a genre’s samples when a song of it is made (#98)
  • demo: The web demo samples free loops for trip-hop (#97)
  • genres: Boom bap built on samples (#101)
  • studio: The download button downloads the song (#102)
  • mix: A drive on every track, and an 808 that hits like a subwoofer (#103)
  • demo: The studio demo runs claudius itself, in a Web Worker (#106)
  • demo: Open with a deep house song (#107)
  • api: Add_hits and add_scratch turn pads and a turntable into drums and takes (#108)
  • studio: Play along from a phone: pads, keys and a turntable that send takes into the song (#109)
  • demo: Play along from a phone with the studio demo, through a relay on the site (#110)
  • studio: MIDI drum pads play the song’s lanes, and a MIDI controller plays the phone’s page (#111)
  • sampling: A song of any genre can be built on samples, from the records its producers dig for or words of your own (#113)
  • demo: The demo samples every genre as the app does, claudius itself cutting whole recordings in the page (#114)
  • studio: The New song dialog builds a song on samples from free libraries, from the genre’s own records or words of your own (#115)
  • demo: An edit is heard where you listen within a second, the same effects run on the bars at the playhead (#117)
  • sampling: A sampled song plays another passage of its record where it lifts (#118)
  • sampling: A song treats its phrase with a move its genre’s producers make: filtered until it lifts, darkened, a telephone’s band, overloaded, crushed (#121)
  • sampling: Songs chop vocals from other records, a sung note played on the song’s chords where it lifts (#122)
  • judge: The critic hears a track out of balance and a sound out of place (#128)
  • demo: Download the song as FLAC, or as WAV, AIFF, MP3 or Opus (#130)
  • genres: Hip hop, R&B, funk, tech house, ambient, grime, phonk and reggae (#129)
  • demo: Save the song as a project that claudius opens (#132)
  • sampling: Sample a bass note that the song’s bass plays on (#133)
  • demo: Mutate and evolve songs in the demo’s engine (#134)
  • sampling: Chop a sample onto the song’s grid at a multiple of its tempo (#135)
  • compose: A song as layered as you ask, from its genre’s core to instruments on instruments (#139)
  • genres: Alternative hip hop, layered as its producers layer it (#140)
  • remake: Remix a recording in a genre, built on its hook, its drums and a flip of it (#141)
  • phone: Play the song and record a take from the phone (#138)

Changed

  • render: An edit renders again only the tracks it changed, and comes out the same to the sample (#116)
  • audio: A recording decodes ten times as fast, its rate converted with each position’s weights worked out once (#120)
  • demo: The demo renders a song’s tracks side by side in copies of its engine, and comes out the same (#119)
  • render: A kept track leaves out its silent blocks, half a song, so it takes half the memory (#124)
  • demo: The demo shares out its heaviest track in parts too, its costs measured, and comes out the same (#125)

Fixed

  • site: The hero links every system’s download again (#93)
  • critic: Songs that sound like stock background music no longer score well (#94)
  • demo: A song built on samples renders in the browser instead of panicking for a process id (#112)
  • samples: Searches leave out papers’ supplementary recordings, which hold a note but are no music (#123)
  • compose: Songs play only the sounds their genre has a place for (#126)
  • mix: Balance each track on how loud its hits are (#127)
  • judge: A track at the level its genre makes it at is no fault (#131)
  • scratch: A scratch that sounds like a turntable’s (#137)
  • phone: Taps play without zooming, on pads and keys drawn on a canvas (#136)

0.3.0 - 2026-11-03

Claudius updates itself from this release on: the studio downloads a new release in the background and offers to restart into it, and claudius update does the same in a terminal (Updates). The releases before this one can’t, so install this one the way you installed the last.

Sample packs installed by 0.2 can hold damaged FLAC files: two notes of VCSL’s harmonica take hundreds of MB and play as noise. claudius-packs install --defaults converts such files again and downloads nothing else.

Eight more default packs, and 21 more instruments in VCSL and FreePats: Sonic Pi’s samples, a solo cello, an erhu, a steel pan, synth drums, body percussion, glitch kits and sound effects, among them a hang, wine glasses and a TX81Z. claudius setup downloads them, about 0.9 GB more (Sample packs).

The studio’s demo at claudius.devlato.com/studio plays claudius’ own sounds instead of a rough synth: every synth preset as claudius renders it, the TR-707 and TR-808 drum machines, in stereo, with reverb, delay and the kick’s ducking, each track as loud as claudius’ mix makes its role, and the master at the genre’s loudness.

The studio records, in the app and in the browser: a take from a microphone or an audio interface, which plays once from the section it starts with and goes with the song, and what a MIDI keyboard plays, as a part’s notes. A sung, hummed or played line becomes notes for an instrument or several, as it is or as harmony, octaves, chords, a bass line, an arpeggio or a pad. Measure plays clicks and listens for them, so that takes land in time (Takes).

A take waits when it stops: play it back in the song, record it again, or keep it. An assistant can ask you for one (request_take): the studio’s Record window opens for it, and once you send the take, the assistant, which has been waiting for it (wait_for_take), carries on with it (A take an assistant asks for).

Scripts reach every effect: a chain on any track, bus or the master, parallel chains side by side at their own amounts, buses of your own, and settings that move through the song or by section, such as a filter that opens across every build or a reverb that only the break drowns in. The printed song lists every chain (Effect chains).

Ten new genres: trip_hop, big_beat, electro_house, nu_disco, filter_house, dance_pop, neo_psychedelia, art_rock, idm and dub_techno. Their profiles use the new effect chains themselves: parallel compression and crushed copies on the drums, a dub delay that feeds back harder in the breaks, an acid filter that opens across the builds, a disco loop that sweeps through a lowpass with the arrangement, guitars that turn distorted in the climaxes, pads gated harder as a groove goes on. The cookbook has a recipe for each (Trip-hop, big beat, electro house, nu-disco, filter house; Dance-pop, neo-psychedelia, art rock, IDM, dub techno).

Five more: boom_bap, 90s hip hop with a sampler’s lazy swing and a piano loop; uk_drill, at half time with sliding 808s and skippy hats in threes; dubstep, a wobble over a clean sub under a big snare on the third beat; uk_garage, a shuffled two-step with organ and Rhodes chords; and jungle, a chopped, rolling breakbeat over a deep sub, its chords lost in long delays. The studio’s demo plays them too, and the cookbook has a recipe for each (Boom bap, UK drill, dubstep, UK garage, jungle).

And five more: afrobeats, a clave, congas and shakers under guitar plucks; amapiano, the log drum’s woody bass under a steady kick and jazzy piano; reggaeton, on the dembow; trance, a rolling bass and supersaws with a long breakdown that builds back into the drop; and neo_soul, a laid-back live kit under 9th and 11th chords on Rhodes. Each has a recipe in the cookbook too (Afrobeats, amapiano, reggaeton, trance, neo-soul).

Genres fuse: trip_hop+idm, art_rock+idm or house+dnb+lofi is one genre, in scripts, on the command line, for assistants and in the studio’s New song dialog (Fused with). The first genre leads the song, its harmony, parts and mix, and the last plays the drums and lends its sounds (Fusions).

The auto-sampler samples a recording’s vocals into a song: it finds the best sung phrases on the recording’s own beat grid, cleans them of its drums, fits them to the song’s tempo and key, and places each where its notes agree with the song’s chords, mixed as a vocal (claudius sample, sample_song, and the studio’s New song dialog; Sampling a song’s vocals).

The studio has a Graph tab: the song as its signal flows, each track through its effects into its bus, the buses and returns into the master, out, on a canvas to drag and zoom. Every node is editable beside it: a track’s mix, bus, sections and sound, an effect’s settings or its place, a chain’s new effects, the master’s loudness. Assistants read the same graph with the graph tool and change chains with set_fx.

Every drum step can do what a drum machine’s trig does: play by chance, play only on some times round (every other bar, the fourth, or the last bar before the next section), roll in a ratchet that swells or fades, flam, land early or late of the grid, and change its pitch, decay, tone and pan for that stroke. Right-click a step in the step sequencer and open Trig, or write trig() in a script; the step shows what it does (The drum machine).

Each drum lane can keep its own time: a length of its own, so hats twelve steps long turn against a kick of sixteen, a speed (triplets over a straight beat), a swing of its own, and a groove: a swing, a shuffle, a dragged dilla feel, or the groove of a record. Take its groove under New song (or extract_groove, or groove() in a script) measures where each sixteenth of a recording’s drums lands and how hard, and puts the lanes in that feel. Right-click a lane in the step sequencer for its time and feel, or write lane() in a script.

Beatbox a beat and it becomes the song’s drums: right-click a take in the arrangement and choose Turn it into drums. claudius names each hit a kick, a snare or a hat, folds the times round into a pattern of 1, 2 or 4 bars, writes it into the drum lanes (a step hit only some of the times round plays with that chance) and mutes the take. A drum loop goes in the same way, with transcribe_drums or drums_from(). The arrangement’s right-click menu on a row opens again: it had come up empty.

New songs sound far less alike. Every part draws its sound from 46 synth presets (26 new: FM, rubber, moog and distorted basses; saw, PWM, brass, FM and vowel leads and a whistle; a string machine, glass, PWM, breathy and vowel pads; a tine piano, a clav, a house piano, brass stabs, an overdriven organ, FM mallets and a harp pluck), each varied so that no two songs play quite the same patch, and from every instrument of the installed sample packs that suits its genre and role: strings, brass, woodwinds, mallets, pianos, electric pianos, guitars, organs, choirs and more. No two parts of a song play the same sound, and a drum lane sometimes plays a kit of its own, so a song’s drums come from more than one machine. Packs without a licence or with share-alike terms are never drawn; choose them by hand. The studio’s Parts tab offers every installed instrument that can play a part. Chords, keys and pads on an instrument recorded in mono get a light chorus, as a single-voice synth does, so they do not sit dead centre.

Nor do new songs share a shape or a mix. A genre’s forms are templates: each song lengthens or shortens their sections, and may add a bridge, a third verse and chorus, a lift into the first chorus or a last chorus played twice, start or end cold, or thin its intro, its first verse or its outro. Its mix is its own too: the reverb’s length, darkness and pre-delay, the delay’s time and bounce, every part’s sends, a colour on some parts (a phaser that deepens in the drops, tape on the keys, a tube on the bass), a high-pass on the music in the breaks, and the master’s saturation (A form and a mix of its own).

Their harmony bends the rules a little, as people’s does. The progression library has 29 more progressions (86 in all), among them borrowed chords (I iii IV iv, I bVI bVII I), secondary dominants, a tritone substitute and the Neapolitan. A song may answer its loop, playing it again with another way back to its first chord (its dominant, a borrowed chord, a suspension) and sometimes a chord coloured on the way, and its choruses may play a progression of their own. Sevenths, ninths and suspensions keep to the key’s notes: a dominant no longer gains a major seventh, and the fifth of a minor key no longer a ninth the key does not have. The critic no longer counts a lead note the chord under it has (a borrowed chord’s third, a dominant’s leading note) as outside the key (The generator’s harmony).

claudius hears how a voice is sung: the notes it means, how near each came, and how its singer sings (where they go sharp or flat by register, how widely their notes scatter, how fast they settle, their vibrato). Right-click a take and choose How is it sung?, run claudius voice on a file, or let an assistant call assess_voice (Your voice). Turning a take into notes reads the same way, so a singer’s flat high notes become the notes they meant.

A tuner moves a voice onto the notes it means, as far as its singer needs: their usual error goes, and of their scatter only a few cents stay, as expression. It reads each note against the song’s chords, brings it on as fast as asked (slowly enough to keep the scoop, or at once for the hard-tuned sound) and keeps the voice’s character. Right-click a take and choose Tune it, add the tune effect in a script or the graph, run claudius tune, or let an assistant call tune.

A pitch check plays six short phrases to sing back, in any octave, and learns from them how you sing, how much nearer you land a step than a leap included; your takes are tuned as it heard you from then on. Press Check my pitch in the Record window, or let an assistant ask with request_pitch_check and wait with wait_for_pitch_check (Checking your pitch).

The studio adds and removes tracks. + Track in the arrangement adds a part of any role (a second lead, keys on a techno song) or a drum lane, with its name and its sound from a browser of the synths made for the role, the installed instruments, and the drum voices and kits; right-click a row to remove a track. Scripts make a part of any role with part("lead2", #{ role: "lead" }), and assistants use add_track and remove_track (The studio).

The studio has a piano roll: a part’s notes over a progression, as the theory engine writes them, to change note by note (add, move, lengthen, take out); the first change writes the notes out, and Back to the theory engine gives them back. Scripts write a part’s notes with notes("lead", "A", [[0, 0.5, 69], ...]) and give them back with clear_notes(), assistants with set_notes, and a song printed as a script now keeps the notes a part has written out, from a take or a keyboard too (notes()).

claudius publish checks a song the way stores and distributors check a release (its artwork’s size, colours and sharpness, its audio, the licences of its sounds, and its details, including how it was made) and writes a release kit: the WAV and the cover a distributor takes, and the answers its form asks for (Publishing).

Added

  • studio: Connect an assistant from the app (#25)
  • studio: A short tour the first time the studio opens (#26)
  • Opt-in anonymous usage statistics (#27)
  • macos: A disk image for each chip, and the app is called Claudius (#29)
  • songs: Every release opens the songs earlier ones saved (#30)
  • updates: Claudius downloads new releases and installs them on restart (#31)
  • brand: A new logo, a C cut out of colourful ripples (#32)
  • connect: Set claudius up with each assistant’s own command (#33)
  • assistants: A Claude Code plugin with the skills, and a Claude Desktop extension (#37)
  • install: Download Claudius and drag it into Applications, no terminal needed (#35)
  • packs: Eight more default packs and 21 more instruments: Sonic Pi’s samples, a solo cello, an erhu, a steel pan, synth drums, body percussion, glitch kits and sound effects (#45)
  • export: Songs export to WAV, AIFF, FLAC, Apple Lossless, MP3, AAC, Opus and Ogg Vorbis, and song.mp3 no longer needs ffmpeg (#46)
  • studio: An export menu, and export over MCP and the HTTP API (#47)
  • publish: Check a song for release, and write a release kit for a distributor (#48)
  • studio: A Publish dialog, and publishing over MCP and the HTTP API (#49)
  • studio: The demo plays claudius’ own synth presets and TR-707 and TR-808 drums, mixed as claudius mixes (#56)
  • takes: Recordings a song plays once from a section, sent to /api/takes or added with add_take (#58)
  • studio: Record a take from a microphone or an audio interface (#59)
  • takes: Turn a take’s melody into notes that an instrument, or several, plays (#60)
  • studio: Record what a MIDI keyboard plays, and write notes into a song with add_notes (#61)
  • takes: A sung or played line becomes harmony, octaves, chords, a bass line, an arp or a pad (#62)
  • studio: Measure how late takes land, and set the latency from it (#63)
  • studio: Record takes in the browser studio (#64)
  • studio: Record what a MIDI keyboard plays in the browser studio (#65)
  • studio: Choose files on this computer instead of typing paths (#67)
  • studio: Record the takes an assistant asks for, and play a take back before keeping it (#68)
  • script: Set any effect chain, run chains in parallel, and move settings by section (#69)
  • genres: Trip-hop, big beat, electro house, nu-disco and filter house (#70)
  • genres: Dance-pop, neo-psychedelia, art rock, IDM and dub techno (#71)
  • genres: Fuse two or three genres into one (#72)
  • sampler: Sample a recording’s vocals into a song (#74)
  • studio: A graph of the song’s signal, editable node by node (#75)
  • voice: Hear the notes a singer means, and how they sing (#76)
  • fx: Tune, which moves a voice onto the notes it means (#77)
  • voice: A pitch check that plays phrases to sing back and learns the voice from them (#78)
  • drums: Trigs, so a step plays by chance and condition, ratchets, flams, nudges and locks its sound (#79)
  • drums: Lanes with their own length, speed, swing and groove, and grooves heard in recordings (#80)
  • drums: Turn a beat, played or beatboxed, into the drum lanes (#81)
  • compose: Songs draw their sounds from every pack and 46 synth presets (#82)
  • compose: Every song plays a form and a mix of its own (#83)
  • theory: Harmony that bends the rules: answered loops, choruses of their own, 29 more progressions (#85)
  • studio: Add and remove tracks, with a sound browser (#86)
  • studio: A piano roll, and notes() to write a part’s notes (#87)
  • genres: Boom bap, UK drill, dubstep, UK garage and jungle (#88)
  • genres: Afrobeats, amapiano, reggaeton, trance and neo-soul (#90)

Changed

  • server: Compress the web studio, a third of its size, and cache its hashed files (#39)
  • render: Saturation and the master stage stream their oversampling, the same samples faster (#40)

Fixed

  • install: Install claudius.app on a Mac, which opens without Gatekeeper’s warning (#28)
  • server: A session’s renders go when it ends, and the tests keep theirs in target/ (#41)
  • docs: Readable type, at the sizes the theme meant, and the new logo in the menu bar (#43)
  • packs: Every FLAC conversion is read back, and installing again repairs the damaged ones (#44)
  • deps: Update rustls-webpki, webpki-roots and webpki-root-certs for RUSTSEC-2026-0381, 0382 and 0383 (#52)
  • deps: Update zip to 9.0.5 for GHSA-m665-v7pm-7grj (#55)
  • studio: Say claudius, never the server (#66)
  • compose: Chords, keys and pads on mono recordings get the light chorus (#84)
  • model: Songs open from blueprint.json with every time exactly as saved (#89)

0.2.0 - 2026-10-19

Added

  • studio: Download the sample packs from the studio (#17)
  • macos: claudius.app in a disk image, one app for Apple silicon and Intel Macs (#13)
  • windows: An installer, with the studio in the Start menu (#14)
  • linux: .deb, .rpm and AppImage packages, with the studio in the app menu (#15)

Changed

  • critic: Read realness over eight windows, and encode the MP3 while the critic listens (#18)

Fixed

  • packs: Setup installs a pack whose WAV files have a long fmt chunk, and gets the ears when a pack fails (#19)
  • mcp: Wait for the ears to load before exiting, instead of crashing (#20)
  • remake: Play a remake at a tempo its genre plays (#21)
  • What a newcomer misread: download sizes, save messages, ears loading, MCP schemas (#22)
  • critic: Advice a person can act on, instead of z-scores and near ties (#23)

0.1.0 - 2026-10-18

The first public release.

Added

  • A beatmaker that composes, arranges, mixes and masters songs in eight genres (house, deep house, techno, trap, lofi, drum and bass, synthwave, future bass), using real audio only: synthesized drums and synths, 162 sampled instruments from 14 freely licensed sample packs, Apple Loops when GarageBand is installed, and your own files.
  • A critic that judges every render: loudness and tonal balance, the energy arc of the arrangement, music theory checks, and earshot’s CLAP model for genre fit and production quality. Every issue names what to change.
  • Mutation and evolution: songs change the way a producer would change them, and the critic keeps the better ones.
  • A script language: Rhai with Strudel-style mini-notation patterns. Every song prints as a script that runs back into the same song.
  • The studio, a native and web app (egui) with arrangement, step sequencer, mixer, harmony, script and verdict panels.
  • MCP tools, over stdio and HTTP, so Claude, ChatGPT, Cursor, Codex and other assistants can make and edit songs while you listen, and skills that teach them the craft: making and editing songs, remixing recordings, and setting claudius up. claudius connect installs both.
  • Analysis and remakes of any song: tempo, key, chords, sections and groove, rebuilt in any genre.
  • claudius setup, doctor and connect for installing the sounds and models, checking an installation, and configuring assistants.
  • Builds for macOS on Apple silicon and Intel (Intel Macs have no ears: their verdicts come from the meters and the theory checks), Linux on x86_64 and ARM64 with a headless build for machines without sound or a display, and Windows as a preview. One-line installers for each, which come with every release and are in its checksums.