A beginner's guide to

Web Audio Experiments

Build a synth out of a few lines of JavaScript and a browser tab. Web audio experiments use the browser's Web Audio API and JavaScript to generate, shape and visualise sound with oscillators, filters, envelopes and simple synths.

Guide updated 31 October 2026

Start here ↓
Start-up costFree
Best settingComputer
FeelsCurious
PopularityModerate
CostFree/very low
DifficultyModerate
Time needed30 minutes
Physical effortVery low
Social levelOptional
🎮

Start this hobby

Your first practical checklist

01

Buy or borrow

A computer, a modern browser and a text editor. Browser developer tools show errors and let you test code in the console; an online code playground is fine at first.

02

First 30 minutes

Create a page with a button, and on click make an AudioContext, an oscillator and a gain node, connect them to the output and play a short beep.

03

First week goal

Build a one-octave keyboard from your computer keys, scheduling notes with the audio clock, and add an analyser to draw the waveform.

04

Avoid this mistake

Jumping a gain value straight to zero or a high level, which causes pops, so use setTargetAtTime or ramps, remembering exponential ramps cannot reach zero.

Is this for me?

A quick fit check

Good signs

  • You like both coding and sound, and are curious how synthesisers and effects work.
  • You enjoy tinkering with instant feedback, changing a number and hearing the difference.
  • You would like to make interactive music tools or instruments that run in a browser with nothing to install.

Think twice if

  • Bugs can produce loud or harsh noise, so you have to be careful with volume and headphones while experimenting.
  • Browser support and autoplay rules vary and audio timing can feel odd at first, so expect some trial and error.
  • You need some JavaScript and a few audio ideas, such as frequency, amplitude and envelopes, to understand what you are hearing, which takes a few weeks.

Make web audio experiments easier

Begin with a ready-made oscillator example in an online playground, change the frequency and wave type, and add features one at a time instead of building a whole instrument.

First session

What to do in the first 30 minutes

0–5 min

Set up a page with a Start button and a script that creates a new AudioContext when the button is clicked.

5–15 min

Create an oscillator at 440 Hz, connect it through a gain node set low, such as 0.1, to the destination, and play it for a second.

15–25 min

Try each oscillator type and a few frequencies, and use a gain ramp to fade the note in and out so it does not click.

25–30 min

Add a range slider that changes the frequency, and a stop button, so you can play with the pitch.

The appeal · Digital practice

Why try web audio experiments?

The Web Audio API lets JavaScript in the browser create and connect audio nodes such as oscillators, gain controls, filters and analysers, so you can synthesise sound, process samples and drive visuals from music. It differs from a digital audio workstation or hardware synth, which are full music-making tools, and from the plain HTML audio element, which just plays files. Beginners start by making a beep on a button press, then shape it with envelopes and filters, and then build keyboards, sequencers and visualisers.

✦

Hearing code as sound

Changing a number and instantly hearing the result makes ideas such as frequency and filtering concrete.

✦

Instruments nobody else has

You can design unusual synths, generative music and sound toys that run in any browser.

✦

Crossover skills

Audio timing, signal chains and visualisation are useful in music technology, creative coding and game audio.

Keep it simple

What you need to begin

  • A computer, a modern browser and a text editorBrowser developer tools show errors and let you test code in the console; an online code playground is fine at first.
  • Headphones or speakers, with the volume turned downStart quiet and raise the level gradually, because experiments can produce sudden loud or harsh sounds.
  • Basic JavaScriptFunctions, events and objects are the minimum, and a free beginner course first will save you frustration.
  • A MIDI keyboard or sample files (optional)Some browsers can read MIDI keyboards through Web MIDI and decode your own sample files; use only sounds you own or have licences for.

The fundamentals

Four skills to build

01

The audio graph

Connecting nodes such as oscillator, gain, filter and destination in a chain is how all Web Audio sound is built.

02

Envelopes and scheduling

Using the audio clock and parameter ramps to shape attack and release, and to start notes at precise times, gives clean, in-time sounds.

03

Filters and effects

Low-pass filters, delay, convolution reverb and distortion shape the character of a sound.

04

Analysis and visualisation

Analyser nodes give you waveform and frequency data to draw on a canvas or to drive visuals.

Four small steps

Your first week

  1. Create a page with a button, and on click make an AudioContext, an oscillator and a gain node, connect them to the output and play a short beep.
  2. Change the oscillator type between sine, square, sawtooth and triangle, vary the frequency, and use a gain envelope to fade the note in and out without clicks.
  3. Add a low-pass filter and sweep its frequency over time, then add a slider to control the pitch and a second oscillator.
  4. Build a one-octave keyboard from your computer keys, scheduling notes with the audio clock, and add an analyser to draw the waveform.

The longer path

How progress usually looks

For web audio experiments, a sustainable rhythm is one or two evenings a week of short experiments, with a playable toy or small instrument every few weeks. Move forward when the current step feels repeatable, not merely possible once.

1

First sounds

You make and shape tones with oscillators and gain, started from a button.

2

Playable instruments

You build a keyboard or sequencer with envelopes, filters and a few controls.

3

Samples and effects

You load and play audio files, add delay, reverb or distortion, and link sound to visuals with analysers.

4

Advanced projects

You write custom processing with AudioWorklet, connect MIDI and publish polished tools or generative pieces.

Progress markers

What improvement looks like

Beginner

You make and shape tones with oscillators and gain, started from a button.

Intermediate

You load and play audio files, add delay, reverb or distortion, and link sound to visuals with analysers.

Confident

You write custom processing with AudioWorklet, connect MIDI and publish polished tools or generative pieces.

Spend deliberately

A realistic cost plan

The headline starting range is Free, but access, borrowing and second-hand equipment can change that substantially.

Try it£0A browser, editor and online playgrounds are free.
Get going£0–£40Decent headphones if you do not already have any, and an optional beginner course or book.
Later£50+A MIDI keyboard or controller, sample libraries or paid courses.

Learn with other people

Community and safety

☺

Finding your people

Online creative-coding and music-technology communities share browser synths and code. Locally, look for creative-coding or live-coding meetups, hack nights and maker spaces.

+

Safety note

Sound can be painfully loud when code goes wrong, so start with the volume low, keep gain values small and avoid unlimited feedback. Use headphones at a modest level and take breaks, ask for consent before recording anyone with a microphone, and use only samples you have the right to use.

Three common beginner mistakes

  • Jumping a gain value straight to zero or a high level, which causes pops, so use setTargetAtTime or ramps, remembering exponential ramps cannot reach zero.
  • Trying to restart a stopped oscillator, since an oscillator node can only be started once, so create a fresh one for each note.
  • Scheduling notes with setTimeout, which drifts, so use the audio clock (currentTime) and schedule slightly ahead for tight rhythm.

Good to know

One tip worth keeping

From the HobbyWiki notebook

The classic mistake is starting sound without a user gesture: browsers block audio until the user clicks or taps, so create or resume the AudioContext inside a click handler. Keep the gain low, ramp volume rather than jumping it, and never build unlimited feedback loops, which can produce painfully loud sound.

Find your angle

Useful searches from here

Before you begin

Common questions

What is the Web Audio API?+

A browser feature that lets JavaScript create and connect audio nodes, such as oscillators, filters and gain controls, to generate and process sound in real time.

Why won't my audio play?+

Browsers block audio until a user gesture, so create or resume the AudioContext in a click handler. Also check the volume, the gain value and the browser console for errors.

Is this the same as using an audio tag?+

No. The audio element plays files with basic controls, while Web Audio gives low-level control so you can synthesise sounds and apply effects. You can also feed an audio element into the Web Audio graph.

Do I need a library?+

No, the API is enough to start with, and learning it directly helps. Libraries can simplify scheduling and synths later.

Can I use my microphone or a MIDI keyboard?+

Yes, in supported browsers, after the user grants permission and generally on a secure page. Use headphones with a microphone to avoid feedback squeal, and get consent before recording anyone.