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

# Introduction

> composer-nb is a typed, declarative language for composing music.

A cell describes what plays: settings, named parts and `play` statements. The interpreter evaluates the cell and renders each `play` to audio, with a grid of every hit and note, or the same as sheet music.

```composer-nb theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/composer-nb.json"]}}
set time 7 over 8
set tempo 110
set octave 2
set guitar.electric muted

pattern groove = {
  kick: x--x---
  snare.rim: ----x--
  ride.bell: x--
  guitar.electric: notes D---E D-D--
}

play (
  { snare.rim: ^- }
  {
    bar 1 crash: 1
    groove
  }
) for 3 bars
```

This is *What Happens Now?* by Porcupine Tree. The `play` holds two blocks in brackets, so they play [in order](https://pkhambat.mintlify.site/language/overview.md#blocks): an accented rim as a pickup, and after it the groove with a crash in its first bar. Each line of `groove` repeats at its own length: 7 steps for the kick and rim, 3 for the ride bell, 10 for the guitar. They only meet again after 15 bars, and `play  for 3 bars` stops it after three.

## Why instructions

* **You state the rules, the interpreter writes the bars.** Two lines of different lengths make a polyrhythm that would take pages to write out, and you hear where they meet without working it out.
* **Every edit is a new take.** Change a step, a length or the time signature, evaluate, and listen.
* **Parts are values.** A groove is named once and reused under every section, a song is its sections in brackets, in order, and a cell is source you can diff, version and generate from Python.

## Run it

* **Playground.** Open [composer-nb.vercel.app](https://composer-nb.vercel.app), select a cell and press Shift+Enter. Nothing to install.
* **Jupyter.** `pip install composer-nb`. See [Jupyter](https://pkhambat.mintlify.site/jupyter.md).
* **An assistant.** Connect Claude or Cursor to the MCP server and ask for a groove in words. See [Assistants](https://pkhambat.mintlify.site/assistants.md).

Every example on this site is a live cell: edit it and press Run.

## The reference

[Language](https://pkhambat.mintlify.site/language/overview.md) covers what every cell has: settings, names and types, blocks, patterns and `play`. The drums and the pitched instruments are two separate parts, and a cell can use either or both. [Drums](https://pkhambat.mintlify.site/drums/kit.md) covers the kit pieces and their `steps` type. [Pitched instruments](https://pkhambat.mintlify.site/pitched/instruments.md) covers the instruments, the key, and their `notes` and `chords` types.


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