Audio as Code presents
Describe the music your video, game or slides need. Your agent writes the score. Audio as Code brings the band.
- Tempo
- BPM
- Voices
- Notes
- Seed
An open-source music framework for creative agents. Compose with 49 instruments synthesized from code, take the WAV into your project, and keep every note editable. No recorded samples.
Writing it yourself? Developer quickstart · Get the source. Version 0.1.0 · Python 3.10+.
Give it to your agent
Give your project a soundtrack. A tiny dragon's boss fight. A quarterly report with a villain arc. A launch video with a pulse. Describe the scene; your agent composes the music and delivers a WAV you can use. You can change the score whenever the scene changes.
-
Your agent needs a shell and Python 3.10+. You supply the brief; it handles the setup.
-
Copy the prompt
Prompt for your coding agent Use Audio as Code to create the music in the brief below. 1. Read the skill at skills/audio-as-code/SKILL.md and the guide index at llms.txt on the Audio as Code website. 2. If you don't already have an Audio as Code checkout, download download/audio-as-code-0.1.0-source.zip from the same website and extract it into a new project folder. Then follow its bundled skills/audio-as-code/SKILL.md. 3. Install its Python dependencies, compose an original score (Audio as Code makes instrumental music and cues, not speech or sound effects), then validate and render it locally. 4. Deliver the WAV, the MIDI file, the editable score JSON, the Python source you wrote and the render report. If I'm working in a video, game or presentation project, put the WAV where that project expects audio and keep the score and source beside it for revisions. Then tell me what you would try next. Music brief: A tiny dragon thinks this is the final boss fight. A 16-second battle cue for my game: timpani and drums, low brass stabs and a frantic string ostinato at about 150 BPM, then a separate 2-second victory sting. Deliver each cue as its own WAV for the game's audio folder, and keep the editable scores.This local preview has no public link. Download the source ZIP below and give your agent the extracted folder; the skill is inside.
-
Paste it in, then listen
Your agent writes and renders the music, then places the WAV in your creative project. Keep the whole composition for the next revision:
- WAV ready for your project
- MIDI notes for your DAW
- score.json the editable score
- source the composition code
- report duration and level checks
Then ask for changes the way you'd talk to a musician:
Keep the melody. Give it to the marimba, calm the drums down, and land the final note on the reveal.
Working in Hyperframes, Codex or Claude Code? The integrations guide has recipes for a video timeline, a game's audio folder and a slide deck.
First, the classic. Then, a plot twist. Compare familiar music with an agent's new arrangement: different instruments, rhythms and moods. Both versions are synthesized from code, with editable scores.
Inside the score
The runnable bundle and the full source ZIP include this script and its supporting files: .
From the source
Score credits
The classic versions follow the credited public-domain scores. The reimagined versions are new arrangements by an AI agent. Audio as Code synthesizes every sound; both versions include editable scores and source.
Full notes: score credits and scope · what each reimagining changed
- Für Elise Ludwig van Beethoven. Edition by Stelios Samelis, Mutopia Project #931, marked Public Domain on its source page.
- Cello Suite No. 1 · Prelude Johann Sebastian Bach. Edition by Andreas Scherer, Mutopia Project #517, marked Public Domain on its source page.
- Turkish March Wolfgang Amadeus Mozart. Edition by Rune Zedeler and Chris Sawer, Mutopia Project #108, marked Public Domain on its source page.
- Greensleeves Traditional. Edition by Aaron Fontaine, Mutopia Project #109, marked Public Domain on its source page.
- Ode to Joy Ludwig van Beethoven. Edition by Peter Chubb, Mutopia Project #528, marked Public Domain on its source page.
Play streams a compressed preview. Download WAV for the full render, or MIDI to continue in a DAW with its own instrument sounds.
The loop your agent runs
A few lines become a score you can hear and change. Run this example yourself, or let your agent do the typing.
-
It writes a score
loop.py from audio_as_code import Pattern, Song, Track, export_midi, render melody = Pattern.sequence(["C4", "E4", "G4", None], step=0.5).repeat(4) kick = Pattern.sequence([36, None], step=1, gate=0.3).repeat(4) song = Song( title="My first loop", bpm=110, beats=8, seed=42, tracks=[ Track(name="Melody", instrument="pluck", notes=melody.notes, gain=0.5), Track(name="Kick", instrument="kick", notes=kick.notes, gain=0.7), ], ) song.save("output/loop.json") report = render(song, "output/loop.wav") export_midi(song, "output/loop.mid") print(report["wav"]) -
It renders, you listen
Run it from a terminal:
shell uv run aac validate output/loop.json uv run aac render output/loop.json -o output/loop.wav --report output/report.json uv run aac analyze output/loop.wav -
It measures, then revises
- Duration
- 4.36 s
- Peak
- -8.1 dBFS
- RMS
- -23.1 dBFS
- Silent
- no
- Tracks
- 2
- Notes
- 16
Level checks catch silence and clipping. Your ears decide whether the music works.
Keep the good bit. Change the rest.
The melody, timing and instrumentation stay in an editable score. Your agent can make a precise change and render another take.
- Make the music fit. Plan entrances, pauses and endings around the scene.
- Revise the arrangement. Change a voice, thin the accompaniment or shift the tempo.
- Keep the recipe. Save the score and source alongside the audio for the next edit.
Take one
49 instruments, all synthesized
- Plucked strings7
- Bowed strings4
- Keyboards5
- Woodwinds6
- Brass4
- Drums and percussion8
- Pitched percussion7
- Electronic8
Pluck a string, strike a bell, call in the brass. Every voice is generated from equations. These are playful, simplified instrument models; audition them to find the character your piece needs.
Shape the timing, move parts across the stereo field, and give the ending room to ring. Explore tempo, movement and space.
147 preview clips: a famous-music arrangement, a phrase, and a single note or hit for every voice.
A small, opinionated orchestra
- Version 0.1 runs locally in Python. Download the source to get started.
- All 49 voices are synthesized prototypes, each with its own character and limits.
- Make instrumental music and musical cues for videos, games and slides. Speech and everyday sound effects need other tools.
- Render offline, listen, then revise. The technical reference covers timing, expression and export limits.