Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsJul 3, 2026·3 min de lectura

Wavesurfer.js — Interactive Audio Waveform Visualization

A customizable audio waveform visualization library built on the Web Audio API and HTML5 Canvas that provides navigable, zoomable waveforms with plugin support.

Listo para agents

Instalación con revisión previa

Este activo requiere revisión. El prompt copiado pide dry-run, muestra escrituras y continúa solo tras confirmación.

Needs Confirmation · 66/100Política: confirmar
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Wavesurfer.js Overview
Comando con revisión previa
npx -y tokrepo@latest install 1181f36c-7706-11f1-9bc6-00163e2b0d79 --target codex

Primero dry-run, confirma las escrituras y luego ejecuta este comando.

Introduction

Wavesurfer.js renders navigable audio waveforms directly in the browser using the Web Audio API for decoding and HTML5 Canvas for drawing. It lets users see the shape of audio content, click to seek, zoom in for detail, and add region markers or annotations, making it popular in podcast editors, music apps, and transcription tools.

What Wavesurfer.js Does

  • Renders audio waveforms from any browser-supported audio format
  • Provides click-to-seek and drag-to-scroll navigation on the waveform
  • Supports zoom and responsive resizing of the waveform display
  • Offers a plugin system for regions, timeline, spectrogram, and minimap
  • Handles pre-computed peaks data for server-rendered waveforms

Architecture Overview

Wavesurfer.js decodes audio using the Web Audio API's AudioContext.decodeAudioData method, extracting PCM sample data for waveform rendering. The peaks are downsampled to match the canvas width and drawn as vertical bars or continuous lines. Playback progress is tracked via requestAnimationFrame, updating the progress overlay in real time. The plugin architecture uses an event emitter pattern, allowing extensions like Regions and Timeline to hook into lifecycle events without modifying the core.

Self-Hosting & Configuration

  • Install via npm and import, or load from a CDN
  • Set container to a CSS selector or DOM element for the waveform target
  • Customize colors with waveColor, progressColor, and cursorColor
  • Pass peaks and duration to skip client-side audio decoding for large files
  • Use the Regions plugin for annotating and looping specific audio segments

Key Features

  • Real-time waveform rendering with Web Audio API decoding
  • Interactive seeking, scrolling, and zooming
  • Region markers for annotation, looping, and segment editing
  • Spectrogram and minimap visualization plugins
  • Server-side peak pre-computation for instant rendering of large files

Comparison with Similar Tools

  • Peaks.js — BBC-maintained with similar features; Wavesurfer.js has broader plugin ecosystem
  • Howler.js — audio playback library without visualization; Wavesurfer.js combines both
  • Tone.js — synthesis and effects framework; Wavesurfer.js focuses on visualization and playback
  • Amplitude.js — playlist management with UI; Wavesurfer.js provides detailed waveform control

FAQ

Q: Can I render waveforms without playing the audio? A: Yes. Pass pre-computed peaks data and the waveform renders instantly without decoding the audio file.

Q: Does it support live audio or streaming? A: Wavesurfer.js supports the MediaElement backend for streaming audio and live microphone input via plugins.

Q: How do I add loop regions? A: Import the Regions plugin, call wavesurfer.registerPlugin(RegionsPlugin.create()), then add regions with start and end times.

Q: What audio formats are supported? A: Any format the browser's Web Audio API can decode, typically MP3, WAV, OGG, FLAC, and AAC.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados