whatisgithub

What is wavesurfer.js?

katspaugh/wavesurfer.js — explained in plain English

Analysis updated 2026-06-24

10,231TypeScriptAudience · developerComplexity · 2/5Setup · easy

In one sentence

Wavesurfer.js is a JavaScript library that renders a clickable, scrollable audio waveform on a web page and handles audio playback entirely in the browser, no server processing, just drop it in and point it at an audio file.

Mindmap

mindmap
  root((wavesurfer.js))
    What it does
      Draws audio waveform
      In-browser playback
      Click to seek
    Official plugins
      Regions markers
      Timeline labels
      Minimap overview
      Microphone recording
    Technical notes
      Web Audio API
      Shadow DOM styling
      CSS part selector
    Limitations
      Large file memory
      Cross-origin needs CORS
      Streaming needs pre-data
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add a clickable waveform to a podcast or music player so visitors can visually scrub to any point in the audio.

USE CASE 2

Build an audio annotation tool where editors drag to mark regions of a recording and read back the start and end timestamps.

USE CASE 3

Record audio from the user's microphone in the browser and immediately display the waveform using the recording plugin.

What is it built with?

TypeScriptJavaScript

How does it compare?

katspaugh/wavesurfer.jsraineorshine/npm-check-updatescookpete/react-player
Stars10,23110,23110,234
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasyeasy
Complexity2/51/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Audio files hosted on a different domain require CORS headers on that server, there is no JavaScript workaround if those headers are missing.

So what is it?

Wavesurfer.js is a JavaScript and TypeScript library that draws audio waveforms on a web page and lets visitors play back audio files. You drop it into a website, point it at an audio file, and it renders a scrollable, clickable waveform in the browser. Clicking anywhere on the waveform seeks to that point in the audio. The library handles all the decoding and rendering internally using the browser's built-in Web Audio capabilities, so there is no server processing involved. The library ships with an official plugin system that covers common needs without extra dependencies. The Regions plugin lets you mark off sections of an audio clip with colored overlays. The Timeline plugin adds time labels below the waveform. The Minimap plugin shows a small overview waveform that acts as a scrollbar when the main waveform is zoomed in. There are also plugins for recording audio from a microphone, showing a frequency spectrogram, and drawing fade-in and fade-out volume curves directly on the waveform. Styling is handled through standard CSS. The waveform renders inside a Shadow DOM tree, which keeps its styles from clashing with the rest of your page. You can still reach individual parts of the waveform, such as the cursor or region markers, using a CSS feature called the part selector. A few practical limits are worth knowing. The library decodes audio entirely in the browser, so very large audio files can run into memory problems. For long files, the README recommends supplying pre-computed waveform data rather than asking the browser to decode the full file. Streaming audio is also only supported when you supply that pre-computed data and the total duration upfront. Audio files hosted on a different domain require that domain to allow cross-origin requests, there is no workaround from the JavaScript side. Installation is via npm or a script tag. TypeScript type definitions are bundled with the package, so no separate type install is needed.

Copy-paste prompts

Prompt 1
Show me the JavaScript to initialize Wavesurfer.js on a div, load an MP3 file, and start playing it when a button is clicked.
Prompt 2
How do I use the Wavesurfer.js Regions plugin to let users drag-select a segment of audio and then read back the start and end times?
Prompt 3
My audio file is very long and causes memory issues with Wavesurfer.js, how do I pass in pre-computed waveform peak data instead of making the browser decode the whole file?
Prompt 4
How do I change the waveform color and cursor style in Wavesurfer.js without breaking its Shadow DOM encapsulation?

Frequently asked questions

What is wavesurfer.js?

Wavesurfer.js is a JavaScript library that renders a clickable, scrollable audio waveform on a web page and handles audio playback entirely in the browser, no server processing, just drop it in and point it at an audio file.

What language is wavesurfer.js written in?

Mainly TypeScript. The stack also includes TypeScript, JavaScript.

How hard is wavesurfer.js to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is wavesurfer.js for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.