Go Bananas

MP3 files in browser games

MP3 is the format every Go Bananas game plays: upload one, and it's ready for sound effects or music with little to change.

MP3 is a compressed audio format that keeps files small by dropping sounds the ear barely notices. Every browser and phone can play it, which is why it's the most common format for sound on the web. On Go Bananas, every audio file you upload is turned into an MP3, so MP3 is also what your game ends up playing.

What MP3 is good for in games

MP3 works well for both kinds of game audio:

  • Sound effects. Jumps, coins, hits and clicks are short, so an MP3 of them is tiny and loads fast.
  • Music. A two-minute track that would be over 20 MB uncompressed fits in a few megabytes as an MP3.

Its weak spot is seamless loops. MP3 encoders add a few milliseconds of padding at the start and end of a file, so a music loop can have a tiny gap or click where it repeats. Tracks with a soft ending or a natural pause loop more smoothly.

Because the site converts every upload to MP3 anyway, the format you start from mostly decides two things: how good the audio sounds going in, and whether the file fits the 5 MB limit. An MP3 you already have is the simplest choice. If you have a choice of exports, a higher-quality MP3 (192 kbps or more) gives the conversion more to work with.

Uploading MP3 to Go Bananas

You upload audio in the Upload Asset window. Open it from the Assets tab ("Upload Asset") or from the editor ("Upload New", or drag a file onto the editor chat). If you drop an audio file on the create panel, the site opens the same window for you.

You need to be signed in with a verified email. Before the upload, you tick a box confirming you have the right to use the audio: it's your own work, it's licensed to you, or it's in the public domain.

LimitValue
File size5 MB per file
Length120 seconds
All your audio together50 MB per account
Embedded tags (such as cover art)256 KB

The site checks the file is real audio it can read, then prepares it for games:

  1. It sets the loudness to -16 LUFS, so every sound in a game plays at a similar level.
  2. It trims silence at the start of the file. Silence at the end stays.
  3. It removes all metadata, including artist names and cover art.
  4. It saves the result as an MP3 at 44.1 kHz. A clip of 5 seconds or less is treated as a sound effect and saved in mono at 96 kbps. A longer clip is treated as music and saved in stereo at 128 kbps.

Only the converted MP3 is kept; the file you uploaded is deleted. The site warns you if the audio is clipping (distorted) or unusually quiet or loud. You can trim it to the part you want, and games then play only that part. The file itself isn't cut, so you can change the trim later.

Using MP3 in your game

The easy way: ask the AI. In the create or edit box, type @ and pick your sound. Its name is inserted in quotes, for example "jump", and the AI knows which file you mean. In the editor's Assets tab, attach the sound to your game to set its volume with a slider from 0 to 100.

In code. Every game has a sound helper, window.__audio. Your file's address is in window.GAME_ASSETS.audio, under the file's name without its extension:

const jumpUrl = window.GAME_ASSETS.audio['jump'].url;
const themeUrl = window.GAME_ASSETS.audio['theme'].url;

// Browsers, and iPhones especially, only allow sound after a tap or click
document.addEventListener('pointerdown', () => {
  __audio.init();
  __audio.playMusic(themeUrl, { loop: true, volume: 0.5 });
}, { once: true });

// Load early, so the sound is ready the first time it's needed
__audio.load(jumpUrl);

function jump() {
  __audio.play(jumpUrl, { volume: 0.8 });
}

Pass the full address. A bare name like 'jump' or an asset ID won't play. For 3D games, __audio.play3D(url, x, y, z, camera) makes a sound come from a point in space, quieter the farther away it is.

Use the helper rather than new Audio() or your own AudioContext. It unlocks sound on iPhones, follows the site's mute button, and applies the volume you set in the editor.

Built-in sounds

Every game can use a free sound pack, released as CC0 (no permission or credit needed). Each sound lives at https://gobananas.co/sfx/<name>.mp3:

  • gunshot, reload, hit, footstep, pickup, menu_click
  • zombie_moan, zombie_attack, zombie_death
  • ambient_tension, a music loop of about 10 seconds

Use the full https address in game code, for example __audio.play('https://gobananas.co/sfx/pickup.mp3'). The editor's volume slider doesn't apply to these, so set their volume in the play call.

Tips and common problems

  • The file is over 5 MB. Re-export it at a lower bit rate, or shorten it. At 128 kbps, 5 MB holds about 5 minutes, but the 120-second limit applies first.
  • Silence at the end. Only the start is trimmed. Trim the end in the editor, or cut it before uploading.
  • A clipping warning means the recording is distorted at its loudest moments. Lowering the volume afterwards won't fix it; re-export from the original at a lower level.
  • The game can't find the sound. The name in GAME_ASSETS.audio is the file name without .mp3. If you rename the asset, game code that uses the old name stops finding it.
  • Two files with the same name. The newest one wins, so give each sound its own name.

From ChatGPT or Claude

Audio can't be sent through the Go Bananas app in ChatGPT or Claude. Ask for an upload link: it takes you to your game's page, where you upload the file from the editor.

Related

Your turn.

Describe a game in plain language and play it in your browser a few minutes later. Your first game is free, no account needed.

▶ Make a game