jperezdelreal/firstframestudios/procedural-audio
Claude Code and agent skill by jperezdelreal/firstframestudios
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install jperezdelreal/firstframestudios/procedural-audioSKILL.md
The same SKILL.md was published earlier as jperezdelreal/firstframestudios/procedural-audio.
SKILL: Procedural Audio for Browser Games
Zero-asset audio system using Web Audio API — SFX, music, and ambience with no WAV/MP3 files.
Context
Build complete game audio using only the Web Audio API: oscillators for tones, noise buffers for texture, and gain nodes for envelopes. All sounds route through a bus topology (sfx/music/ui/ambience → master → destination) for mix control. AudioContext must be resumed on first user gesture — create eagerly, resume lazily.
Core Patterns
Bus Topology (Always Set Up First)
Create gain-node buses: sfxBus, musicBus, uiBus, ambienceBus → all connect to masterBus → context.destination. Default gains: SFX 0.7, music 0.5, UI 1.0, ambience 0.08. Every sound connects to a bus, never directly to `context.destination`.
Synthesis Primitives
- Tonal Impact (punch/kick/thud): Oscillator with downward frequency sweep +
exponentialRampToValueAtTimeon gain. Vary freq (80–300Hz), duration (0.05–0.3s), and waveform (sine/square) for different impacts. - Noise Burst (crack/snap/hi-hat): Create short noise buffer → bandpass
BiquadFilter→ gain envelope. VarycenterFreq(200–7000Hz) andQfor different textures. - Layered Hit: Combine 3 layers (bass sine ~70Hz + mid noise burst ~1400Hz + high sine ~2500Hz) for rich combat sounds. Single oscillators sound thin.
- Formant Vocal: Base sine oscillator + noise through sweeping bandpass filter. Descending sweep = sad; ascending = excited.
- Note Sequence: Schedule oscillators at
currentTime + i * spacingfor fanfares/UI cues. Ascending notes = victory; descending = danger. - Ambience: Looping noise buffers + LFO gain modulation on
ambienceBus. Copy node arrays before clearing during fade-out cleanup.
Procedural Generation Controls
- Pitch randomization:
baseFreq * (1 + (Math.random() - 0.5) * 2 * 0.2)— ±20% variance on every play. - Priority/dedup: Track per-type active sound count; enforce
MAX_SAME_TYPElimit. Spread pitch +5%/+10% for same-frame overlaps. - Spatial panning: Swap
sfxBusreference to aStereoPannernode before calling a sound function, then restore. Synchronous node connections make this safe. - Adaptive music: 100ms
setIntervalscheduler with 150ms lookahead usingcurrentTimefor sample-accurate beat timing. Layer intensity (bass → +percussion → +melody) withsetTargetAtTime()crossfades (~170ms time constant).
Key Examples
Tonal Impact
Noise Burst
Anti-Patterns
- Skipping AudioContext resume — sounds silently fail without a user gesture; wire resume to
keydown/click/touchstarton day 1. - Connecting directly to `context.destination` — bypasses all volume/mix control; always route through a bus.
- `exponentialRampToValueAtTime` targeting 0 — exponential ramps cannot reach zero; use 0.001 or 0.01 instead.
- Linear gain envelopes on impacts — sounds artificial; always use
exponentialRampfor natural decay. - No sound priority system — rapid combat spawns unbounded overlapping sounds; enforce
MAX_SAME_TYPElimits. - Allocating noise buffers per-call for looping sounds — pre-compute and reuse buffers for continuous ambience.
- Unmanaged feedback loops — delay→feedback→delay chains play forever; schedule
disconnect()after expected duration.
Full patterns, code, and frequency cheat sheet in REFERENCE.md. Derived from firstPunch's 21-sound procedural audio system, June 2025.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.squad/skills/procedural-audio/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jperezdelreal/firstframestudios/procedural-audio)