$npx -y skills add majidmanzarpour/threejs-game-skills --skill threejs-audio-generatorGenerate, convert, clean, and prepare audio assets for Three.js browser games using ElevenLabs. Use for sound effects, looping ambience, UI sounds, impact/weapon/vehicle audio, creature or boss stingers, announcer/dialogue TTS, scratch-performance voice conversion, voice cleanup/
| 1 | # Three.js Audio Generator |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Create game-ready audio assets for Three.js projects. This skill consolidates game sound generation, voice generation/conversion, audio cleanup, credential probing, and runtime integration into one Three.js-focused production workflow. |
| 6 | |
| 7 | Provider: ElevenLabs. |
| 8 | |
| 9 | Resolve `<this-skill-dir>` in the commands below in this order: `~/.claude/skills/threejs-audio-generator`, `~/.codex/skills/threejs-audio-generator`, `~/.agents/skills/threejs-audio-generator`, or repo `skills/threejs-audio-generator`. |
| 10 | |
| 11 | ## When To Use |
| 12 | |
| 13 | Use this skill for: |
| 14 | |
| 15 | - SFX: jumps, hits, weapons, explosions, coins, pickups, collisions, UI clicks, confirms, errors. |
| 16 | - Ambience: wind, rain, city bed, engine hum, portal loop, dungeon room tone, battle arena beds. |
| 17 | - Voice: announcer barks, boss lines, tutorial prompts, menu narration, generated placeholder dialogue. |
| 18 | - Voice conversion: convert a scratch performance into a target character voice while preserving timing and emotion. |
| 19 | - Cleanup: isolate or denoise dialogue before voice conversion, TTS replacement, or transcription. |
| 20 | - Three.js integration: Web Audio loading, looping, sprite/manifest mapping, volume groups, pause/resume, user gesture unlock. |
| 21 | |
| 22 | For premium/AAA/showcase game work, audio is not cosmetic. Generate or integrate at least a minimal interaction audio set for the main loop unless the user explicitly requests mute/offline-only output or credentials/API attempts are blocked. |
| 23 | |
| 24 | ## API Key |
| 25 | |
| 26 | Never store API keys in skill files or browser/game code, and never paste a key value into a report. The script reads `--api-key` or `ELEVENLABS_API_KEY`. |
| 27 | |
| 28 | Step 0, before declaring the key unavailable: run this skill's own probe and paste its literal output into the report. |
| 29 | |
| 30 | ```bash |
| 31 | python3 <this-skill-dir>/scripts/threejs_audio_asset.py probe # prints ELEVENLABS_API_KEY=SET|MISSING |
| 32 | ``` |
| 33 | |
| 34 | `ELEVENLABS_API_KEY=MISSING` is only a valid skip/blocker reason when this output is shown. Keys defined only in a shell profile can be absent from the process env; if the plain probe prints MISSING unexpectedly, wrap it: `zsh -lc 'source ~/.zprofile 2>/dev/null || true; source ~/.zshrc 2>/dev/null || true; python3 <this-skill-dir>/scripts/threejs_audio_asset.py probe'`. When the director skill is loaded, prefer `threejs-game-director/scripts/probe_asset_credentials.sh`, which probes all three asset keys at once. |
| 35 | |
| 36 | Audio-specific: add `--validate` to the probe to call ElevenLabs `GET /user` and confirm the key actually works (prints `VALID_USER=...`); use it when a key is present but a generation still fails. A valid key can still be blocked by an out-of-credit or plan-tier limit — those surface as an `HTTP 4xx` from a real generation attempt. Report that as a purchase/plan blocker, do not silently skip. |
| 37 | |
| 38 | ## Required Reference |
| 39 | |
| 40 | Load `references/audio-workflows.md` before building a game audio plan, generating multiple assets, wiring runtime audio, cleaning/converting voices, or claiming premium game audio. |
| 41 | |
| 42 | Track it in the reference ledger. Do not mark the audio phase complete while this reference is skipped. |
| 43 | |
| 44 | ## Tool Script |
| 45 | |
| 46 | Run from the user's current game project directory: |
| 47 | |
| 48 | ```bash |
| 49 | python3 <this-skill-dir>/scripts/threejs_audio_asset.py --help |
| 50 | ``` |
| 51 | |
| 52 | Probe: |
| 53 | |
| 54 | ```bash |
| 55 | python3 <this-skill-dir>/scripts/threejs_audio_asset.py probe |
| 56 | ``` |
| 57 | |
| 58 | Generate SFX: |
| 59 | |
| 60 | ```bash |
| 61 | python3 <this-skill-dir>/scripts/threejs_audio_asset.py sfx \ |
| 62 | --prompt "tight futuristic boost pickup, bright transient, short sparkling tail, arcade racing game" \ |
| 63 | --duration 1.2 \ |
| 64 | --prompt-influence 0.65 \ |
| 65 | --out assets/audio/sfx/boost-pickup.mp3 |
| 66 | ``` |
| 67 | |
| 68 | Generate looping ambience: |
| 69 | |
| 70 | ```bash |
| 71 | python3 <this-skill-dir>/scripts/threejs_audio_asset.py sfx \ |
| 72 | --prompt "seamless cyber resort mini golf ambience, distant surf, soft neon transformer hum, gentle crowd bed" \ |
| 73 | --duration 12 \ |
| 74 | --loop \ |
| 75 | --prompt-influence 0.45 \ |
| 76 | --out assets/audio/ambience/cyber-resort-loop.mp3 |
| 77 | ``` |
| 78 | |
| 79 | Generate TTS/announcer line: |
| 80 | |
| 81 | ```bash |
| 82 | python3 <this-skill-dir>/scripts/threejs_audio_asset.py tts \ |
| 83 | --text "Perfect shot." \ |
| 84 | --voice-id JBFqnCBsd6RMkjVDRZzb \ |
| 85 | --out assets/audio/voice/perfect-shot.mp3 |
| 86 | ``` |
| 87 | |
| 88 | Clean dialogue: |
| 89 | |
| 90 | ```bash |
| 91 | python3 <this-skill-dir>/scripts/threejs_audio_asset.py isolate \ |
| 92 | --input assets/audio/source/noisy-boss-line.wav \ |
| 93 | --out assets/audio/voice/boss-line-clean.mp3 |
| 94 | ``` |
| 95 | |
| 96 | Convert a scratch performance to a target voice: |
| 97 | |
| 98 | ```bash |
| 99 | python3 <this-skill-dir>/scripts/threejs_audio_asset.py voice-change \ |
| 100 | --input assets/audio/source/scratch-boss-line.wav \ |
| 101 | --voice-id JBFqnCBsd6RMkjVDRZzb \ |
| 102 | --remove-background-noise \ |
| 103 | --out as |