DocsThe iconSound

Sound

An optional module of 86 short sounds, built in the browser as they play. Nothing is downloaded, and nothing plays until a visitor says so.

1 min readUpdated November 2026Fidgicons 1.0

Switch it on to hear the examples on this page.

#Switch it on

sound.jsjs
import { createSound } from 'fidgicons/sound';

const sound = createSound();
toggle.onclick = () => sound.set(!sound.on);   // remembered for next time
button.onpointerenter = () => sound.play('coin');

Browsers only allow sound after a click, tap or key press, so call sound.set(true) from one. The choice is remembered on that browser; sound.remembered() tells you it was switched on before.

#Every sound

Each icon in index.json names its sound. Tap one to hear it.

#Place it between the speakers

A sound can start where its icon is and travel. The fifth argument is the place, from -1 (left) to 1 (right); the sixth is how far it moves while it plays.

const x = (el.getBoundingClientRect().left / innerWidth) * 2 - 1;
sound.play('engine', 1, 0, false, x, 0.7);   // starts where the icon is, drives right
ArgumentWhat it sets
nameOne of the 86 sounds above.
pitchMultiplies the pitch. 1 is as made.
delaySeconds to wait.
forcetrue plays even while sound is off. Keep it for a sound the visitor asked to hear.
pan-1 left, 0 centre, 1 right.
travelHow far the sound moves while it plays.
Something missing or unclear?Write to usRequest an icon