Make sound in the browser with the Web Audio API
8 steps · about 2 h 15 min · Beginner
- Meet the Web Audio API (reference, MDN, 10 min)
Lists the node types and how they connect into a graph.
- Learn audio graphs, channels and sample rates (article, MDN, 20 min)
Gives the sound basics the API assumes you know.
- Play a file and control volume and panning (tutorial, MDN, 20 min)
Your first working graph: source, gain, panner, destination.
- Start audio within the autoplay policy (article, Chrome for Developers, 10 min)
Explains why the context starts suspended until a user gesture.
- Synthesise sounds and build a step sequencer (tutorial, MDN, 30 min)
Uses oscillators, noise and envelopes to make instruments.
- Schedule notes precisely with a look-ahead timer (article, web.dev, 15 min)
Shows why setTimeout drifts and how to use the audio clock.
- Draw a waveform and frequency bars (tutorial, MDN, 20 min)
Connects an AnalyserNode to a canvas.
- Follow Web Audio best practices (article, MDN, 10 min)
Covers loading, user control and performance.