soundhub.js v-

Every part of the API, one page

Click anything. Each card shows the exact soundhub calls behind your click, and the event log at the bottom shows what the library sent back. The page imports the library straight from source, so it doubles as a smoke test.

Audio- Sounds- Playing0
Loading sounds…

Master

The volume, pan and limiter every sound passes through.

The meter taps getMasterOutput() with an AnalyserNode. Turn the limiter off, then fire twelve lasers at once: that crackle is clipping.

Sprites

One 30 second file, eight regions. Each pad plays a slice of the same buffer.

Overlap

With overlap: true every click starts a new instance instead of restarting the sound.

0 playing, at most 16: the lasers group has maxInstances: 16.

Player

Transport, fades, mute, seeking and playback rate on one buffered sound.

music.mp3 stopped
0:00 0:00

Times are positions in the file at any rate. Mute, stop and play again: it stays muted until you unmute.

Groups

Both beds play into one ambience group, which gives them its options: looping at volume 0.4.

In the group: empty

Ducking

duck('music', { when: 'announcer' }) turns the music down while the announcer speaks and brings it back after.

Music at 100% of its own volume.

Variations

One name, three takes. play('hit') never repeats the last take and spreads the pitch by ±8%.

Last take: none yet

Interface sounds

Twelve sounds from soundhub/ui, rendered in the browser. None of them is a file.

Spatial audio

A helicopter on a 3D panner, seen from above. Drag it around you. Headphones help.

front

Position 3.0, 0, -4.0. Turning around moves you, not the helicopter: same panner, other end.

Stream

Loaded with loadStream: the browser fetches while it plays, so an hour long file costs little memory.

podcast stopped
0:00 0:00

Playing puts it on the lock screen with setMediaSession, so media keys work too.

Deferred loading

Registered with registerSound but not fetched. The first click loads the file, then plays it.

Formats this browser plays: -

Event log

Every event the library dispatches, newest first.

  1. Nothing yet. Play something.