Skip to main content

Requirements

  • Node.js 20 or later
  • A project with a package.json. Run the CLI from your app’s root, or pass --cwd <path>.
  • React 18 or later, only if you use the React hooks

Set up audx

1

Run init

init asks where sound files should go (src/sounds by default) and which theme to use, then:
  • writes audx.json with your choices
  • installs @litlab/audx with your package manager
  • lets you pick a starter set of sounds
The starter set is click, toggle, select, open, close, copy, success, error and notify.
2

Play a sound

Each sound is exported from your sounds directory. Import it and call it:
The CLI picks up path aliases from tsconfig.json or jsconfig.json. Without an alias, import from a relative path such as ./src/sounds.
3

Add more sounds

Run add with no arguments to open an interactive picker, or list to browse the catalog:

Use it in React

useSound returns a stable callback that respects <SoundProvider> and the user’s prefers-reduced-motion setting:
See Use with React to add a sound on/off setting.

Switch the theme

Every built-in theme has the same 43 sounds, so switching themes changes how your app sounds without changing your code:

What gets generated

Each file is a short module you own:
src/sounds/click.ts
Keep the // @audx header line. The CLI uses it to find installed sounds when you run theme, update or remove.
In a JavaScript project with no tsconfig.json, the CLI writes .js files instead.