Add a button sound with Chip Pops and a few lines of HTML
By Flavio
Updated
Find a soft 8-bit success sound with blips, export it as WAV or m4a, and play it from an HTML button at a quiet volume.
A short sound tells people a button did something. Here we’ll pick one in Chip Pops, export it into a folder, and play it from a plain HTML page.
If the sound is for a game instead, see choose 8-bit game sound effects and export them as WAV.
Find a soft success sound
The Success category has 111 rising chimes for “done”, “saved” and “correct”. In the app, click it in the sidebar and press the arrow keys to move through the grid. Each sound plays as you land on it, and Space plays or stops it.

The panel on the right shows the sound’s ID, its tags and the blips export command for it.
The same search works in the terminal with blips, the command the app installs (choose Install Command Line Tool… from the Chip Pops menu). Success sounds come in three flavors, soft, buzzy and retro. For a button, soft is the one that doesn’t get annoying on the tenth click:
blips list --category success --tag soft --limit 5
success-009 0.47s Soft rising success [sine, repeating]
success-011 0.26s Soft rising success [sine, vibrato]
success-014 0.62s Soft rising success [sine, long]
success-015 0.46s Soft rising success [sine]
success-017 0.55s Soft rising success [sine]
Play a few of them one after the other:
blips play success-009 success-011 success-015
I’ll take success-011. At 0.26 seconds it’s over before you move the mouse.
An agent can run these commands too, but it can’t hear the result. Let it shortlist IDs, then listen and pick yourself.
Export it into your project
blips export copies a sound into a folder. --name gives the file a name that says what it’s for, so you can swap the sound later without touching the code:
mkdir -p button-sound/sounds
cd button-sound
blips export success-011 --to sounds --name saved.wav
/Users/flaviocopes/button-sound/sounds/saved.wav
An existing file with the same name gets replaced.
WAV is the default. --format converts with macOS’s afconvert and also takes m4a, caf and aiff. These are the sizes I got for success-011:
| Format | Size | Notes |
|---|---|---|
wav | 22,592 bytes | Default, plays instantly in every browser |
m4a | 7,742 bytes | AAC, a third of the size, adds a few ms of silence at the start |
caf | 26,644 bytes | Core Audio format, for Mac and iOS apps |
aiff | 26,644 bytes | Uncompressed, for audio tools |
For a quarter-second sound, 22 KB doesn’t matter, so WAV it is. The m4a gap at the start matters more than the size for a click sound.
Write down the seed
A sound ID like success-011 is only stable inside one library. Chip Pops generates its library from a seed, shown at the bottom of the sidebar (Seed 1 by default). A library made from another seed has a different success-011.
Note the ID and the seed in your project’s README. --seed makes the export stop if the library isn’t the one you expect:
blips export success-011 --to sounds --name saved.wav --seed 2
blips: These sounds are from seed 1, not 2. Run 'blips generate --seed 2' first.
Don’t run that generate to fix it, unless you really mean to replace the whole library.
Play it from a button
Create index.html next to the sounds folder. It loads the file once and plays it on every click:
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Button sound</title>
<button id="save" type="button">Save</button>
<p id="status" role="status"></p>
<script>
const button = document.querySelector('#save')
const status = document.querySelector('#status')
const sound = new Audio('./sounds/saved.wav')
sound.volume = 0.25
button.addEventListener('click', () => {
status.textContent = 'Saved'
sound.currentTime = 0
sound.play().catch(() => {})
})
</script>
</html>
volume goes from 0 to 1. Start at 0.25 and raise it after you listen.
Setting currentTime to 0 restarts the sound when someone clicks twice quickly, instead of ignoring the second click. A game that plays several sounds at once needs one Audio object per sound instead.
The status text is there for people who keep their sound off, so the sound is never the only signal. In a real app, play it after the save succeeds, not when the button is pressed.
play() returns a promise that rejects if the browser refuses to play, so the empty catch keeps a blocked sound from turning into an error in the console. Browsers block audio that doesn’t start from a user gesture, and a click counts as one.
Try it
Audio files need to be served over HTTP, so start a local server in the folder:
python3 -m http.server 8000
Open http://localhost:8000 and click Save twice in a row. You hear the chime each time, and the status line says “Saved”.
No sound? Open the browser’s Network panel and look for saved.wav. A 404 means the file isn’t at sounds/saved.wav next to index.html. If blips itself says command not found, ~/.local/bin isn’t on your PATH, or the command line tool isn’t installed yet.
Get Chip Pops
Find and export about 6,000 8-bit sound effects for apps and games. Includes a Mac app, the blips command and full MIT source code.
See Chip Pops → · Read the docs · $20. See the app page for tax details, with full source code.
Want me to talk about your product? You can sponsor this site.