plotwave 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plotwave-0.1.0/.github/workflows/pages.yml +53 -0
- plotwave-0.1.0/.gitignore +12 -0
- plotwave-0.1.0/DEVELOPERS.md +62 -0
- plotwave-0.1.0/LICENSE +21 -0
- plotwave-0.1.0/PKG-INFO +135 -0
- plotwave-0.1.0/README.md +112 -0
- plotwave-0.1.0/assets/logo_name.png +0 -0
- plotwave-0.1.0/assets/logo_name_black.png +0 -0
- plotwave-0.1.0/assets/logo_name_transparent.png +0 -0
- plotwave-0.1.0/assets/logo_name_white.png +0 -0
- plotwave-0.1.0/assets/logo_simple.png +0 -0
- plotwave-0.1.0/assets/logo_simple_transparent.png +0 -0
- plotwave-0.1.0/docs/apple-touch-icon.png +0 -0
- plotwave-0.1.0/docs/assets/logo_name_black.png +0 -0
- plotwave-0.1.0/docs/demo.html +379 -0
- plotwave-0.1.0/docs/favicon/apple-touch-icon.png +0 -0
- plotwave-0.1.0/docs/favicon/favicon-96x96.png +0 -0
- plotwave-0.1.0/docs/favicon/favicon.ico +0 -0
- plotwave-0.1.0/docs/favicon/favicon.svg +1 -0
- plotwave-0.1.0/docs/favicon/site.webmanifest +21 -0
- plotwave-0.1.0/docs/favicon/web-app-manifest-192x192.png +0 -0
- plotwave-0.1.0/docs/favicon/web-app-manifest-512x512.png +0 -0
- plotwave-0.1.0/docs/favicon-96x96.png +0 -0
- plotwave-0.1.0/docs/favicon.ico +0 -0
- plotwave-0.1.0/docs/favicon.svg +1 -0
- plotwave-0.1.0/docs/index.html +266 -0
- plotwave-0.1.0/docs/site.webmanifest +21 -0
- plotwave-0.1.0/docs/web-app-manifest-192x192.png +0 -0
- plotwave-0.1.0/docs/web-app-manifest-512x512.png +0 -0
- plotwave-0.1.0/examples/__init__.py +1 -0
- plotwave-0.1.0/examples/getting_started.ipynb +396 -0
- plotwave-0.1.0/examples/progression_pred_vs_label.html +180 -0
- plotwave-0.1.0/examples/signal_helpers.py +106 -0
- plotwave-0.1.0/pyproject.toml +64 -0
- plotwave-0.1.0/scripts/build_pages_demo.py +420 -0
- plotwave-0.1.0/src/plotwave/__init__.py +25 -0
- plotwave-0.1.0/src/plotwave/_core.py +881 -0
- plotwave-0.1.0/src/plotwave/_render.py +464 -0
- plotwave-0.1.0/src/plotwave/py.typed +1 -0
- plotwave-0.1.0/tests/test_api.py +284 -0
- plotwave-0.1.0/uv.lock +2007 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Publish GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: pages
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v5
|
|
26
|
+
|
|
27
|
+
- name: Set up Python
|
|
28
|
+
run: uv python install 3.11
|
|
29
|
+
|
|
30
|
+
- name: Sync dependencies
|
|
31
|
+
run: uv sync --all-groups
|
|
32
|
+
|
|
33
|
+
- name: Build demo site
|
|
34
|
+
run: uv run python scripts/build_pages_demo.py
|
|
35
|
+
|
|
36
|
+
- name: Configure Pages
|
|
37
|
+
uses: actions/configure-pages@v5
|
|
38
|
+
|
|
39
|
+
- name: Upload artifact
|
|
40
|
+
uses: actions/upload-pages-artifact@v3
|
|
41
|
+
with:
|
|
42
|
+
path: docs
|
|
43
|
+
|
|
44
|
+
deploy:
|
|
45
|
+
environment:
|
|
46
|
+
name: github-pages
|
|
47
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
needs: build
|
|
50
|
+
steps:
|
|
51
|
+
- name: Deploy to GitHub Pages
|
|
52
|
+
id: deployment
|
|
53
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Developer Guide
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
From the project root:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv sync --all-groups
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Main Commands
|
|
12
|
+
|
|
13
|
+
Run the test suite:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv run pytest
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Run lint:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv run ruff check .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Run type-checking:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv run mypy src
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Run the example notebook:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv run jupyter lab
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Build the package:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
uv build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Typical Dev Loop
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv run pytest
|
|
47
|
+
uv run ruff check .
|
|
48
|
+
uv run mypy src
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Project Layout
|
|
52
|
+
|
|
53
|
+
- `src/plotwave/`: library code
|
|
54
|
+
- `tests/`: automated tests
|
|
55
|
+
- `examples/getting_started.ipynb`: user-facing notebook walkthrough
|
|
56
|
+
- `examples/signal_helpers.py`: helper signals used by the examples
|
|
57
|
+
|
|
58
|
+
## Notes
|
|
59
|
+
|
|
60
|
+
- The package is installable with both `uv` and `pip`.
|
|
61
|
+
- The notebook examples are meant for users; keep them focused on the public API.
|
|
62
|
+
- If you change rendering or public behavior, update tests and the example notebook together.
|
plotwave-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Camil Ziane
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
plotwave-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: plotwave
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Interactive audio and waveform plotting for notebooks and browsers.
|
|
5
|
+
Project-URL: Homepage, https://github.com/camilziane/plotwave
|
|
6
|
+
Project-URL: Repository, https://github.com/camilziane/plotwave
|
|
7
|
+
Author: Camil Ziane
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: audio,jupyter,plotly,visualization,waveform
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: numpy>=1.26
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# plotwave
|
|
25
|
+
<p align="left">
|
|
26
|
+
<img src="https://raw.githubusercontent.com/camilziane/plotwave/main/assets/logo_name.png" alt="plotwave logo" width="200">
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<p align="left">
|
|
30
|
+
Interactive Plotly waveforms with synchronized audio playback
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<p align="left">
|
|
34
|
+
<a href="https://camilziane.github.io/plotwave/">Live interactive demo</a>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
**Click anywhere in the waveform to hear the audio while inspecting it visually.
|
|
38
|
+
Overlay multiple audio tracks or add additional signals (labels, predictions, segmentation, scores) on top of the waveform.**
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uv add plotwave
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
or
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install plotwave
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Smallest useful example
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import soundfile as sf
|
|
58
|
+
import plotwave
|
|
59
|
+
|
|
60
|
+
wav, sr = sf.read("wave.wav", always_2d=False)
|
|
61
|
+
|
|
62
|
+
plotwave.plot(wav, sr=sr, name="voice")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`soundfile` is only used here as a convenient audio loader. `plotwave` itself only depends on `numpy`.
|
|
66
|
+
|
|
67
|
+
## Audio + curve
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
env = np.abs(wav)
|
|
71
|
+
|
|
72
|
+
plotwave.plot(
|
|
73
|
+
[
|
|
74
|
+
plotwave.audio(wav, sr, name="audio", color="#2563eb"),
|
|
75
|
+
plotwave.series(env, name="envelope", color="#f97316", fill="tozeroy"),
|
|
76
|
+
],
|
|
77
|
+
layout={"title": {"text": "Audio + envelope"}, "height": 520},
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If `series(..., time=None)` is plotted next to audio, `plotwave` infers its time axis automatically when the audio timing is unambiguous.
|
|
82
|
+
|
|
83
|
+
## Segments
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
plotwave.plot(
|
|
87
|
+
[
|
|
88
|
+
plotwave.audio(wav, sr, name="audio"),
|
|
89
|
+
plotwave.segments(
|
|
90
|
+
[
|
|
91
|
+
{"start": 0.0, "end": 0.7, "label": "Bm"},
|
|
92
|
+
{"start": 1.0, "end": 1.6, "label": "G"},
|
|
93
|
+
],
|
|
94
|
+
name="Pred",
|
|
95
|
+
lane="top",
|
|
96
|
+
color_map={"Bm": "#2563eb", "G": "#16a34a"},
|
|
97
|
+
),
|
|
98
|
+
]
|
|
99
|
+
)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`segments(...)` adds:
|
|
103
|
+
|
|
104
|
+
- colored background blocks
|
|
105
|
+
- label boxes
|
|
106
|
+
- hoverable segment names
|
|
107
|
+
- top/bottom lanes for comparisons like prediction vs ground truth
|
|
108
|
+
|
|
109
|
+
## Export
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
plot = plotwave.plot(wav, sr=sr)
|
|
113
|
+
plot.save("wave.html")
|
|
114
|
+
html = plot.html()
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## API
|
|
118
|
+
|
|
119
|
+
Public API:
|
|
120
|
+
|
|
121
|
+
- `plotwave.plot(...)`
|
|
122
|
+
- `plotwave.audio(...)`
|
|
123
|
+
- `plotwave.series(...)`
|
|
124
|
+
- `plotwave.segments(...)`
|
|
125
|
+
- `plotwave.Plot`
|
|
126
|
+
|
|
127
|
+
See [examples/getting_started.ipynb](https://github.com/camilziane/plotwave/blob/main/examples/getting_started.ipynb) for a full walkthrough.
|
|
128
|
+
|
|
129
|
+
Developer workflow: [DEVELOPERS.md](https://github.com/camilziane/plotwave/blob/main/DEVELOPERS.md)
|
|
130
|
+
|
|
131
|
+
To refresh the GitHub Pages demo locally:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
uv run python scripts/build_pages_demo.py
|
|
135
|
+
```
|
plotwave-0.1.0/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# plotwave
|
|
2
|
+
<p align="left">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/camilziane/plotwave/main/assets/logo_name.png" alt="plotwave logo" width="200">
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<p align="left">
|
|
7
|
+
Interactive Plotly waveforms with synchronized audio playback
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="left">
|
|
11
|
+
<a href="https://camilziane.github.io/plotwave/">Live interactive demo</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
**Click anywhere in the waveform to hear the audio while inspecting it visually.
|
|
15
|
+
Overlay multiple audio tracks or add additional signals (labels, predictions, segmentation, scores) on top of the waveform.**
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv add plotwave
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
or
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install plotwave
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Smallest useful example
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import soundfile as sf
|
|
35
|
+
import plotwave
|
|
36
|
+
|
|
37
|
+
wav, sr = sf.read("wave.wav", always_2d=False)
|
|
38
|
+
|
|
39
|
+
plotwave.plot(wav, sr=sr, name="voice")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`soundfile` is only used here as a convenient audio loader. `plotwave` itself only depends on `numpy`.
|
|
43
|
+
|
|
44
|
+
## Audio + curve
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
env = np.abs(wav)
|
|
48
|
+
|
|
49
|
+
plotwave.plot(
|
|
50
|
+
[
|
|
51
|
+
plotwave.audio(wav, sr, name="audio", color="#2563eb"),
|
|
52
|
+
plotwave.series(env, name="envelope", color="#f97316", fill="tozeroy"),
|
|
53
|
+
],
|
|
54
|
+
layout={"title": {"text": "Audio + envelope"}, "height": 520},
|
|
55
|
+
)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If `series(..., time=None)` is plotted next to audio, `plotwave` infers its time axis automatically when the audio timing is unambiguous.
|
|
59
|
+
|
|
60
|
+
## Segments
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
plotwave.plot(
|
|
64
|
+
[
|
|
65
|
+
plotwave.audio(wav, sr, name="audio"),
|
|
66
|
+
plotwave.segments(
|
|
67
|
+
[
|
|
68
|
+
{"start": 0.0, "end": 0.7, "label": "Bm"},
|
|
69
|
+
{"start": 1.0, "end": 1.6, "label": "G"},
|
|
70
|
+
],
|
|
71
|
+
name="Pred",
|
|
72
|
+
lane="top",
|
|
73
|
+
color_map={"Bm": "#2563eb", "G": "#16a34a"},
|
|
74
|
+
),
|
|
75
|
+
]
|
|
76
|
+
)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`segments(...)` adds:
|
|
80
|
+
|
|
81
|
+
- colored background blocks
|
|
82
|
+
- label boxes
|
|
83
|
+
- hoverable segment names
|
|
84
|
+
- top/bottom lanes for comparisons like prediction vs ground truth
|
|
85
|
+
|
|
86
|
+
## Export
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
plot = plotwave.plot(wav, sr=sr)
|
|
90
|
+
plot.save("wave.html")
|
|
91
|
+
html = plot.html()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## API
|
|
95
|
+
|
|
96
|
+
Public API:
|
|
97
|
+
|
|
98
|
+
- `plotwave.plot(...)`
|
|
99
|
+
- `plotwave.audio(...)`
|
|
100
|
+
- `plotwave.series(...)`
|
|
101
|
+
- `plotwave.segments(...)`
|
|
102
|
+
- `plotwave.Plot`
|
|
103
|
+
|
|
104
|
+
See [examples/getting_started.ipynb](https://github.com/camilziane/plotwave/blob/main/examples/getting_started.ipynb) for a full walkthrough.
|
|
105
|
+
|
|
106
|
+
Developer workflow: [DEVELOPERS.md](https://github.com/camilziane/plotwave/blob/main/DEVELOPERS.md)
|
|
107
|
+
|
|
108
|
+
To refresh the GitHub Pages demo locally:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
uv run python scripts/build_pages_demo.py
|
|
112
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|