audio-composer
Skill4 starsChanged 7 months agoMITView on GitHub
Generates genre-appropriate sound effects and looping background music for a generated game. When ELEVENLABS_API_KEY is set, calls the ElevenLabs text-to-sound-effects API for real MP3 audio; otherwise falls back to Web Audio oscillator synthesis. Produces sfx.json, music.json, and AudioManager.js. Run in parallel with art generation stages.
- Reads credentials
In this repository22 other files it gives its agents.
- action-platformerSkill
- beat-em-upSkill
- bg-artistSkill
- codesmithSkill
- game-designerSkill
- gameforgeSkill
- gap-checkerSkill
- iso-city-builderSkill
- iso-living-worldSkill
- manifest-auditorSkill
- mobile-compat-checkerSkill
- multiplayerSkill
- palette-enforcerSkill
- parallel-qa-orchestraSkill
- physics-debug-validatorSkill
- pixel-action-adventureSkill
- playtesterSkill
- refinerSkill
- rpg-overworldSkill
- sprite-artistSkill
- tile-artistSkill
- world-architectSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Run in parallel with the art generation stages (sprite-artist, tile-artist, bg-artist), after GDD is finalized.
- Very specific: line 106
If ELEVENLABS_API_KEY is set: generate MP3s, fallback per-sound on error.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Audio Composer — SFX + Music
Two-tier audio system: real AI-generated MP3s when ELEVENLABS_API_KEY is available, deterministic chiptune oscillator synthesis as a zero-cost fallback. The same AudioManager.js handles both transparently — no code change needed in Game.js.
When to use
Run in parallel with the art generation stages (sprite-artist, tile-artist, bg-artist), after GDD is finalized. Also run on an existing game when the user says "add sound", "add music", or "upgrade to ElevenLabs audio."
Two modes
Mode A — ElevenLabs (when ELEVENLABS_API_KEY is set)
Calls POST https://api.elevenlabs.io/v1/sound-generation for each SFX action. Uses the eleven_text_to_sound_v2 model with a genre-flavoured text prompt (e.g. "2D action platformer game, retro 8-bit jump sound, quick upward pitch sweep"). Saves MP3s to public/assets/sfx/<name>.mp3. Adds mp3Path to each entry in sfx.json. AudioManager.js preloads all MP3s as AudioBuffers via decodeAudioData and plays them on demand.
Rate limit: requests are made sequentially with automatic retry on HTTP 429.
Mode B — Web Audio oscillator (no API key, or --no-elevenlabs)
Writes oscillator parameters (freq, dur, type, vol) to sfx.json. AudioManager.js generates sound at runtime using OscillatorNode — no audio files, no network calls, works offline.
Output contract
public/assets/sfx.json — SFX descriptors (always written)
public/assets/music.json — music loop: BPM + pentatonic note sequence
public/assets/sfx/<name>.mp3 — real audio files (Mode A only)
src/audio/AudioManager.js — fixed runtime template (never regenerated)game-state.json gains state.audio:
{
"audio": {
"sfxPath": "assets/sfx.json",
"musicPath": "assets/music.json",
"managerPath": "src/audio/AudioManager.js",
"elevenlabs": true, // true when Mode A ran
"mp3Count": 6 // number of MP3s successfully generated
}
}sfx.json shape
Mode A (with MP3):
{
"jump": { "freq": 380, "dur": 0.14, "type": "square", "vol": 0.22, "mp3Path": "assets/sfx/jump.mp3" }
}Mode B (oscillator only):
{
"jump": { "freq": 380, "dur": 0.14, "type": "square", "vol": 0.22 }
}AudioManager.play('jump') checks for mp3Path first; if missing or load fails, falls back to the oscillator params. Per-sound graceful degradation — a failed ElevenLabs response for one SFX doesn't break the rest.
Genre presets
| Genre | BPM | SFX keys |
| action-platformer / platformer | 130 | jump, land, hit, pickup, death, win |
| top-down-adventure / dungeon-crawler | 100 | hit, pickup, death, win |
| top-down-rpg | 88 | pickup, hit, win |
| shoot-em-up | 160 | shoot, explosion, hit, death, win |
| beat-em-up | 140 | hit, death, win |
AudioManager usage (codesmith adds these)
import AudioManager from '../audio/AudioManager.js';
// In create():
AudioManager.init(this); // registers Safari AudioContext unlock
// In event handlers / overlaps:
AudioManager.play('jump'); // plays MP3 if available, oscillator if not
AudioManager.play('pickup');
AudioManager.play('hit');
AudioManager.play('death');
AudioManager.play('win');
AudioManager.stopMusic(); // call on game-over
// Optional:
AudioManager.mute();
AudioManager.unmute();Safari iOS compatibility
AudioManager.init(scene) registers one-shot pointerdown and keydown listeners that create and unlock the AudioContext on first interaction. MP3 buffers are decoded at that point. This satisfies Safari iOS's user-gesture requirement without any extra plumbing in Game.js.
Process
- Read
game-state.json→gdd.genre. - Run
scripts/compose_audio.mjs <project-dir>.- If
ELEVENLABS_API_KEYis set: generate MP3s, fallback per-sound on error. - Otherwise: oscillator-only mode.
- If
- Patch
game-state.jsonwithstate.audio. - Codesmith reads
state.audioand addsimport AudioManager+AudioManager.init(this)toGame.js.
Scripts
scripts/compose_audio.mjs <project-dir> [--bpm N] [--no-elevenlabs]--no-elevenlabs— force oscillator mode even if the key is set--bpm N— override music tempo
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

