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
- WAV ready for your game, video timeline or slides.
- MIDI for your DAW.
- score.json, the editable score your agent can keep revising.
- Python source beside the audio so the next change is a revision, not a rewrite.
- Render report with duration and level checks.
How it works in three steps
- Describe the scene in plain words (mood, BPM, instruments, duration).
- The agent reads the skill (
skills/audio-as-code/SKILL.md+ llms.txt), writes the score, then validates and renders it locally. - You listen and ask for changes the way you would brief a musician.
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:
aac validate path/to/score.json
aac render path/to/score.json -o output/cue.wav --report output/report.json
aac analyze output/cue.wavA seed keeps renders reproducible for the same score and environment. Start with the quickstart and the technical reference.
Soundtracks for games, videos and slides
- Games: separate cues per state (fight, victory, menu), each as its own WAV.
- Video: music as a timeline asset (see the Hyperframes recipe in integrations).
- Slides / reports: short opening and closing beds.
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
- Instrumental music and cues only, without speech or everyday sound effects.
- WAV renders up to 300 seconds (tails included). Rendering is offline and uses real CPU time; orchestral voices are slower than electronic ones.
- Instruments are code-generated approximations, not recordings.
- MIDI keeps notes and tempo; audio controls (gain/pan automation, effects, articulations) do not carry over.
- Requires Python 3.10+ and an agent with shell access.
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.