Prerequisites
Before you begin, make sure you have:- Node.js 16+ installed
- A React 18+ or React 19 project
- Basic knowledge of React hooks
Installation
Install the package
Install the main browser package along with required peer dependencies:
The peer dependencies are required:
- tone (^15.0.0) - Audio engine powered by Tone.js
- @dnd-kit/core and @dnd-kit/modifiers - Drag-and-drop functionality
- react and react-dom (^18.2.0 || ^19.0.0)
- styled-components (^6.0.0) - Styling
Create a basic player component
Create a new component file (e.g.,
AudioPlayer.tsx) with the following code:What’s Next?
Now that you have a basic player running, explore more features:Load multiple tracks
Learn how to load and manage multiple audio tracks
Add effects
Apply 20+ audio effects powered by Tone.js
Enable recording
Record audio directly in the browser
Add annotations
Add time-synced text annotations
Using with useAudioTracks
For a more robust loading approach with error handling and loading states, use the useAudioTracks hook:
Customizing the Waveform
You can customize the appearance of the waveform using theme props:Adding Zoom Controls
Add zoom in/out buttons to navigate long audio files:Troubleshooting
Waveform not rendering
Waveform not rendering
Make sure you have:
- Installed all peer dependencies (
tone,@dnd-kit/core,@dnd-kit/modifiers,styled-components) - Wrapped components in
WaveformPlaylistProvider - Provided valid
tracksprop to the provider
Audio not playing
Audio not playing
Check that:
- Your audio file path is correct
- The audio file format is supported by your browser
- There are no CORS issues (audio file must be served from same origin or have CORS headers)
- AudioContext is resumed (modern browsers require user interaction before playing audio)
TypeScript errors
TypeScript errors
If you’re using TypeScript, make sure you have the type definitions installed. They’re included with the package, but you may need to add
"moduleResolution": "node" to your tsconfig.json.Next Steps
Core concepts
Understand how Waveform Playlist works
API reference
Explore the complete API
View examples
See live examples and demos
GitHub
View source code and contribute