Streamlit Wavesurfer Component
Forked and extended from PiotrDabkowski/streamlit_wavesurfer
A powerful, extensible Streamlit component for interactive audio waveform visualization and annotation, powered by wavesurfer.js.
Features
- Customizable Waveform: Style the waveform and progress bar, set height, and more.
- Regions: Add, edit, and remove regions with callbacks to Python. Supports region metadata and color mapping with colormap.
- Keyboard Shortcuts: Nudge, play/pause, and and navigate regions with the keyboard for more for efficient annotation.
- Plugin System: Enable/disable wavesurfer.js plugins (regions, spectrogram, timeline, zoom, hover, minimap, overlay) with type-safe configuration from Python.
- Spectrogram View: Visualize audio frequency content (enable via plugin).
- Extensible: Add your own plugins or overlays via my other project wavesurfer-overlay-plugin.
- Numpy Audio Support: Load audio directly from numpy arrays or via popular python libs like librosa, pydub or soundfile.
- Type-Safe, Modern React Frontend: Built with Jotai, shadcn/ui, and TailwindCSS.
Quickstart
1. Install
pip install streamlit-wavesurfer
2. Basic Usage
import streamlit as st
from streamlit_wavesurfer import wavesurfer, Region
# Define regions
regions = [
Region(start=0, end=5, content="Intro"),
Region(start=5, end=10, content="Verse"),
]
# Display the waveform
wavesurfer(
audio_src="https://example.com/audio.mp3",
regions=regions,
plugins=["regions", "timeline", "zoom"], # Enable desired plugins
show_controls=True,
)
3. Advanced: Custom Plugin Configuration
from streamlit_wavesurfer import WaveSurferPluginConfiguration, OverlayPluginOptions
overlay_plugin = WaveSurferPluginConfiguration(
name="overlay",
options=OverlayPluginOptions(
imageUrl="https://example.com/overlay.png",
position="overlay",
opacity=0.5,
),
)
wavesurfer(
audio_src="https://example.com/audio.mp3",
plugins=[overlay_plugin, "regions", "timeline"],
)
Supported Plugins
regions: Mark and annotate audio segments.timeline: Show time notches and labels.zoom: Zoom in/out of the waveform.hover: Show time on hover.minimap: Scrollbar-style mini waveform.spectrogram: Frequency visualization.overlay: Overlay images on the waveform.
See the wavesurfer.js plugin docs for details.
API
wavesurfer(...)
| Argument | Type | Description |
|---|---|---|
audio_src |
str | URL or path to audio file (or base64/numpy, planned) |
regions |
list | List of Region or dicts |
plugins |
list | List of plugin names or WaveSurferPluginConfiguration |
wave_options |
object | Waveform display options |
region_colormap |
str | Colormap for region coloring |
show_controls |
bool | Show play/pause/skip controls |
key |
str | Streamlit component key |
Returns:
- The current state, including regions and last update timestamp.
Region
Region(start: float, end: float, content: str, id: Optional[str] = None, color: Optional[str] = None)
🛠️ Development
- Frontend: React, TypeScript, Jotai, shadcn/ui, TailwindCSS
- Backend: Python, Streamlit
- Package manager: bun (not npm)
Build Frontend
cd streamlit_wavesurfer/frontend
bun install
bun run build
Run Example App
streamlit run streamlit_wavesurfer/__init__.py
Known Issues / TODO
- Allow skipping to region/time from Python
- Load audio from numpy arrays
- Region validation from Python
- Keyboard shortcuts require initial button press
See wavesurfer.js docs and Streamlit docs for more.
Contributions welcome!
LICENSE MIT
© 2025 Liam Power
Metadata
Release files for streamlit_wavesurfer 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| streamlit_wavesurfer-0.6.0.tar.gz | 119.3 kB | Without provenance | Details for streamlit_wavesurfer-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| streamlit_wavesurfer-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for streamlit_wavesurfer-0.6.0-py3-none-any.whl |
Total release size: 238.0 kB
Release files / streamlit_wavesurfer-0.6.0.tar.gz
| Download URL | streamlit_wavesurfer-0.6.0.tar.gz |
|---|---|
| Size | 119.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd2f40bc563bb8b0c217089a4ebbb7c7251fc29886c4bf8928cf02881a694f62
|
|
BLAKE2b-256 checksum How to use checksums |
b641ef8d4ba12e29e3e2af34a4d7027bc84d298d93c278bceec765622af17e7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / streamlit_wavesurfer-0.6.0-py3-none-any.whl
| Download URL | streamlit_wavesurfer-0.6.0-py3-none-any.whl |
|---|---|
| Size | 118.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02837f879fad056be6b89cc7ba106470fd482d1dfc9b61dfb6fe9db89b09ab11
|
|
BLAKE2b-256 checksum How to use checksums |
0ad11461290a6360747caffb8e86c4f13a474a27103082c3754139f0f42e1100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for streamlit_wavesurfer 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.