@strata-game-library/audio-synth
v1.0.2
Published
Procedural audio synthesis for Strata 3D using Tone.js - SFX, music, and ambient sound generation
Downloads
308
Maintainers
Readme
@strata-game-library/audio-synth
Procedural audio synthesis for Strata 3D using Tone.js - SFX, music, and ambient sound generation without external audio files.
📚 Documentation
Full documentation is available at strata.game/audio-synth
🏢 Enterprise Context
Strata is the Games & Procedural division of the jbcom enterprise. This package is part of a coherent suite of specialized tools, sharing a unified design system.
Features
- Procedural Audio - Generate sounds at runtime, no external files needed
- SFX Synthesis - Gunshots, explosions, impacts, pickups, and more
- Procedural Music - Pattern-based music generation for menus and gameplay
- Ambient Soundscapes - Environmental audio (wind, rain, water)
- React Integration - Hooks and context for easy React/R3F integration
- Presets - Ready-to-use sound effect and music presets
Installation
```bash npm install @strata-game-library/audio-synth tone
or
pnpm add @strata-game-library/audio-synth tone ```
Usage
React Context Provider
```tsx import { AudioSynthProvider, useAudioSynth } from '@strata-game-library/audio-synth';
function App() { return ( ); }
function Game() { const { playSFX, playMusic, isReady } = useAudioSynth();
const handleShoot = () => { playSFX('gunshot'); };
return Shoot; } ```
Core API (Non-React)
```typescript import { createSynthManager, SFXPresets } from '@strata-game-library/audio-synth/core';
const manager = createSynthManager(); await manager.init();
manager.playSFX(SFXPresets.GUNSHOT); manager.playMusic('combat'); ```
Custom Sound Synthesis
```typescript import { createCustomSFX } from '@strata-game-library/audio-synth/core';
const laserSound = createCustomSFX({ oscillator: { type: 'sawtooth' }, envelope: { attack: 0.001, decay: 0.1, sustain: 0, release: 0.1 }, frequency: { start: 880, end: 220, curve: 'exponential' }, });
laserSound.trigger(); ```
Available Presets
| Category | Presets |
|----------|---------|
| Combat | gunshot, explosion, impact, ricochet |
| UI | pickup, select, confirm, error |
| Environment | splash, footstep, wind, rain |
| Music | menuTheme, combatTheme, ambientTheme |
Related
- Strata Documentation - Full documentation
- Strata Core - Main library
- Strata Presets - Pre-configured settings
- Strata Shaders - GLSL shaders
