Play Sounds in 3 Lines
Load and play audio files, create synthesizers, or build drum machines. No Web Audio boilerplate needed.
Play sounds, create synthesizers, build drum machines, and visualize audio — all with zero dependencies and full TypeScript support.
EZ Web Audio is a TypeScript library that wraps the Web Audio API with a simpler interface. Instead of dealing with AudioContext, AudioBufferSourceNode, and GainNode directly, you write clean, readable code:
import { createSound } from 'ez-web-audio'
const sound = await createSound('/audio/click.mp3')
sound.play()import { createOscillator } from 'ez-web-audio'
const synth = await createOscillator({
type: 'sawtooth',
note: 'A4',
envelope: { attack: 0.01, decay: 0.2, sustain: 0.3, release: 0.5 }
})
synth.play()import { createBeatTrack } from 'ez-web-audio'
const track = await createBeatTrack(['/audio/kick.wav'], { numBeats: 8 })
track.setPattern([1, 0, 0, 1, 0, 0, 1, 0])
track.playActiveBeats(120, 1 / 4) // 120 BPM, quarter notesimport { createDelay, createReverb, createSound } from 'ez-web-audio'
const sound = await createSound('/audio/guitar.mp3')
const delay = createDelay({ time: 0.3, feedback: 0.4, wet: 0.3 })
const reverb = createReverb({ decay: 2.5, wet: 0.2 })
sound.addEffect(delay)
sound.addEffect(reverb)
sound.play()From simple sound effects to polyphonic synthesizers, granular textures, transport-synced sequencing, and built-in effects chains, EZ Web Audio handles the complexity so you can focus on creating.
The raw Web Audio API is powerful but verbose. Creating a simple sound with volume control requires understanding AudioContext, AudioBufferSourceNode, GainNode, and their connection model. EZ Web Audio eliminates that boilerplate while keeping you close to the metal.
What you get:
reactive()) are supported natively via wrapWith.dispose() for cleanup.There are several good audio libraries for the web. Here is how EZ Web Audio fits in:
| EZ Web Audio | Tone.js | Howler.js | |
|---|---|---|---|
| Focus | Simple API for sounds, synthesis, sequencing, and effects | Full music production framework (DAW in browser) | Sound playback and management |
| Size | ~17–52 KB gzipped (zero deps, tree-shakeable) | ~150 KB+ | ~10 KB |
| TypeScript | Written in TypeScript, first-class types | Built-in (TypeScript source) | Community @types |
| Synthesis | Oscillators with ADSR, PolySynth (polyphonic), GrainPlayer (granular) | Full synth engine, transport, instruments | No synthesis |
| Sequencing | Transport clock, Sequence, BeatTrack patterns | Transport, loops, sequences, parts | No sequencing |
| Effects | Delay, Reverb, Distortion, Compressor, EQ, Filter, LFO modulation | Comprehensive effect library | No effects |
| Learning curve | Minimal -- matches mental model of "play a sound", scales to complex audio | Steeper -- music production concepts | Minimal |
| Best for | Apps needing sounds, synthesis, sequencing, transport, and effects with a small footprint | Full DAW-style applications, generative music | Simple sound playback (games, UI) |
Choose EZ Web Audio when you need more than just playback (synthesis, drum machines, effects, visualization) but do not want the complexity and bundle size of a full music production framework.