resoniq.js
v1.0.4
Published
248 procedural sounds for the web — UI, game, nature, instruments, sci-fi, retro, ambient, alarm, keyboard & magic. Web Audio API, zero files, zero dependencies.
Maintainers
Readme
resoniq
- 248 sounds across 16 categories — UI, game, nature, instruments, sci-fi, retro, ambient, alarm, keyboard & magic
- Same chain API —
.then(),.repeat(),.fade(),.pitch(),.speed(),.stop() prefers-reduced-motion— respects accessibility by defaultresoniq.list()— discover sounds with categories & descriptionsresoniq.setEnabled()— global mute without tearing down the engine- Zero dependencies · zero audio files · ~3.5 KB gzip
npm i resoniq.jsQuick start
import { resoniq } from "resoniq";
resoniq.play("confirm");
resoniq.play("success", { gain: 0.8, pitch: +2 });
resoniq.play("confirm").then("success", 300);
resoniq.play("warn").repeat(3, 100);
resoniq.stop();
resoniq.volume(0.5);Works in React, Vue, Svelte, or vanilla JS — one plain object, not a framework plugin.
React example
import { resoniq } from "resoniq";
export function SaveButton() {
async function handle() {
try {
await save();
resoniq.play("success");
} catch {
resoniq.play("error");
}
}
return <button onClick={handle}>Save</button>;
}All 248 sounds
| Category | Sounds | |-------------|--------| | feedback | confirm, success, saved, sent, complete, error, criticalError, denied, warn, acknowledge, dismiss, progressTick, milestone, softError, revert, approve, reject | | interaction | click, softClick, hover, toggle, destroy, countdown, tapLight, doubleTap, longPress, release, dragStart, snap, expand, collapse | | ui | notification, ping, upload, copy, drop, pop, swipe, unlock, timer, badge, refresh, download, tabSwitch, modalOpen, modalClose, tooltip, searchFound | | texture | dewdrop, breathIn, whoosh, staticPop, crinkle, fabricSwish, sandPour, iceCrack, pebbleDrop, steamHiss, velcro, gravelStep | | synthesis | glassChime, metalPing, organicBlip, deepThud, fmGrowl, pluckHarmonic, bellMetallic, wobbleBass, vowelAah, ringMod, supersaw, clickPop | | filter | ribbonUp, crystalRise, filterSweepDown, sweepUp, autoWah, phaserSweep, notchPing, resoZap, formantShift | | harmonic | zenBell, warmConfirm, morphSuccess, majorBloom, minorFall, octaveStack, fifthRise, choirPad, glassHarmonic | | game | coin, jump, doubleJump, powerUp, powerDown, hit, hurt, explosion, laser, bigLaser, bubble, gameOver, levelUp, shoot, blip, extraLife, dash, shield, checkpoint, comboHit, critical, respawn, collect, damageBlock, enemyAlert, bossRoar | | nature | rain, wind, thunder, waterDrop, stream, fire, ocean, birdChirp, rustle, splash, cricket, frog, owlHoot, waterfall, earthquake, leafCrunch, dripEcho, windHowl | | instrument | kick, snare, hihat, openHat, tom, crash, clap, rimshot, cowbell, bassNote, bassPluck, pianoNote, synthLead, synthStab, clave, shaker, triBell, timpani, marimba, organChord, brassHit, flutePuff, pluckGuitar, djembe | | scifi | robot, glitch, teleport, scan, beam, powerCore, digitalBeep, dataBurst, hologram, alienPing, warp, forceField, shieldUp, malfunction, comlink, tractorBeam, energyCharge, droidChatter, plasmaShot, systemBoot, lockOn, cloak | | retro | arcadeCoin, arcadeJump, arcadeExplosion, arcadePowerup, arcadeBlip, arcadeHit, arcadeSelect, arcadeGameOver, arcadeBonus, arcadeDeath, arcade1up, arcadeLaser, arcadeBleep, arcadeWarp | | ambient | drone, deepSpace, windChime, warmPad, subDrone, nebula, heartbeat, cathedral, underwater, cosmicWind, meditation, dreamPad, voidHum | | alarm | alarm, siren, clockTick, beep, doubleBeep, buzzer, emergency, tripleBeep, warning, redAlert, notifyChime, tornadoSiren | | keyboard | keyPress, keyType, spacebar, enterKey, backspace, mechClick, tabKey, shiftKey, escKey, capsLock, typewriter | | magic | sparkle, magicWand, twinkle, fairyDust, shimmer, spellCast, enchant, portal, healSpell, teleportMagic, curse, summon, levelMagic, potionDrink, runeActivate, wingFlap, crystalChime, arcaneBurst |
resoniq.list().forEach(({ name, category, description }) => {
console.log(name, category, description);
});API
| Method | Description |
|---------------------|-------------|
| play(name, opts?) | Play sound; returns chainable SoundHandle |
| stop() | Stop all active sounds |
| volume(0–1) | Global volume (80ms ramp) |
| register(def) | Add or override a sound |
| list() | Metadata for every sound |
| names() | All registered ids |
| setEnabled(bool) | Mute / unmute |
| setRespectReducedMotion(bool) | Default false — set true in accessible apps |
| isSupported() | Web Audio feature detect |
Play options: gain, pitch (semitones), speed, force (ignore reduced-motion)
Custom sound
resoniq.register({
id: "myPop",
category: "ui",
pitchRange: [-1, 1],
fn(v) {
v({ freq: 400, freqEnd: 180, type: "sine", dur: 0.1, gain: 0.3 });
},
});Backend API (optional)
Lists all 248 sounds as JSON — audio still plays in the browser.
npm run export:catalog
cd backend && npm install
npm run dev:api # from repo root → http://localhost:3001/api