Skip to main content

Installation

Package Manager​

Install the main package, the Tone.js engine it plays through by default, and the packages your own code imports from:

npm install @waveform-playlist/browser@next @waveform-playlist/playout@next @waveform-playlist/core@next tone @dnd-kit/react

If you already have React and styled-components in your project, you're ready to go!

Types and helpers come from @waveform-playlist/core​

@waveform-playlist/browser exports its own components, hooks and types and re-exports nothing from the other packages. The types of the data you pass in (ClipTrack, AudioClip, Fade, AnnotationData) and the helpers that build it (audioTrack, createTrack, createClipFromSeconds) are exports of @waveform-playlist/core, and the pages of this documentation import them from there:

import { WebAudioProvider, Waveform, useCreateArrangement } from '@waveform-playlist/browser';
import { audioTrack, type ClipTrack } from '@waveform-playlist/core';

@waveform-playlist/core is a dependency of @waveform-playlist/browser, so it is always installed with it. An import of it in your own code resolves under a package manager with a flat node_modules (npm) even when your project does not list it; under a strict one (pnpm) it does not. The install line above therefore names it. The same holds for @waveform-playlist/ui-components, also a dependency of browser, when you import from it (for example the TimeFormat type or useWaveformViewInfo), and for @waveform-playlist/engine when you import the Arrangement type (the object useCreateArrangement returns): add it to your project then. Keep all @waveform-playlist/* packages on the versions of one release, so that a single copy of each is installed.

Peer Dependencies​

Waveform Playlist requires the following peer dependencies:

PackageVersionPurpose
react^19.0.0UI framework
react-dom^19.0.0React DOM rendering
styled-components^6.0.0CSS-in-JS styling
tone^15.0.0Web Audio framework. An optional peer: needed for WebAudioProvider's default engine, not for MediaElementProvider or an adapter of your own
@waveform-playlist/playoutthe range browser declares as its peer (the two packages have their own version numbers)The Tone.js engine WebAudioProvider loads by default. An optional peer, so a package manager does not install it for you
@dnd-kit/react^0.5.0React bindings for drag and drop (includes @dnd-kit/dom and @dnd-kit/abstract)

Bundling without the Tone.js engine​

With MediaElementProvider or an adapter of your own, install neither tone nor @waveform-playlist/playout. For the MediaElement provider:

npm install @waveform-playlist/browser@next @waveform-playlist/media-element-playout@next @dnd-kit/react

@waveform-playlist/browser's build still contains an import() of each engine, so some tools ask for the one you did not install (#892). Vite builds as it is. esbuild stops with Could not resolve "@waveform-playlist/playout" until you mark it external (--external:@waveform-playlist/playout, or external: ['@waveform-playlist/playout']); with an adapter of your own and no media-element-playout, mark @waveform-playlist/media-element-playout external as well. webpack 5 builds and prints a Module not found warning for each engine you did not install. TypeScript with skipLibCheck: false reports Cannot find module from browser's type declarations for each of them as well.

Which Tone.js version?​

npm install tone gives you the stable release (15.1.x). That is the default, and what the examples on this site run.

Tone.js also publishes a prerelease line, npm install tone@next (15.5.x), which is where its fixes land between the infrequent stable releases. Waveform Playlist supports both: every pull request is built and unit-tested against each. With tone@next, configureGlobalContext({ sampleRate }) from @waveform-playlist/playout is honoured on the default audio context; on 15.1.x the context keeps the hardware sample rate.

next is a moving tag, so pin an exact version if you use it.

Additional Packages​

Depending on your needs, you may want to install additional packages:

Annotations​

For time-synchronized annotations:

npm install @waveform-playlist/annotations@next

Give the provider an annotation store, and render AnnotationProvider above the view. Without the store there are no annotations; without AnnotationProvider the annotation boxes and the annotation list draw nothing:

import { useCreateAnnotationStore } from '@waveform-playlist/browser';
import { AnnotationProvider } from '@waveform-playlist/annotations';

const annotationStore = useCreateAnnotationStore(() => annotations);

<WebAudioProvider
arrangement={arrangement}
annotationStore={annotationStore}
annotationList={{ editable: true }}
>
<AnnotationProvider>
<Waveform />
</AnnotationProvider>
</WebAudioProvider>

Recording​

For microphone recording:

npm install @waveform-playlist/recording@next

This automatically installs @waveform-playlist/worklets, which provides the AudioWorklet processors for recording and VU metering. See the AudioWorklet setup guide for bundler configuration.

Use useIntegratedRecording inside a WebAudioProvider to combine mic access, recording, and track management:

import { useArrangement, useSelectedTrackId } from '@waveform-playlist/browser';
import { useIntegratedRecording } from '@waveform-playlist/recording';
import { SegmentedVUMeter } from '@waveform-playlist/ui-components';

function RecordingControls() {
const arrangement = useArrangement();
const { selectedTrackId } = useSelectedTrackId();
// The take is added to the arrangement's track: one undo step
const { isRecording, meter, startRecording, stopRecording, requestMicAccess } =
useIntegratedRecording(arrangement, selectedTrackId);

return (
<>
<button onClick={requestMicAccess}>Enable Mic</button>
<button onClick={isRecording ? stopRecording : startRecording}>
{isRecording ? 'Stop' : 'Record'}
</button>
<SegmentedVUMeter meter={meter} />
</>
);
}

<WebAudioProvider arrangement={arrangement}>
<RecordingControls />
<Waveform />
</WebAudioProvider>

Spectrogram​

For spectrogram visualization (FFT computation, worker-based rendering, color maps):

npm install @waveform-playlist/spectrogram@next

Put SpectrogramProvider inside WebAudioProvider, around the view, to enable spectrogram features:

import { SpectrogramProvider } from '@waveform-playlist/spectrogram';

<WebAudioProvider arrangement={arrangement}>
<SpectrogramProvider config={spectrogramConfig} colorMap="viridis">
<Waveform />
</SpectrogramProvider>
</WebAudioProvider>

TypeScript​

All packages include TypeScript definitions. No additional @types packages are needed.

Next Steps​