useSound has a similar shape, so most components change by a line or two. You can then either keep your audio files or replace them with synthesized sounds that need no files at all.
Option 1: switch to synthesized sounds
Add the semantic sounds that match what your files did:- audx’s
useSoundis a named export, and it returns the play function directly rather than a tuple. - The sound is TypeScript in your repo, not an audio file, so there’s nothing to host, preload or cache.
Option 2: keep your audio files
If your app depends on specific recordings, play them with asample source. Define each sound once, at module level:
sounds/boop.ts
Option mapping
Mute and accessibility
With use-sound you passsoundEnabled to every hook. In audx, one <SoundProvider> near the root controls every useSound below it:
useSound also stays silent when the user has prefers-reduced-motion: reduce set, without extra code. See Use with React for a complete sound setting.