40 · Audio · Web (2D and 3D)

Web audio unlock

Why your browser game is silent until you click.

Browsers block sound until the player interacts with the page, so an audio system created at load starts "suspended" and every sound is silently dropped. Many AI-written web games ship with no sound for this reason. The fix: resume the audio context inside the first click, tap or key press.

Space play a soundM unlock on/offTap Play sound

Try this: With unlock off, press Play: nothing, because the audio was started at page load and the browser blocked it. Turn unlock on and play again.

Audio state not createdSounds heard 0Sounds dropped 0

Sound is quiet and only plays when you press Play. "Created at page load" is simulated here so this page doesn't make noise on load.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Unlock web audio: create or resume the AudioContext inside the first click, tap or key press, retry resume on every input until its state is running, and queue sounds triggered in the first 0.5 s so the opening music is not silently lost.

43 words · one sentence to paste as is

Where it's used

Common mistakes

Creating the AudioContext at load and never resuming it, resuming only once (iOS needs a retry), starting music before any gesture so it is silently lost, and not suspending audio when the tab is hidden.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.