plotwave 0.1.1__tar.gz → 0.1.2__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.
Files changed (41) hide show
  1. {plotwave-0.1.1 → plotwave-0.1.2}/.gitignore +5 -1
  2. {plotwave-0.1.1 → plotwave-0.1.2}/PKG-INFO +37 -11
  3. {plotwave-0.1.1 → plotwave-0.1.2}/README.md +35 -10
  4. plotwave-0.1.2/examples/getting_started.ipynb +3977 -0
  5. plotwave-0.1.2/examples/plotwave_C_VHS.wav +0 -0
  6. plotwave-0.1.2/examples/plotwave_C_piano.wav +0 -0
  7. {plotwave-0.1.1 → plotwave-0.1.2}/pyproject.toml +13 -2
  8. plotwave-0.1.2/scripts/build_pages_demo.py +729 -0
  9. {plotwave-0.1.1 → plotwave-0.1.2}/src/plotwave/__init__.py +5 -1
  10. plotwave-0.1.2/src/plotwave/_core.py +2075 -0
  11. plotwave-0.1.2/src/plotwave/_render.py +990 -0
  12. plotwave-0.1.2/tests/test_api.py +947 -0
  13. plotwave-0.1.1/.github/workflows/pages.yml +0 -53
  14. plotwave-0.1.1/assets/logo_name.png +0 -0
  15. plotwave-0.1.1/assets/logo_name_black.png +0 -0
  16. plotwave-0.1.1/assets/logo_name_transparent.png +0 -0
  17. plotwave-0.1.1/assets/logo_name_white.png +0 -0
  18. plotwave-0.1.1/assets/logo_simple.png +0 -0
  19. plotwave-0.1.1/assets/logo_simple_transparent.png +0 -0
  20. plotwave-0.1.1/docs/assets/logo_name_black.png +0 -0
  21. plotwave-0.1.1/docs/demo.html +0 -379
  22. plotwave-0.1.1/docs/favicon/apple-touch-icon.png +0 -0
  23. plotwave-0.1.1/docs/favicon/favicon-96x96.png +0 -0
  24. plotwave-0.1.1/docs/favicon/favicon.ico +0 -0
  25. plotwave-0.1.1/docs/favicon/favicon.svg +0 -1
  26. plotwave-0.1.1/docs/favicon/site.webmanifest +0 -21
  27. plotwave-0.1.1/docs/favicon/web-app-manifest-192x192.png +0 -0
  28. plotwave-0.1.1/docs/favicon/web-app-manifest-512x512.png +0 -0
  29. plotwave-0.1.1/docs/index.html +0 -266
  30. plotwave-0.1.1/examples/getting_started.ipynb +0 -396
  31. plotwave-0.1.1/examples/progression_pred_vs_label.html +0 -180
  32. plotwave-0.1.1/scripts/build_pages_demo.py +0 -420
  33. plotwave-0.1.1/src/plotwave/_core.py +0 -870
  34. plotwave-0.1.1/src/plotwave/_render.py +0 -555
  35. plotwave-0.1.1/tests/test_api.py +0 -298
  36. plotwave-0.1.1/uv.lock +0 -2072
  37. {plotwave-0.1.1 → plotwave-0.1.2}/DEVELOPERS.md +0 -0
  38. {plotwave-0.1.1 → plotwave-0.1.2}/LICENSE +0 -0
  39. {plotwave-0.1.1 → plotwave-0.1.2}/examples/__init__.py +0 -0
  40. {plotwave-0.1.1 → plotwave-0.1.2}/examples/signal_helpers.py +0 -0
  41. {plotwave-0.1.1 → plotwave-0.1.2}/src/plotwave/py.typed +0 -0
@@ -10,4 +10,8 @@ dist/
10
10
  build/
11
11
  notebooks/*.html
12
12
  notebook_test
13
-
13
+ plotwave-assets/
14
+ docs/*.png
15
+ docs/*.svg
16
+ docs/*.ico
17
+ docs/*.webmanifest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotwave
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Interactive audio and waveform plotting for notebooks and browsers.
5
5
  Project-URL: Homepage, https://github.com/camilziane/plotwave
6
6
  Project-URL: Repository, https://github.com/camilziane/plotwave
@@ -20,6 +20,7 @@ Classifier: Topic :: Scientific/Engineering :: Visualization
20
20
  Requires-Python: >=3.11
21
21
  Requires-Dist: lameenc>=1.8.2
22
22
  Requires-Dist: numpy>=1.26
23
+ Requires-Dist: soundfile>=0.12.1
23
24
  Description-Content-Type: text/markdown
24
25
 
25
26
  # plotwave
@@ -40,6 +41,14 @@ Overlay multiple audio tracks or add additional signals (labels, predictions, se
40
41
 
41
42
  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.
42
43
 
44
+ ## Why plotwave
45
+
46
+ - Start from a path with `plotwave.audio_file(...)` and get an interactive waveform without manually decoding audio first.
47
+ - Click anywhere in the waveform to audition the exact moment you are inspecting.
48
+ - Click a segment label to loop that labeled region and compare it against the waveform.
49
+ - Overlay predictions, envelopes, scores, or ground-truth labels on the same timeline.
50
+ - Use the same interaction model in notebooks and exported HTML.
51
+
43
52
  ## Install
44
53
 
45
54
  ```bash
@@ -52,27 +61,32 @@ or
52
61
  pip install plotwave
53
62
  ```
54
63
 
55
- ## Smallest useful example
64
+ ## Direct audio file example
56
65
 
57
66
  ```python
58
- import soundfile as sf
59
67
  import plotwave
60
68
 
61
- wav, sr = sf.read("wave.wav", always_2d=False)
62
-
63
- plotwave.plot(wav, sr=sr, name="voice")
69
+ plotwave.audio_file("voice.mp3", name="voice").plot(
70
+ layout={"title": {"text": "Direct file-backed audio"}, "height": 460},
71
+ )
64
72
  ```
65
73
 
66
- `soundfile` is only used here as a convenient audio loader. `plotwave` itself only depends on `numpy`.
74
+ `plotwave.audio_file(...)` uses `soundfile` internally and can open any local audio format that your `soundfile` backend supports, including WAV and MP3. It is the quickest way to go from a local audio file to an interactive player + waveform view.
75
+ Use `soundfile.read(...)` only when you want to derive an extra trace from the samples, like an envelope or model scores.
67
76
 
68
77
  ## Audio + curve
69
78
 
70
79
  ```python
80
+ import numpy as np
81
+ import soundfile as sf
82
+ import plotwave
83
+
84
+ wav, sr = sf.read("voice.mp3", always_2d=False)
71
85
  env = np.abs(wav)
72
86
 
73
87
  plotwave.plot(
74
88
  [
75
- plotwave.audio(wav, sr, name="audio", color="#2563eb"),
89
+ plotwave.audio_file("voice.mp3", name="audio", color="#2563eb"),
76
90
  plotwave.series(env, sr=sr, name="envelope", color="#f97316", fill="tozeroy"),
77
91
  ],
78
92
  layout={"title": {"text": "Audio + envelope"}, "height": 520},
@@ -84,12 +98,14 @@ For `series(...)`, use:
84
98
  - `sr=...` when your values are evenly sampled
85
99
  - `time=...` when you already have an explicit time axis
86
100
 
87
- ## Segments
101
+ ## Segments and label looping
88
102
 
89
103
  ```python
104
+ import plotwave
105
+
90
106
  plotwave.plot(
91
107
  [
92
- plotwave.audio(wav, sr, name="audio"),
108
+ plotwave.audio_file("song.mp3", name="audio"),
93
109
  plotwave.segments(
94
110
  [
95
111
  {"start": 0.0, "end": 0.7, "label": "Bm"},
@@ -105,8 +121,8 @@ plotwave.plot(
105
121
 
106
122
  `segments(...)` adds:
107
123
 
124
+ - clickable label boxes that loop the matching audio span
108
125
  - colored background blocks
109
- - label boxes
110
126
  - hoverable segment names
111
127
  - top/bottom lanes for comparisons like prediction vs ground truth
112
128
 
@@ -118,16 +134,26 @@ plot.save("wave.html")
118
134
  html = plot.html()
119
135
  ```
120
136
 
137
+ By default, notebook output, `html()`, and `save()` use compressed audio. You can disable that and control the bitrate explicitly:
138
+
139
+ ```python
140
+ plot = plotwave.audio_file("voice.mp3").plot(compress_audio=False)
141
+ html = plot.html(compress_audio=True, bitrate="48k")
142
+ ```
143
+
121
144
  ## API
122
145
 
123
146
  Public API:
124
147
 
125
148
  - `plotwave.plot(...)`
126
149
  - `plotwave.audio(...)`
150
+ - `plotwave.audio_file(...)`
127
151
  - `plotwave.series(...)`
128
152
  - `plotwave.segments(...)`
129
153
  - `plotwave.Plot`
130
154
 
155
+ All trace types also have `trace.plot(...)` as a shortcut for `plotwave.plot(trace, ...)`.
156
+
131
157
  See [examples/getting_started.ipynb](https://github.com/camilziane/plotwave/blob/main/examples/getting_started.ipynb) for a full walkthrough.
132
158
 
133
159
  Developer workflow: [DEVELOPERS.md](https://github.com/camilziane/plotwave/blob/main/DEVELOPERS.md)
@@ -16,6 +16,14 @@ Overlay multiple audio tracks or add additional signals (labels, predictions, se
16
16
 
17
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
18
 
19
+ ## Why plotwave
20
+
21
+ - Start from a path with `plotwave.audio_file(...)` and get an interactive waveform without manually decoding audio first.
22
+ - Click anywhere in the waveform to audition the exact moment you are inspecting.
23
+ - Click a segment label to loop that labeled region and compare it against the waveform.
24
+ - Overlay predictions, envelopes, scores, or ground-truth labels on the same timeline.
25
+ - Use the same interaction model in notebooks and exported HTML.
26
+
19
27
  ## Install
20
28
 
21
29
  ```bash
@@ -28,27 +36,32 @@ or
28
36
  pip install plotwave
29
37
  ```
30
38
 
31
- ## Smallest useful example
39
+ ## Direct audio file example
32
40
 
33
41
  ```python
34
- import soundfile as sf
35
42
  import plotwave
36
43
 
37
- wav, sr = sf.read("wave.wav", always_2d=False)
38
-
39
- plotwave.plot(wav, sr=sr, name="voice")
44
+ plotwave.audio_file("voice.mp3", name="voice").plot(
45
+ layout={"title": {"text": "Direct file-backed audio"}, "height": 460},
46
+ )
40
47
  ```
41
48
 
42
- `soundfile` is only used here as a convenient audio loader. `plotwave` itself only depends on `numpy`.
49
+ `plotwave.audio_file(...)` uses `soundfile` internally and can open any local audio format that your `soundfile` backend supports, including WAV and MP3. It is the quickest way to go from a local audio file to an interactive player + waveform view.
50
+ Use `soundfile.read(...)` only when you want to derive an extra trace from the samples, like an envelope or model scores.
43
51
 
44
52
  ## Audio + curve
45
53
 
46
54
  ```python
55
+ import numpy as np
56
+ import soundfile as sf
57
+ import plotwave
58
+
59
+ wav, sr = sf.read("voice.mp3", always_2d=False)
47
60
  env = np.abs(wav)
48
61
 
49
62
  plotwave.plot(
50
63
  [
51
- plotwave.audio(wav, sr, name="audio", color="#2563eb"),
64
+ plotwave.audio_file("voice.mp3", name="audio", color="#2563eb"),
52
65
  plotwave.series(env, sr=sr, name="envelope", color="#f97316", fill="tozeroy"),
53
66
  ],
54
67
  layout={"title": {"text": "Audio + envelope"}, "height": 520},
@@ -60,12 +73,14 @@ For `series(...)`, use:
60
73
  - `sr=...` when your values are evenly sampled
61
74
  - `time=...` when you already have an explicit time axis
62
75
 
63
- ## Segments
76
+ ## Segments and label looping
64
77
 
65
78
  ```python
79
+ import plotwave
80
+
66
81
  plotwave.plot(
67
82
  [
68
- plotwave.audio(wav, sr, name="audio"),
83
+ plotwave.audio_file("song.mp3", name="audio"),
69
84
  plotwave.segments(
70
85
  [
71
86
  {"start": 0.0, "end": 0.7, "label": "Bm"},
@@ -81,8 +96,8 @@ plotwave.plot(
81
96
 
82
97
  `segments(...)` adds:
83
98
 
99
+ - clickable label boxes that loop the matching audio span
84
100
  - colored background blocks
85
- - label boxes
86
101
  - hoverable segment names
87
102
  - top/bottom lanes for comparisons like prediction vs ground truth
88
103
 
@@ -94,16 +109,26 @@ plot.save("wave.html")
94
109
  html = plot.html()
95
110
  ```
96
111
 
112
+ By default, notebook output, `html()`, and `save()` use compressed audio. You can disable that and control the bitrate explicitly:
113
+
114
+ ```python
115
+ plot = plotwave.audio_file("voice.mp3").plot(compress_audio=False)
116
+ html = plot.html(compress_audio=True, bitrate="48k")
117
+ ```
118
+
97
119
  ## API
98
120
 
99
121
  Public API:
100
122
 
101
123
  - `plotwave.plot(...)`
102
124
  - `plotwave.audio(...)`
125
+ - `plotwave.audio_file(...)`
103
126
  - `plotwave.series(...)`
104
127
  - `plotwave.segments(...)`
105
128
  - `plotwave.Plot`
106
129
 
130
+ All trace types also have `trace.plot(...)` as a shortcut for `plotwave.plot(trace, ...)`.
131
+
107
132
  See [examples/getting_started.ipynb](https://github.com/camilziane/plotwave/blob/main/examples/getting_started.ipynb) for a full walkthrough.
108
133
 
109
134
  Developer workflow: [DEVELOPERS.md](https://github.com/camilziane/plotwave/blob/main/DEVELOPERS.md)