AI sound effects and music for games
A jump without a sound feels like a menu transition. Add a short whoosh and it feels like a jump. AI covers both halves of game audio now: effects your coding agent writes as code or generates from a text prompt, and music from a few song models. This guide covers where to get each, which plans let you ship the result, and how to play it in a browser without the silent-on-iPhone bug.
Tool facts are as of September 2026 and linked where they appear. Terms change often, so reread them before a release.
Which AI audio tools allow commercial use
Paid plans and open licenses allow it; most free tiers don’t.
| Tool | Makes | Commercial use | Notes |
|---|---|---|---|
| ElevenLabs sound effects | Effects up to 30 s, loops | Any paid plan, Starter up | Free-plan output stays non-commercial, even after upgrading |
| ZzFX, jsfxr | Retro effects from code | Yes (MIT, Unlicense) | No files; the agent writes parameters |
| Suno | Songs | Paid-plan downloads only | Downloads capped per month since September 3, 2026 |
| Stable Audio 3.0 | Music and effects | Free under US$1M annual revenue | Small SFX, Small and Medium are open weights |
| Google Lyria 3.5 | Full songs, a couple of minutes | Google claims no ownership | $0.08 per song, no free tier, SynthID watermark |
Sources: ElevenLabs pricing, ElevenLabs publishing, ZzFX, jsfxr, Suno downloads, Suno terms, Stable Audio 3.0, Stability license, Lyria, Gemini pricing, Gemini terms.
Udio, once the other big name in AI music, turned off downloads on October 29, 2025, the day it announced its partnership with Universal Music Group (Udio).
Make sound effects in code or from a prompt
For a jam game or a prototype, start with code. ZzFX is a sound generator under 1 KB, MIT-licensed, where each sound is one line of numbers (ZzFX). jsfxr recreates the classic sfxr and generates presets such as pickupCoin (jsfxr). Since a sound is only a list of parameters, your coding agent can write it and change it on request, as in “make the coin sound higher and shorter”.
Several games in the catalog ship without a single audio file. Hollow Crown builds every sound on the Web Audio API, and Pro Skater: The Warehouse synthesizes all of its audio in code at startup, according to their READMEs.
For realistic material sounds, like wood, glass or rain, generate from text instead. ElevenLabs’ sound-effects API returns a clip from 0.5 to 30 seconds, and its default v2 model can make one that loops smoothly (API). Name the material, the action and the space: “short wooden crate smash, dry, close, no reverb” gets you further than “explosion sound”. Generate several takes per sound and keep the best.
Check the rights before you ship. Every ElevenLabs paid plan, Starter included, carries a commercial license, and anything made outside a paid subscription stays non-commercial, even after you upgrade (publishing help). The use policy also bars using effects “on a standalone basis”, such as a sample library you sell (use policy).
Music that loops
Game music repeats, so ask for a loop: “90-second loop with no gap at the seam, chiptune, upbeat, no vocals, no intro”. Vocals fight with sound effects, and an intro plays once and then gets in the way. The prompt works with any of the three models below.
Suno makes full songs from a prompt. Its terms, revised in August and in effect since September 3, 2026, limit free-plan output to personal, non-commercial use; commercial use needs a permitted download on a paid plan (terms). Downloads are capped at 7 in total on the free trial, 20 a month on Pro and 60 on Premier (Suno). Suno’s help center adds that its songs may not be eligible for copyright protection on any plan (Suno help).
Stable Audio 3.0, released in May 2026, ships its Small SFX, Small and Medium models as open weights. Large is available through Stability’s API or as an enterprise self-hosted deployment (Stability AI). Under Stability’s community license you own the output and can use it commercially while your annual revenue stays under US$1M (license).
Google’s Lyria 3.5 on the Gemini API writes full songs a couple of minutes long, with the length set in the prompt; its sibling Lyria 3 Clip always returns 30 seconds (Lyria docs). Lyria 3.5 outputs MP3 by default or WAV on request and costs $0.08 per song, with no free tier (pricing). Every file carries a SynthID watermark, and Google’s API terms say it won’t claim ownership of what you generate (terms).
Music can be code too. Arkanoid Neon generates its synthwave soundtrack live with Web Audio, and ZzFXM writes tracked songs in the same compact style as ZzFX (ZzFXM). Cybertaxi took the generated route instead. Its creator tried Suno for music and ElevenLabs for spoken dialog to make the game feel more cinematic, according to its Vibe Jam 2026 submission.
Browser playback without the silent-iPhone bug
Start audio from the player’s first tap, and on iPhones declare it as playback. Both fit in one event handler.
Start audio on the first tap
Chrome creates a Web Audio context in a suspended state when no one has interacted with the page yet, and resume() after a gesture starts it (Chrome). A “tap to start” screen handles it in every browser:
const ctx = new AudioContext();
startButton.addEventListener('pointerdown', async () => {
if (ctx.state === 'suspended' || ctx.state === 'interrupted') await ctx.resume();
if (navigator.audioSession) navigator.audioSession.type = 'playback';
startGame();
});
The audioSession line is for iPhones. Web Audio follows the silent switch there, and since iOS 17 setting the session type to playback lets game audio play anyway (WebKit bug). iOS Safari also moves the context to interrupted when the player switches tabs or turns off the screen, so call resume() again when they return (MDN).
Ship one audio sprite in two formats
Pack every effect into one file with known offsets, so the game loads all its sounds in a single request. Howler.js plays sprites, falls back to HTML5 audio and unlocks audio on the first interaction by default (Howler).
For formats, Howler’s README says to default to WebM and fall back to MP3. Safari has played Ogg Opus and Vorbis since 18.4 (WebKit), and MDN’s codec guide calls AAC likely the best choice if you can only support one format (MDN codecs).
import { Howl } from 'howler';
const sfx = new Howl({
src: ['/audio/sfx.webm', '/audio/sfx.mp3'],
sprite: { jump: [0, 180], coin: [250, 300], hit: [600, 220] },
});
const id = sfx.play('jump');
sfx.rate(0.95 + Math.random() * 0.1, id); // a slightly different pitch every time
The rate call plays each copy a little faster or slower than the last, so the fiftieth coin in a minute doesn’t sound exactly like the first. Game feel with AI has more of these small feedback tricks.
Give players the controls
- A mute button on screen, reachable during play.
- Separate volumes for music and effects.
- Both settings saved in
localStorage, so they survive a reload. - Audio muted automatically while an ad plays, which Poki requires (Poki requirements).
Keep a sound log
Log every generated file when you make it. One row per file is enough:
file,tool,plan,date,prompt
sfx/crate.mp3,ElevenLabs eleven_text_to_sound_v2,Starter,2026-09-30,"short wooden crate smash, dry, close, no reverb"
Rights questions tend to arrive after launch, when the prompt is long forgotten. Poki, for one, wants developers to be able to show which tools they used and how, with their prompts and iterations, on request (Poki).
Next: game feel and publishing
- Game feel with AI: where sound fits among the other feedback techniques.
- Where to publish a browser game: what each portal asks about audio and AI.
- Play the rhythm games in the catalog: sound is the whole game there.
Games to look at
Questions
Can I use AI sound effects in a commercial game?
On a paid plan, usually yes. Every ElevenLabs paid plan, Starter included, carries a commercial license, and content made outside a paid subscription can't be used commercially, even after you upgrade. Its use policy also bars reselling effects on their own, such as sample packs.
What is the best free way to add sound to a browser game?
Generate it in code. ZzFX is an MIT-licensed sound generator under 1 KB, and jsfxr recreates the classic sfxr tool. A coding agent can write and tweak their parameters directly, so there are no files to manage.
Why doesn't my browser game play sound until I click?
Browsers block audio until the player interacts with the page. Chrome starts a Web Audio context in a suspended state when it's created before a gesture; call resume() on the first tap or key press, typically behind a start button.
Can I use Suno music in my game?
Only from a paid plan. Suno's terms, in effect since September 3, 2026, limit free-plan songs to personal, non-commercial use, and commercial use needs a permitted download on a paid plan, capped per month. Suno also warns that its songs may not be eligible for copyright protection.