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, name="envelope", color="#f97316", fill="tozeroy"),
    ],
    layout={"title": {"text": "Audio + envelope"}, "height": 520},
)

If series(..., time=None) is plotted next to audio, plotwave infers its time axis automatically when the audio timing is unambiguous.

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.0.tar.gz (3.0 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.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: plotwave-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 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.0.tar.gz
Algorithm Hash digest
SHA256 a5bde1947f589d40437502f96600d578a2a81ad5b38d4d8367a5ee88079fa10c
MD5 4cae886101a701c16c94b9860f38c271
BLAKE2b-256 73b27982362cd1f4e8c27a703d6cbdab6c9a8faded37ada1405538a0d0278598

See more details on using hashes here.

File details

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

File metadata

  • Download URL: plotwave-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ed97addd570ddad43c65dd9416d7f5213eef575190768d66e9ff0ac943c3c6b
MD5 3a07880e78dbc1a3d40ef428f7b97900
BLAKE2b-256 0e8eee3d505b83a08c094cccc2b97e132aec6884ed4c5336868c80449cdc7071

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