Audio Synth
Audio Synth
Section titled “Audio Synth”The @strata-game-library/audio-synth package provides procedural audio synthesis for game sound effects and music. Generate sounds programmatically without audio files — explosions, footsteps, UI clicks, ambient music, and more.
Installation
Section titled “Installation”pnpm add @strata-game-library/audio-synthQuick Start
Section titled “Quick Start”import { AudioSynthProvider, usePlaySFX, usePlayMusic } from '@strata-game-library/audio-synth';
function Game() { return ( <AudioSynthProvider> <GameContent /> </AudioSynthProvider> );}
function GameContent() { const playSFX = usePlaySFX(); const playMusic = usePlayMusic();
return ( <button onClick={() => playSFX('explosion')}> Play Explosion </button> );}Features
Section titled “Features”- Procedural SFX — Generate sound effects from parameters, not audio files
- Music Patterns — Compose and play music programmatically
- Spatial Audio — 3D positional sound that follows objects in the scene
- React Integration — Hooks and context providers for React apps
- Preset Library — Built-in presets for common game sounds
SFX Presets
Section titled “SFX Presets”Built-in sound effect presets:
| Preset | Description |
|---|---|
explosion | Rumbling explosion with decay |
laser | Sci-fi laser beam |
gunshot | Firearm discharge |
footstep | Walking sound |
impact | Physical collision |
pickup | Item collection |
powerup | Power-up activation |
select | UI selection |
confirm | UI confirmation |
error | UI error notification |
ricochet | Bullet ricochet |
Music Patterns
Section titled “Music Patterns”Built-in music patterns for different game states:
| Pattern | Description |
|---|---|
ambient | Calm background atmosphere |
exploration | Adventurous exploration theme |
combat | Intense battle music |
menu | Main menu background |
defeat | Game over theme |
API Reference
Section titled “API Reference”See the detailed API documentation for complete type definitions and usage examples.
Related
Section titled “Related”- Audio Presets — Pre-configured audio settings
- API Reference — Full TypeDoc documentation