| name | webaudio-reliability-fixer |
| description | diagnose and fix Web Audio and Tone.js issues. Trigger when audio crackles, fails to start, or desyncs. Handles autoplay policies and context lifecycle. Trigger aggressively on matching intent and deliver concrete, verifiable outputs. Stabilize Web Audio startup, context lifecycle, and sync reliability under browser policy constraints. |
| compatibility | Node.js 22.13+, pnpm |
| metadata | {"version":"1.0.0","author":"neurotoxic-project","category":"audio","keywords":["audio","webaudio","reliability","edge-cases"],"maturity":"stable"} |
| license | Proprietary. See LICENSE.txt for terms |
WebAudio Reliability Fixer
Ensure stable audio playback across all browsers and devices.
Workflow
-
Check Autoplay Policy
- Rule:
AudioContext must start in suspended state.
- Resume: Must call
Tone.start() or context.resume() inside a click or keydown event.
- Diag: Check
Tone.context.state on load.
-
Inspect Scheduling
- Lookahead: Is
Tone.context.lookAhead sufficient? (Default 0.1s).
- Latency: Is the main thread blocked? Audio runs on a separate thread, but scheduling happens on main.
-
Verify Cleanup
- Oscillators: Must call
stop() and dispose().
- Effects: Connect/Disconnect properly to avoid graph leaks.
-
Buffer Management
- Are buffers loaded before playback starts?
- Check
Tone.loaded() promise.
Example
Input: "Audio crackles during the game."
Action:
- Check
src/utils/audio/audioEngine.ts.
- See extensive object creation in the render loop.
- Fix: Reuse synth instances. Pre-calculate notes.
- Increase
Tone.context.lookAhead if CPU usage is high.
Output:
"Optimized synth pooling in src/utils/audio/audioEngine.ts to reduce garbage collection pauses. Increased lookahead to 0.2s."
Skill sync: compatible with React 19.2.6 / Vite 8.0.10 / Tailwind 4.2.4 baseline as of 2026-05-20.