Skip to main content

Interactive audio and waveform plotting for notebooks and browsers.

Project description

plotwave

plotwave logo

Interactive Plotly waveforms with synchronized audio playback

Live interactive demo

Click anywhere in the waveform to hear the audio while inspecting it visually.
Overlay multiple audio tracks or add additional signals (labels, predictions, segmentation, scores) on top of the waveform.

Designed for Jupyter notebooks, plotwave can also be exported to HTML, making it easy to share interactive audio visualizations or log them in tools like MLflow for experiment analysis.

Install

uv add plotwave

or

pip install plotwave

Smallest useful example

import soundfile as sf
import plotwave

wav, sr = sf.read("wave.wav", always_2d=False)

plotwave.plot(wav, sr=sr, name="voice")

soundfile is only used here as a convenient audio loader. plotwave itself only depends on numpy.

Audio + curve

env = np.abs(wav)

plotwave.plot(
    [
        plotwave.audio(wav, sr, name="audio", color="#2563eb"),
        plotwave.series(env, sr=sr, name="envelope", color="#f97316", fill="tozeroy"),
    ],
    layout={"title": {"text": "Audio + envelope"}, "height": 520},
)

For series(...), use:

  • sr=... when your values are evenly sampled
  • time=... when you already have an explicit time axis

Segments

plotwave.plot(
    [
        plotwave.audio(wav, sr, name="audio"),
        plotwave.segments(
            [
                {"start": 0.0, "end": 0.7, "label": "Bm"},
                {"start": 1.0, "end": 1.6, "label": "G"},
            ],
            name="Pred",
            lane="top",
            color_map={"Bm": "#2563eb", "G": "#16a34a"},
        ),
    ]
)

segments(...) adds:

  • colored background blocks
  • label boxes
  • hoverable segment names
  • top/bottom lanes for comparisons like prediction vs ground truth

Export

plot = plotwave.plot(wav, sr=sr)
plot.save("wave.html")
html = plot.html()

API

Public API:

  • plotwave.plot(...)
  • plotwave.audio(...)
  • plotwave.series(...)
  • plotwave.segments(...)
  • plotwave.Plot

See examples/getting_started.ipynb for a full walkthrough.

Developer workflow: DEVELOPERS.md

To refresh the GitHub Pages demo locally:

uv run python scripts/build_pages_demo.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotwave-0.1.1.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plotwave-0.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file plotwave-0.1.1.tar.gz.

File metadata

  • Download URL: plotwave-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","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}

File hashes

Hashes for plotwave-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d838f5e1d72fca144ad3982dfacae9c3339a530eccb7984649ae5114cd1a2831
MD5 26bf5609745bc1b0bfec569f3187dd9a
BLAKE2b-256 d6653f7cd2fb9195cc64b9ac7bd44af8f55fb4014801bafb3cabdb1f948817fd

See more details on using hashes here.

File details

Details for the file plotwave-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: plotwave-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","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}

File hashes

Hashes for plotwave-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f631cbe36038d017f58cb43d966c888e59b373ee22a34f99e137d58ee778b71e
MD5 1d0b4d1f24cf6ab2c15576a494b5c0dd
BLAKE2b-256 e66add5682bfba20e2ccd98a0d34e67c1a42c95ddd37baf8b6a7c08f25c5157d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page