Bash.tv → GitHub → itch.io

Add sound and music that make a browser game feel alive. Which sounds every game needs, a Web Audio mixer with music / sfx buses, unlocking audio on the first tap, pitch and volume variation so repeats don't get tiring, voice limits, ducking, looping music and crossfades, positional panning, synthesized sounds (no files) with a jsfxr-style generator, formats and file sizes, mute and settings th...

Download skill (.zip) Files on GitHub

Game sound design

Finding free sounds and music, and keeping credits, is covered by bash-game-audio-credits (Openverse, Freesound, licenses). This skill is about using sound well. Drop-in mixer: assets/audio.js (tested logic).

What needs a sound (in order)

  1. The core action (jump, shoot, tap, place): short, satisfying, slightly varied.
  2. Success (pickup, hit, match, level complete) and failure (hurt, miss, game over). These should be clearly different.
  3. UI: button press, back, error. Quiet.
  4. Music: one loop for play, optional one for menus. Quieter than effects.
  5. Ambience (wind, crowd, hum) for mood games.

Rules

Formats and size

Synthesized sounds (no files)

Great for prototypes and retro games. audio.js includes synth({ type, freq, slide, dur, vol, noise }) for blips, lasers, coins, explosions and hits. Presets: PRESETS.coin, .jump, .laser, .hit, .explosion, .powerup, .click. Swap to recorded sounds later without changing game code (audio.play("coin") either way).

API (audio.js)

import { createAudio, PRESETS } from "./core/audio.js";
const audio = createAudio({ storageKey: "mygame-audio" });
audio.unlockOn(window);                                 // resumes on first pointerdown / keydown
await audio.load({ jump: "assets/sfx/jump.mp3", music1: "assets/music/loop.mp3" });
audio.define("coin", PRESETS.coin);                     // synthesized
audio.play("jump", { pitchVar: 0.08, pan: (x / W) * 2 - 1 });
audio.music("music1", { fade: 1.5 });                   // crossfades from the current track
audio.duck(0.3, 0.6);                                   // music to 30% for 0.6 s
audio.setVolume("music", 0.5); audio.toggleMute();      // persisted

Checklist