A PROCEDURAL AUDIO LIB BY SOPHIE'S SWAMP MIT

SWAMP SOUNDS

13 sounds. one file. no MP3s.

Every component in Swamp UI has a little sound — a plop, a chime, a croak. This is that machine, extracted. Drop one <script> on your page and any element can speak.

~8 KB unminified
Zero deps
Zero audio files
MIT licensed
INSTALL <script src="https://sophieren.com/swamp-sounds/swamp-sounds.js"></script>
Try the sounds ↓ API reference

Sound board

click any pad to hear it · 13 sounds
VOLUME

How to use

three patterns — pick whichever fits

1. Direct call — call after any user gesture (browsers block audio until then).

<script src="https://sophieren.com/swamp-sounds/swamp-sounds.js"></script>

<button onclick="swampSounds.plop()">Press me</button>

<script>
  // Or wire up listeners directly:
  document.querySelector('#submit').addEventListener('click', () => {
    swampSounds.chime();
  });
</script>

2. Selector-attach — one-liner to bind a sound to any selector.

swampSounds.attach('button',        'plop');
swampSounds.attach('.card',         'firefly');
swampSounds.attach('#easter-egg',   'croak');

// With options:
swampSounds.attach('.win', 'riserun', { volume: 0.2 });

3. Per-call options — every sound takes { volume, pitch }.

swampSounds.plop({ volume: 0.3 });        // louder
swampSounds.croak({ pitch: 0.6 });        // big lazy bullfrog
swampSounds.firefly({ pitch: 1.5 });     // tiny sparkle

// Global controls:
swampSounds.mute(true);                  // silence everything
swampSounds.setVolume(0.5);              // master volume (0-1)

// Play by name (useful for data-driven UI):
swampSounds.play('chime');
swampSounds.names(); // ['plop','chime','croak', ...]

API reference

13 sounds + a handful of controls
SoundVibeBest for
plop()soft drop, 180→55 Hzbuttons, taps, ripples
chime()bell-like single note + octavesuccess, confirmation
croak()sawtooth wobble + thunkeaster eggs, frog things
buzz()detuned saws, ~220 Hzinsects, idle / loading
splash()bandpass noise + low tonesplash, water impact
firefly()high blip + harmoniccatch, collect, notification
bite()sharp two-note (square → sine)strike, alert, hook-set
splat()square thud + lowpass noiseswat, impact, hit
hop()two-tone arc (4→6th)jump, advance, step
riserun()5-note pentatonic ladderwin, level-up, celebrate
tarot()low bell + sparkle stackreveal, mystical, important
rip()low sine sweep 90→40 Hzripple, ambient bass moment
lure()highpass noise whooshcast, swipe, send
ControlBehavior
mute(bool)Silence all sounds. Pass true/false.
setVolume(0..1)Master gain. 0.5 is roughly comfortable for ambient use.
attach(selector, name, opts)Bind a sound to all matching elements' click. Returns unbind fn.
play(name, opts)Play any sound by string name.
names()Returns the list of available sound names.
isMuted()Returns current mute state.

MIT licensed

Use it in personal projects, commercial work, paid products, side hustles. Fork it, remix the sounds, add your own. Attribution appreciated but not required.

Wired this into something?

Show me. Or feed the cats. Or both.

🧋 TREAT THE SWAMP →

Versions

v1.0.0 · 2026-05-29 · initial release with 13 sounds: plop, chime, croak, buzz, splash, firefly, bite, splat, hop, riserun, tarot, rip, lure.