game-audio

Documents the synthesized Web Audio sound vocabulary and playback constraints for the Payload arcade game.

1|Updated Aug 31, 2026
One-click install
npx skills add https://github.com/gagandeepgill/puzzle-game --skill game-audio-gagandeepgill
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: game-audio
Source: https://github.com/gagandeepgill/puzzle-game/tree/main/.claude/skills/game-audio
Command: npx skills add https://github.com/gagandeepgill/puzzle-game --skill game-audio-gagandeepgill

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding or changing game sounds without breaking the arcade's audio invariants: the lazy AudioContext unlock on iOS, the exponential ramp that prevents clicks, the per-frame cue cap that stops cascades becoming noise, and the mute preference that must cost nothing. ## Core Features & Use Cases - Sound vocabulary reference: Documents every cue in src/ui/audio.ts (trigger, split, spring, skid, seized, bank, roundWon, runLost) with its frequency, waveform, and gameplay meaning. - AudioContext lifecycle rules: Explains why the context is built lazily on first blip, resumed when suspended, and returns null when muted. - Density and accessibility constraints: Covers the two-cues-per-frame cap in usePayloadRun.ts, the measured effect of skip on sound timing, and why reduced-motion must not mute audio. - Use Case: When a new part type needs a sound, use this Skill to pick a cue that communicates something no existing cue does, wire it through the per-frame cap, and avoid re-adding an iOS unlock that already exists. ## Quick Start Use the game-audio skill to add a sound cue for the new Tuning Fork part firing in the drop simulation.

Frequently Asked Questions about game-audio

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new sound effect to a Web Audio game?▼

Add a cue to the sfx object in src/ui/audio.ts using the blip(freq, dur, type, gain) primitive, which runs one oscillator through one gain node with an exponential ramp to 0.0001. Each cue must communicate something no existing cue does, and cues that can fire many times per frame need a cap.

Why does Web Audio stay silent until a user gesture?▼

Browsers refuse to start an AudioContext outside a user gesture, so constructing one at module load leaves it permanently suspended. The arcade builds the context lazily on the first blip and calls resume() when suspended, which works because the first blip always follows a tap.

Why does stopping an oscillator produce a click sound?▼

Stopping an oscillator at full amplitude creates a discontinuity that sounds like a click louder than the note itself. The fix is an exponential ramp of the gain to 0.0001 before stopping, never setValueAtTime(0).

How do I prevent overlapping sound effects from becoming noise?▼

Cap how many cues fire per frame at the call site. The arcade limits trigger cues to two per frame with `if (fired <= 2) sfx.trigger(triggers)` while walking the simulation event log, so an eight-marble burst stays informative.

Can React Native synthesize audio with oscillators?▼

No. React Native cannot synthesize audio and expo-audio plays files only. The documented plan is to pre-render each cue offline with OfflineAudioContext and ship about eight small audio assets for the native port.

Should reduced-motion settings also mute game audio?▼

No. prefers-reduced-motion is a request to lower visual motion, and sound is not covered by that media query, so muting on it would be wrong. Skipped animations still fire the same cues, just compressed into less time.