Skip to content

EZ Web AudioThe Simple Web Audio API for JavaScript & TypeScript

Play sounds, create synthesizers, build drum machines, and visualize audio — all with zero dependencies and full TypeScript support.

What is EZ Web Audio?

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:

Play a Sound

typescript
import { createSound } from 'ez-web-audio'

const sound = await createSound('/audio/click.mp3')
sound.play()

Create a Synthesizer

typescript
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()

Build a Drum Machine

typescript
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 notes

Apply Effects

typescript
import { 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.

Why EZ Web Audio?

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:

  • Immediate productivity -- play a sound in 3 lines, not 30. No need to manually create and connect AudioNodes.
  • Full TypeScript support -- every parameter, option, and return type is documented and typed. Your editor tells you exactly what is available.
  • Framework agnostic -- works with React, Vue, Svelte, or vanilla JS. Reactive wrappers (like Vue reactive()) are supported natively via wrapWith.
  • Production ready -- input validation, descriptive error messages, event system, debug mode, and dispose() for cleanup.
  • No lock-in -- access underlying AudioNodes when you need them. EZ Web Audio wraps the Web Audio API; it does not replace it.

Best Demos to Try

  • Drum Machine -- build and play rhythmic patterns with a step sequencer
  • Synth Keyboard -- play a polyphonic synthesizer with ADSR envelopes
  • Effects -- apply filters and hear the difference in real time
  • Visualization -- see frequency spectrum and waveform data rendered live

How Does It Compare?

There are several good audio libraries for the web. Here is how EZ Web Audio fits in:

EZ Web AudioTone.jsHowler.js
FocusSimple API for sounds, synthesis, sequencing, and effectsFull music production framework (DAW in browser)Sound playback and management
Size~17–52 KB gzipped (zero deps, tree-shakeable)~150 KB+~10 KB
TypeScriptWritten in TypeScript, first-class typesBuilt-in (TypeScript source)Community @types
SynthesisOscillators with ADSR, PolySynth (polyphonic), GrainPlayer (granular)Full synth engine, transport, instrumentsNo synthesis
SequencingTransport clock, Sequence, BeatTrack patternsTransport, loops, sequences, partsNo sequencing
EffectsDelay, Reverb, Distortion, Compressor, EQ, Filter, LFO modulationComprehensive effect libraryNo effects
Learning curveMinimal -- matches mental model of "play a sound", scales to complex audioSteeper -- music production conceptsMinimal
Best forApps needing sounds, synthesis, sequencing, transport, and effects with a small footprintFull DAW-style applications, generative musicSimple 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.