Audio as Code

Audio as Code / AI agent soundtrack

Give your AI agent a soundtrack it can write in Python

Describe the scene. Your coding agent writes an editable score with Audio as Code, renders WAV and MIDI locally, and keeps every note revisable. No API key to synthesize.

Copy the agent prompt Developer quickstart Get the source

What your agent delivers

How it works in three steps

  1. Describe the scene in plain words (mood, BPM, instruments, duration).
  2. The agent reads the skill (skills/audio-as-code/SKILL.md + llms.txt), writes the score, then validates and renders it locally.
  3. You listen and ask for changes the way you would brief a musician.

Copy the agent prompt

Example: a 16-second boss-fight cue for a game

Brief your agent roughly like this:

“A tiny dragon thinks this is the final boss fight. Give me a 16-second battle cue around 150 BPM, with timpani, low brass, string ostinato, and a separate 2-second victory sting.”

What you get back: two WAV assets for the game’s audio folder, plus editable scores and Python sources so you can thin the drums or move the sting without starting over. Recipes for Hyperframes, Codex and Claude Code live in the integrations guide.

The Python behind it

Scores are ordinary Python: patterns, tracks, a song, then render and export. Typical CLI loop:

shell
aac validate path/to/score.json
aac render path/to/score.json -o output/cue.wav --report output/report.json
aac analyze output/cue.wav

A seed keeps renders reproducible for the same score and environment. Start with the quickstart and the technical reference.

Soundtracks for games, videos and slides

Codex and Claude Code use the same skill; only the host changes.

Revise like you would brief a musician

“Keep the melody, give it to the marimba, calm the drums, land the last note on the reveal.” Named sections, motifs, instrument swaps, gain/pan automation and stems (without master effects) are all fair game. See composition and the agent guide.

70 instruments, all synthesized from code

Orchestra plus electronics (acid bass, supersaw, Reese, 808/909-style kicks, and more), all without recorded samples. Browse the instrument library, or hear Ode to Joy as disco, techno, trance and drum & bass in the electronic lab.

Limits worth knowing

FAQ

Do I need an API key to render?

No. Synthesis and rendering run locally on your machine.

Which agents work?

Any agent with a shell and Python 3.10+. Documented recipes cover Codex, Claude Code and Hyperframes in the integrations guide.

Can I edit the music later?

Yes. Keep score.json and the Python source beside the WAV/MIDI; ask your agent for a revision instead of a rewrite.

Is Audio as Code open source?

Yes. MIT licensed. Download the source archive or clone the GitHub repository.

Start now