Compose music in code.

Carmen is an open-source programming language for music composition. Write and transform musical phrases, combine them into scores, and export notation or MIDI.

Studio’s form ruler marks the two revised flute bars above the piano roll
Countercurrent in Carmen Studio

Carmen examples

Read the code behind each score and listen to the result.

let theme = [
    1/8 [d4, f4, g4, a4], 1/2 c5,
    1/4 bb4, 1/8 [a4, g4], 1/2 f4,
];
let answer = theme |> transpose(7);
A two-bar motif, its transposed answer, and the same bass line under both
In Phrase and Answer, the melody repeats a fifth higher over the same bass line.

Rhythm Study

Change the rhythm while the lower pulse stays steady.

Pitch Study

Hear two pitch sets against the same pulse.

Interference

Compare two takes of overlapping subdivisions.

Install Carmen

Use Cargo to install the Carmen 0.4.1 command-line tool. If you need Cargo, install Rust first.

Run your first Carmen program
cargo install carmen-lang --version 0.4.1 --locked

Run carmen --version to confirm the install. Then download the example score and run carmen phrase-fifth.carmen from the folder where you saved it.

macOS development preview

Carmen Studio

A Mac app for working with Carmen scores. Edit source beside the notation or piano roll, compare takes, and export individual parts.

About Carmen Studio
The first beat of Interference selected in Carmen Studio, with Glass and Reeds in the parts list
Interference in Carmen Studio

Check Carmen code from an AI client

A compatible AI client can use Carmen’s MCP server to look up functions, validate a draft, and identify which bars changed.

Set up Carmen MCP

Example request

Change the flute rhythm in bars 5–6 of Countercurrent. Keep the pitches and the cello part as written.
compare_scores Written comparison
Flute
Rhythm changed in bars 5–6
Cello
No written changes