Audio Pipeline
ElevenLabs music/SFX/voice clients with billing-safe ledgers plus offline seamless loop-finding and SFX mastering.
Combines billing-safe ElevenLabs music, SFX, and voice generation scripts with offline DSP tools for bar-aligned seamless music looping (loopfind.py) and mono 44.1 kHz game SFX normalization (process_sfx.py).
git clone https://github.com/BestRoiMedia/bestroi-game-tools.gitWhy we built it
AI audio APIs rarely return game-ready seamless loops or consistent loudness, and blind retries can double-bill failed requests. This suite protects originals, prevents duplicate dispatches, and automates technical mastering.
Architecture & how it works
Uses exclusive file locks and local JSONL provenance ledgers to block duplicate track/SFX dispatches, while offline tools run beat/bar seam scoring with equal-power crossfades and FFmpeg/NumPy peak normalization.
Key capabilities
- Billing-safe ElevenLabs music (eleven_music.py), SFX (eleven_sfx.py), and voice (eleven_voice.py) clients
- Exclusive lockfiles and prior-ledger guards preventing accidental double-billing
- Offline bar-aligned seamless music loop finder (loopfind.py) with equal-power crossfades and seam scoring
- SFX mastering (process_sfx.py) converting originals to mono PCM16 44.1 kHz with padding trim, anti-click fades, and qa.json
- Comprehensive unittest suite with mocked APIs and synthetic audio selftests
Usage example
python3 audio/loopfind.py loop ./original_theme.wav ./out/theme_loop.wav
python3 audio/process_sfx.py ./sfx_spec.json --runtime ./GAME_DIR/Assets/Audio/SFX
python3 -m unittest discover -s audio -p 'test_*.py'