tovis 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.
Files changed (58) hide show
  1. tovis-0.1.0/LICENSE +21 -0
  2. tovis-0.1.0/MANIFEST.in +4 -0
  3. tovis-0.1.0/PKG-INFO +157 -0
  4. tovis-0.1.0/README.md +115 -0
  5. tovis-0.1.0/THIRD_PARTY_NOTICES.md +44 -0
  6. tovis-0.1.0/docs/source/_examples/introduction.py +22 -0
  7. tovis-0.1.0/docs/source/_static/.gitkeep +1 -0
  8. tovis-0.1.0/docs/source/_static/logo_tovis.png +0 -0
  9. tovis-0.1.0/docs/source/_templates/.gitkeep +1 -0
  10. tovis-0.1.0/docs/source/api.rst +55 -0
  11. tovis-0.1.0/docs/source/attribution.rst +25 -0
  12. tovis-0.1.0/docs/source/conf.py +33 -0
  13. tovis-0.1.0/docs/source/index.rst +31 -0
  14. tovis-0.1.0/docs/source/installation.rst +94 -0
  15. tovis-0.1.0/docs/source/introduction.rst +66 -0
  16. tovis-0.1.0/licenses/countem-upstream.txt +7 -0
  17. tovis-0.1.0/licenses/onsets-and-frames-MIT.txt +5 -0
  18. tovis-0.1.0/licenses/pytorch-stft-BSD-3-Clause.txt +27 -0
  19. tovis-0.1.0/pyproject.toml +59 -0
  20. tovis-0.1.0/setup.cfg +4 -0
  21. tovis-0.1.0/tests/test_public_api.py +37 -0
  22. tovis-0.1.0/tests/test_transcription_checkpoints.py +122 -0
  23. tovis-0.1.0/tovis/__init__.py +81 -0
  24. tovis-0.1.0/tovis/feature.py +501 -0
  25. tovis-0.1.0/tovis/scale.py +298 -0
  26. tovis-0.1.0/tovis/structure.py +690 -0
  27. tovis-0.1.0/tovis/transcription/__init__.py +21 -0
  28. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/__init__.py +0 -0
  29. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/data_loaders/__init__.py +2 -0
  30. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/data_loaders/hcqt_datasets.py +436 -0
  31. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/data_preprocessing/__init__.py +2 -0
  32. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/data_preprocessing/hcqt.py +272 -0
  33. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/metrics/__init__.py +2 -0
  34. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/metrics/eval_metrics.py +189 -0
  35. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/metrics/monitoring.py +63 -0
  36. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/nn_models/__init__.py +10 -0
  37. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/nn_models/basic_cnns.py +423 -0
  38. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/nn_models/unet_cnns.py +2335 -0
  39. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/schedulers/__init__.py +1 -0
  40. tovis-0.1.0/tovis/transcription/deep_chroma/libdl/schedulers/lr_schedulers.py +39 -0
  41. tovis-0.1.0/tovis/transcription/onsets_and_frames/__init__.py +13 -0
  42. tovis-0.1.0/tovis/transcription/onsets_and_frames/constants.py +26 -0
  43. tovis-0.1.0/tovis/transcription/onsets_and_frames/dataset.py +719 -0
  44. tovis-0.1.0/tovis/transcription/onsets_and_frames/decoding.py +102 -0
  45. tovis-0.1.0/tovis/transcription/onsets_and_frames/hf_model.py +364 -0
  46. tovis-0.1.0/tovis/transcription/onsets_and_frames/lstm.py +96 -0
  47. tovis-0.1.0/tovis/transcription/onsets_and_frames/mel.py +136 -0
  48. tovis-0.1.0/tovis/transcription/onsets_and_frames/midi_utils.py +655 -0
  49. tovis-0.1.0/tovis/transcription/onsets_and_frames/transcriber.py +276 -0
  50. tovis-0.1.0/tovis/transcription/onsets_and_frames/utils.py +245 -0
  51. tovis-0.1.0/tovis/transcription/transcribe.py +335 -0
  52. tovis-0.1.0/tovis/utils.py +932 -0
  53. tovis-0.1.0/tovis/visualization.py +3212 -0
  54. tovis-0.1.0/tovis.egg-info/PKG-INFO +157 -0
  55. tovis-0.1.0/tovis.egg-info/SOURCES.txt +56 -0
  56. tovis-0.1.0/tovis.egg-info/dependency_links.txt +1 -0
  57. tovis-0.1.0/tovis.egg-info/requires.txt +19 -0
  58. tovis-0.1.0/tovis.egg-info/top_level.txt +1 -0
tovis-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Johannes Zeitler and Meinard Müller
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.
@@ -0,0 +1,4 @@
1
+ recursive-include docs/source *.rst *.py .gitkeep
2
+ recursive-include docs/source/_static *.png
3
+ recursive-include tests *.py
4
+ prune docs/build
tovis-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,157 @@
1
+ Metadata-Version: 2.4
2
+ Name: tovis
3
+ Version: 0.1.0
4
+ Summary: TOVIS: A Python toolbox for tonal visualization of musical audio and annotation data
5
+ Author-email: Johannes Zeitler <johannes.zeitler@audiolabs-erlangen.de>, Meinard Müller <meinard.mueller@audiolabs-erlangen.de>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/groupmm/tovis
8
+ Project-URL: Documentation, https://groupmm.github.io/tovis/
9
+ Project-URL: Repository, https://github.com/groupmm/tovis
10
+ Project-URL: Issues, https://github.com/groupmm/tovis/issues
11
+ Keywords: music,audio,chroma,tonality,visualization,music information retrieval
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
18
+ Classifier: Topic :: Scientific/Engineering :: Visualization
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: THIRD_PARTY_NOTICES.md
23
+ License-File: licenses/countem-upstream.txt
24
+ License-File: licenses/onsets-and-frames-MIT.txt
25
+ License-File: licenses/pytorch-stft-BSD-3-Clause.txt
26
+ Requires-Dist: numpy
27
+ Requires-Dist: scipy
28
+ Requires-Dist: matplotlib
29
+ Requires-Dist: pandas
30
+ Requires-Dist: librosa>=0.10
31
+ Provides-Extra: transcription
32
+ Requires-Dist: torch>=2.0; extra == "transcription"
33
+ Provides-Extra: docs
34
+ Requires-Dist: sphinx; extra == "docs"
35
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
36
+ Provides-Extra: notebooks
37
+ Requires-Dist: jupyterlab; extra == "notebooks"
38
+ Provides-Extra: release
39
+ Requires-Dist: build>=1.2; extra == "release"
40
+ Requires-Dist: twine>=6; extra == "release"
41
+ Dynamic: license-file
42
+
43
+ <p align="right">
44
+ <img src="docs/source/_static/logo_tovis.png" alt="TOVIS logo" width="300">
45
+ </p>
46
+
47
+ # TOVIS: A Python toolbox for tonal visualization of musical audio and annotation data"
48
+
49
+
50
+ © [Johannes Zeitler](https://audiolabs-erlangen.de/fau/assistant/zeitler) and [Meinard Müller](https://www.audiolabs-erlangen.de/fau/professor/mueller), 2026
51
+
52
+ International Audio Laboratories, Erlangen
53
+
54
+ TOVIS is a Python toolbox for tonal visualization of musical audio
55
+ and annotation data.
56
+
57
+ The toolbox includes utilities for:
58
+
59
+ - chromagram extraction from audio, symbolic note annotations, and transcription output
60
+ - scale-likelihood analysis with configurable templates
61
+ - transposition-invariant self-similarity matrices for structure analysis
62
+ - time/measure conversion using synchronization annotations
63
+ - visualization of chromagrams, scale likelihoods, tempo curves, and structure or measure annotations
64
+
65
+ Extended documentation available [HERE](https://groupmm.github.io/tovis/).
66
+
67
+ ## Installation
68
+
69
+ TOVIS requires Python 3.11 or newer. Install from PyPI:
70
+
71
+ ```bash
72
+ python -m pip install tovis
73
+ ```
74
+
75
+ To install from the GitHub repository:
76
+
77
+ ```bash
78
+ git clone https://github.com/groupmm/tovis.git
79
+ cd tovis
80
+ python -m pip install .
81
+ ```
82
+
83
+ Use `python -m pip install -e ".[docs,notebooks]"` for an editable checkout
84
+ with documentation and notebook tools. Neural transcription requires
85
+ `python -m pip install "tovis[transcription]"` and a compatible checkpoint obtained
86
+ separately. You must explicitly set `transcription_checkpoint` to the checkpoint
87
+ file path when using a neural backend; TOVIS searches no default location.
88
+ Direct `tovis.transcription` functions require the `checkpoint` keyword argument.
89
+ Standard chroma backends work without PyTorch or model weights.
90
+
91
+ ## Quick start
92
+
93
+ This example generates a three-second C-major chord, extracts chroma features,
94
+ compares them with scale templates, and saves `tovis-introduction.png`.
95
+ It needs no audio files, annotations, network access, or neural checkpoints.
96
+
97
+ ```python
98
+ import matplotlib.pyplot as plt
99
+ import numpy as np
100
+
101
+ import tovis
102
+ from tovis.visualization import plot_chromagram, plot_scale_likelihood
103
+
104
+ sample_rate = 22050
105
+ time = np.arange(3 * sample_rate) / sample_rate
106
+ frequencies = [261.63, 329.63, 392.00] # C4, E4, G4
107
+ audio = sum(np.sin(2 * np.pi * f * time) for f in frequencies) / 3
108
+
109
+ chroma, feature_rate = tovis.compute_chromagram(
110
+ audio, sample_rate=sample_rate, backend="STFT"
111
+ )
112
+ likelihood = tovis.scale_analysis_templates(chroma, template_version="binary")
113
+
114
+ fig, axes = plt.subplots(2, 1, figsize=(10, 6))
115
+ plot_chromagram(chroma, feature_rate=feature_rate, ax=axes[0])
116
+ plot_scale_likelihood(likelihood, feature_rate=feature_rate, ax=axes[1])
117
+ fig.tight_layout()
118
+ fig.savefig("tovis-introduction.png", dpi=150)
119
+ plt.close(fig)
120
+ ```
121
+
122
+ To analyze your own audio, replace the synthesis and extraction steps with
123
+ `chroma, feature_rate = tovis.compute_chromagram_from_file("your-audio.wav")`.
124
+ Chroma matrices have shape `(12, n_frames)`; `feature_rate` is frames per second.
125
+ The scale likelihoods compare major-scale templates and are not a definitive
126
+ key estimate.
127
+
128
+ ## Documentation
129
+
130
+ [Read the documentation](https://groupmm.github.io/tovis/) for the installation
131
+ guide, introduction, and API reference.
132
+
133
+ Build the installation guide, introduction, and API reference from the checkout:
134
+
135
+ ```bash
136
+ python -m pip install -e ".[docs]"
137
+ python -m sphinx -W -b html docs/source docs/build/html
138
+ ```
139
+
140
+ Open `docs/build/html/index.html` to read the documentation. Generated
141
+ documentation is excluded from version control.
142
+
143
+ ## Development
144
+
145
+ The conda environment is defined in `environment.yml`. From the checkout, run
146
+ the regression checks with `python -m unittest discover -s tests`.
147
+
148
+ The demonstration notebooks and their example audio and annotation data are in
149
+ [`scripts/`](https://github.com/groupmm/tovis/tree/master/scripts). Neural
150
+ examples additionally require compatible checkpoints supplied by the user.
151
+
152
+ ## License and attribution
153
+
154
+ TOVIS is available under the [MIT license](https://github.com/groupmm/tovis/blob/master/LICENSE). It includes code from
155
+ the [count-the-notes project](https://github.com/Yoni-Yaffe/count-the-notes)
156
+ by Jonathan Yaffe, Ben Maman, Meinard Müller, and Amit Bermano (2025), Onsets & Frames code by Jong Wook Kim (2019), and PyTorch STFT code by Prem Seetharaman (2017). Third-party attribution and upstream notices
157
+ are recorded in [THIRD_PARTY_NOTICES.md](https://github.com/groupmm/tovis/blob/master/THIRD_PARTY_NOTICES.md).
tovis-0.1.0/README.md ADDED
@@ -0,0 +1,115 @@
1
+ <p align="right">
2
+ <img src="docs/source/_static/logo_tovis.png" alt="TOVIS logo" width="300">
3
+ </p>
4
+
5
+ # TOVIS: A Python toolbox for tonal visualization of musical audio and annotation data"
6
+
7
+
8
+ © [Johannes Zeitler](https://audiolabs-erlangen.de/fau/assistant/zeitler) and [Meinard Müller](https://www.audiolabs-erlangen.de/fau/professor/mueller), 2026
9
+
10
+ International Audio Laboratories, Erlangen
11
+
12
+ TOVIS is a Python toolbox for tonal visualization of musical audio
13
+ and annotation data.
14
+
15
+ The toolbox includes utilities for:
16
+
17
+ - chromagram extraction from audio, symbolic note annotations, and transcription output
18
+ - scale-likelihood analysis with configurable templates
19
+ - transposition-invariant self-similarity matrices for structure analysis
20
+ - time/measure conversion using synchronization annotations
21
+ - visualization of chromagrams, scale likelihoods, tempo curves, and structure or measure annotations
22
+
23
+ Extended documentation available [HERE](https://groupmm.github.io/tovis/).
24
+
25
+ ## Installation
26
+
27
+ TOVIS requires Python 3.11 or newer. Install from PyPI:
28
+
29
+ ```bash
30
+ python -m pip install tovis
31
+ ```
32
+
33
+ To install from the GitHub repository:
34
+
35
+ ```bash
36
+ git clone https://github.com/groupmm/tovis.git
37
+ cd tovis
38
+ python -m pip install .
39
+ ```
40
+
41
+ Use `python -m pip install -e ".[docs,notebooks]"` for an editable checkout
42
+ with documentation and notebook tools. Neural transcription requires
43
+ `python -m pip install "tovis[transcription]"` and a compatible checkpoint obtained
44
+ separately. You must explicitly set `transcription_checkpoint` to the checkpoint
45
+ file path when using a neural backend; TOVIS searches no default location.
46
+ Direct `tovis.transcription` functions require the `checkpoint` keyword argument.
47
+ Standard chroma backends work without PyTorch or model weights.
48
+
49
+ ## Quick start
50
+
51
+ This example generates a three-second C-major chord, extracts chroma features,
52
+ compares them with scale templates, and saves `tovis-introduction.png`.
53
+ It needs no audio files, annotations, network access, or neural checkpoints.
54
+
55
+ ```python
56
+ import matplotlib.pyplot as plt
57
+ import numpy as np
58
+
59
+ import tovis
60
+ from tovis.visualization import plot_chromagram, plot_scale_likelihood
61
+
62
+ sample_rate = 22050
63
+ time = np.arange(3 * sample_rate) / sample_rate
64
+ frequencies = [261.63, 329.63, 392.00] # C4, E4, G4
65
+ audio = sum(np.sin(2 * np.pi * f * time) for f in frequencies) / 3
66
+
67
+ chroma, feature_rate = tovis.compute_chromagram(
68
+ audio, sample_rate=sample_rate, backend="STFT"
69
+ )
70
+ likelihood = tovis.scale_analysis_templates(chroma, template_version="binary")
71
+
72
+ fig, axes = plt.subplots(2, 1, figsize=(10, 6))
73
+ plot_chromagram(chroma, feature_rate=feature_rate, ax=axes[0])
74
+ plot_scale_likelihood(likelihood, feature_rate=feature_rate, ax=axes[1])
75
+ fig.tight_layout()
76
+ fig.savefig("tovis-introduction.png", dpi=150)
77
+ plt.close(fig)
78
+ ```
79
+
80
+ To analyze your own audio, replace the synthesis and extraction steps with
81
+ `chroma, feature_rate = tovis.compute_chromagram_from_file("your-audio.wav")`.
82
+ Chroma matrices have shape `(12, n_frames)`; `feature_rate` is frames per second.
83
+ The scale likelihoods compare major-scale templates and are not a definitive
84
+ key estimate.
85
+
86
+ ## Documentation
87
+
88
+ [Read the documentation](https://groupmm.github.io/tovis/) for the installation
89
+ guide, introduction, and API reference.
90
+
91
+ Build the installation guide, introduction, and API reference from the checkout:
92
+
93
+ ```bash
94
+ python -m pip install -e ".[docs]"
95
+ python -m sphinx -W -b html docs/source docs/build/html
96
+ ```
97
+
98
+ Open `docs/build/html/index.html` to read the documentation. Generated
99
+ documentation is excluded from version control.
100
+
101
+ ## Development
102
+
103
+ The conda environment is defined in `environment.yml`. From the checkout, run
104
+ the regression checks with `python -m unittest discover -s tests`.
105
+
106
+ The demonstration notebooks and their example audio and annotation data are in
107
+ [`scripts/`](https://github.com/groupmm/tovis/tree/master/scripts). Neural
108
+ examples additionally require compatible checkpoints supplied by the user.
109
+
110
+ ## License and attribution
111
+
112
+ TOVIS is available under the [MIT license](https://github.com/groupmm/tovis/blob/master/LICENSE). It includes code from
113
+ the [count-the-notes project](https://github.com/Yoni-Yaffe/count-the-notes)
114
+ by Jonathan Yaffe, Ben Maman, Meinard Müller, and Amit Bermano (2025), Onsets & Frames code by Jong Wook Kim (2019), and PyTorch STFT code by Prem Seetharaman (2017). Third-party attribution and upstream notices
115
+ are recorded in [THIRD_PARTY_NOTICES.md](https://github.com/groupmm/tovis/blob/master/THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,44 @@
1
+ # Third-party notices
2
+
3
+ TOVIS is developed by Johannes Zeitler and Meinard Müller at International
4
+ Audio Laboratories, Erlangen. The root MIT license applies to TOVIS-authored
5
+ code. Bundled third-party code retains its upstream notices and terms.
6
+
7
+ ## Onsets & Frames
8
+
9
+ The code in `tovis/transcription/onsets_and_frames/` derives from the PyTorch
10
+ implementation of Onsets & Frames by Jong Wook Kim and the CountEM codebase.
11
+
12
+ - Original implementation: https://github.com/jongwook/onsets-and-frames
13
+ - Copyright 2019 Jong Wook Kim; MIT license, reproduced in
14
+ `licenses/onsets-and-frames-MIT.txt`.
15
+ - The underlying Onsets and Frames architecture was introduced by Hawthorne
16
+ et al., *Onsets and Frames: Dual-Objective Piano Transcription* (2018).
17
+
18
+ ## CountEM / Count the Notes
19
+
20
+ TOVIS includes code from the count-the-notes project (CountEM), including the
21
+ `CountEMModel` Hugging Face wrapper in `hf_model.py` and extensions to the
22
+ Onsets & Frames implementation.
23
+
24
+ - Source: https://github.com/Yoni-Yaffe/count-the-notes
25
+ - Authors: Jonathan Yaffe, Ben Maman, Meinard Müller, and Amit Bermano (2025).
26
+ - Project: *Count the Notes: Histogram-Based Supervision for Automatic Music
27
+ Transcription*.
28
+ - Upstream license notice: `licenses/countem-upstream.txt`, reproduced as
29
+ published in the upstream `LICENSE.md`.
30
+
31
+ Model weights are not included in the TOVIS distributions.
32
+
33
+ ## PyTorch STFT
34
+
35
+ The STFT implementation in `tovis/transcription/onsets_and_frames/mel.py`
36
+ is adapted from Prem Seetharaman's PyTorch STFT implementation.
37
+
38
+ - Source: https://github.com/pseeth/pytorch-stft (now `pseeth/torch-stft`).
39
+ - Copyright (c) 2017, Prem Seetharaman; BSD 3-Clause license, reproduced in
40
+ `licenses/pytorch-stft-BSD-3-Clause.txt`.
41
+
42
+ TOVIS integrates these components into its package and transcription wrapper;
43
+ the bundled copies may differ from upstream. Existing upstream model metadata
44
+ and source credits are retained.
@@ -0,0 +1,22 @@
1
+ import matplotlib.pyplot as plt
2
+ import numpy as np
3
+
4
+ import tovis
5
+ from tovis.visualization import plot_chromagram, plot_scale_likelihood
6
+
7
+ sample_rate = 22050
8
+ time = np.arange(3 * sample_rate) / sample_rate
9
+ frequencies = [261.63, 329.63, 392.00] # C4, E4, G4
10
+ audio = sum(np.sin(2 * np.pi * f * time) for f in frequencies) / 3
11
+
12
+ chroma, feature_rate = tovis.compute_chromagram(
13
+ audio, sample_rate=sample_rate, backend="STFT"
14
+ )
15
+ likelihood = tovis.scale_analysis_templates(chroma, template_version="binary")
16
+
17
+ fig, axes = plt.subplots(2, 1, figsize=(10, 6))
18
+ plot_chromagram(chroma, feature_rate=feature_rate, ax=axes[0])
19
+ plot_scale_likelihood(likelihood, feature_rate=feature_rate, ax=axes[1])
20
+ fig.tight_layout()
21
+ fig.savefig("tovis-introduction.png", dpi=150)
22
+ plt.close(fig)
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,55 @@
1
+ API Reference
2
+ =============
3
+
4
+ This section is generated from the docstrings in the TOVIS toolbox code.
5
+
6
+ Feature
7
+ ------------------
8
+
9
+ .. automodule:: tovis.feature
10
+ :members:
11
+ :undoc-members:
12
+ :show-inheritance:
13
+
14
+ Scale
15
+ --------------
16
+
17
+ .. automodule:: tovis.scale
18
+ :members:
19
+ :undoc-members:
20
+ :show-inheritance:
21
+
22
+ Structure
23
+ ------------------
24
+
25
+ .. automodule:: tovis.structure
26
+ :members:
27
+ :undoc-members:
28
+ :show-inheritance:
29
+
30
+ Utilities
31
+ ---------
32
+
33
+ .. automodule:: tovis.utils
34
+ :members:
35
+ :undoc-members:
36
+ :show-inheritance:
37
+
38
+ Visualization
39
+ -------------
40
+
41
+ .. automodule:: tovis.visualization
42
+ :members:
43
+ :undoc-members:
44
+ :show-inheritance:
45
+
46
+ Transcription
47
+ -------------
48
+
49
+ These helpers require the optional transcription dependencies and compatible
50
+ model checkpoints at runtime; see :doc:`installation`.
51
+
52
+ .. automodule:: tovis.transcription
53
+ :members:
54
+ :undoc-members:
55
+ :show-inheritance:
@@ -0,0 +1,25 @@
1
+ License and attribution
2
+ =======================
3
+
4
+ TOVIS is developed by Johannes Zeitler and Meinard Müller at International
5
+ Audio Laboratories, Erlangen. TOVIS is distributed under the
6
+ MIT license in the repository's ``LICENSE`` file.
7
+
8
+ The bundled transcription code includes contributions from:
9
+
10
+ * `Onsets & Frames <https://github.com/jongwook/onsets-and-frames>`_,
11
+ the PyTorch implementation by Jong Wook Kim, copyright 2019, under MIT.
12
+ * The `count-the-notes project (CountEM) <https://github.com/Yoni-Yaffe/count-the-notes>`_,
13
+ by Jonathan Yaffe, Ben Maman, Meinard Müller, and Amit Bermano (2025),
14
+ whose code is included in TOVIS.
15
+ * `PyTorch STFT <https://github.com/pseeth/torch-stft>`_ by Prem Seetharaman,
16
+ copyright 2017, under BSD 3-Clause. The STFT code in ``mel.py`` is adapted
17
+ from this implementation.
18
+
19
+ The Onsets and Frames architecture was introduced by Hawthorne et al.,
20
+ *Onsets and Frames: Dual-Objective Piano Transcription* (2018).
21
+
22
+ Upstream notices and terms are included in ``THIRD_PARTY_NOTICES.md`` and
23
+ ``licenses/`` in the repository and in the package's distribution license
24
+ files. Bundled third-party code retains its upstream terms.
25
+
@@ -0,0 +1,33 @@
1
+ """Sphinx configuration for the TOVIS documentation."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ import sys
7
+
8
+
9
+ PROJECT_ROOT = Path(__file__).resolve().parents[2]
10
+ sys.path.insert(0, str(PROJECT_ROOT))
11
+
12
+ project = "TOVIS"
13
+ author = "Johannes Zeitler and Meinard Müller"
14
+ copyright = "2026, Johannes Zeitler and Meinard Müller"
15
+
16
+ extensions = [
17
+ "sphinx.ext.autodoc",
18
+ "sphinx.ext.napoleon",
19
+ "sphinx.ext.viewcode",
20
+ ]
21
+
22
+ autodoc_typehints = "description"
23
+ autodoc_member_order = "bysource"
24
+ napoleon_google_docstring = False
25
+ napoleon_numpy_docstring = True
26
+
27
+ templates_path = ["_templates"]
28
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
29
+
30
+ html_theme = "sphinx_rtd_theme"
31
+ html_static_path = ["_static"]
32
+ html_logo = "_static/logo_tovis.png"
33
+ html_theme_options = {"logo_only": True}
@@ -0,0 +1,31 @@
1
+ TOVIS Documentation
2
+ ===================
3
+
4
+ .. image:: _static/logo_tovis.png
5
+ :alt: TOVIS logo
6
+ :width: 400px
7
+
8
+ TOVIS is a Python toolbox for **TO**\ nal **VIS**\ ualization of musical audio,
9
+ symbolic annotations, chromagrams, scale likelihoods, and formal structure.
10
+
11
+ Johannes Zeitler and Meinard Müller
12
+
13
+ International Audio Laboratories, Erlangen
14
+
15
+
16
+ .. toctree::
17
+ :maxdepth: 2
18
+ :caption: Contents
19
+
20
+ installation
21
+ introduction
22
+ api
23
+ attribution
24
+
25
+ Indices
26
+ =======
27
+
28
+ * :ref:`genindex`
29
+ * :ref:`modindex`
30
+ * :ref:`search`
31
+
@@ -0,0 +1,94 @@
1
+ Installation
2
+ ============
3
+
4
+ TOVIS requires Python 3.11 or newer. Its Python package and distribution name
5
+ is ``tovis``. Use a virtual environment or the supplied conda environment to
6
+ keep dependencies separate from other projects.
7
+
8
+ Install from PyPI
9
+ -----------------
10
+
11
+ .. code-block:: bash
12
+
13
+ python -m pip install tovis
14
+
15
+ Install from source
16
+ -------------------
17
+
18
+ .. code-block:: bash
19
+
20
+ git clone https://github.com/groupmm/tovis.git
21
+ cd tovis
22
+ python -m pip install .
23
+
24
+ Check the installation with:
25
+
26
+ .. code-block:: bash
27
+
28
+ python -c "import tovis; from importlib.metadata import version; print(version('tovis'))"
29
+
30
+ Optional dependencies
31
+ ---------------------
32
+
33
+ Install optional dependencies for documentation, notebooks, or neural
34
+ transcription with:
35
+
36
+ .. code-block:: bash
37
+
38
+ python -m pip install "tovis[docs]"
39
+ python -m pip install "tovis[notebooks]"
40
+ python -m pip install "tovis[transcription]"
41
+
42
+ ``docs`` installs Sphinx and the documentation theme. ``notebooks`` installs
43
+ JupyterLab. ``transcription`` installs PyTorch for neural inference with
44
+ user-supplied model checkpoints. Multiple
45
+ extras can be combined, for example ``"tovis[docs,notebooks]"``. For a source
46
+ checkout, replace ``tovis`` with ``.`` in these commands.
47
+
48
+ The STFT, CQT, VQT, and IIR chroma backends need no neural checkpoints or
49
+ PyTorch. Neural backends additionally require a compatible checkpoint, which
50
+ is obtained separately and not included in the distribution.
51
+ You must configure the checkpoint path explicitly for every
52
+ neural transcription call. TOVIS searches no default checkpoint location.
53
+ For the feature-extraction functions, set ``transcription_checkpoint``:
54
+
55
+ .. code-block:: python
56
+
57
+ from tovis import compute_chromagram_from_file
58
+
59
+ chroma, feature_rate = compute_chromagram_from_file(
60
+ "your-audio.wav",
61
+ backend="ONSETS_AND_FRAMES",
62
+ transcription_checkpoint="/path/to/checkpoint_OnsetsAndFrames.pt",
63
+ transcription_device="cpu",
64
+ )
65
+
66
+ For Deep Chroma use ``backend="DEEP_CHROMA"`` and a compatible Deep Chroma
67
+ checkpoint. Direct calls to functions in ``tovis.transcription`` require the
68
+ ``checkpoint`` keyword argument. Missing or empty paths are rejected, and
69
+ paths must point to existing files before audio loading or neural inference.
70
+
71
+ These backends expect different model formats; arbitrary upstream
72
+ weights are not interchangeable. Use checkpoints from a trusted source:
73
+ the Onsets & Frames loader deserializes a Python model object.
74
+
75
+ Development and documentation
76
+ -----------------------------
77
+
78
+ For editable installation and a local documentation build:
79
+
80
+ .. code-block:: bash
81
+
82
+ python -m pip install -e ".[docs,notebooks]"
83
+ python -m unittest discover -s tests
84
+ python -m sphinx -W -b html docs/source docs/build/html
85
+
86
+ Open ``docs/build/html/index.html`` in a browser. Generated documentation is
87
+ excluded from version control. The conda environment in ``environment.yml``
88
+ is an alternative for local development; install TOVIS in that environment
89
+ with ``python -m pip install -e .``.
90
+
91
+ The demonstration notebooks and their example audio and annotation data are
92
+ in ``scripts/`` in the source repository. Neural examples additionally require
93
+ compatible checkpoints supplied by the user. The :doc:`introduction` provides
94
+ a self-contained example using synthesized audio.
@@ -0,0 +1,66 @@
1
+ Introduction
2
+ ============
3
+
4
+ TOVIS turns musical audio or note annotations into chroma features, compares
5
+ those features with scale templates, and visualizes tonal and formal structure.
6
+
7
+ A runnable example
8
+ ------------------
9
+
10
+ Install TOVIS as described in :doc:`installation`, then run the following code
11
+ in Python. It synthesizes a three-second C-major chord, extracts an STFT
12
+ chromagram, computes scale likelihoods, and saves ``tovis-introduction.png``
13
+ in the current directory. No datasets, audio downloads, or model checkpoints
14
+ are needed. Saving the plot also works without a graphical desktop.
15
+
16
+ .. literalinclude:: _examples/introduction.py
17
+ :language: python
18
+
19
+ Reading the results
20
+ -------------------
21
+
22
+ ``chroma`` has shape ``(12, n_frames)``. Its rows represent pitch classes
23
+ ordered C, C-sharp, D, ..., B; columns represent successive audio frames.
24
+ ``feature_rate`` is measured in frames per second, so frame ``n`` corresponds
25
+ to time ``n / feature_rate``. A C-major chord emphasizes C, E, and G.
26
+
27
+ ``likelihood`` compares each chroma frame with twelve transposed major-scale
28
+ templates. The default scale labels describe each scale's position on the
29
+ circle of fifths relative to C. These values describe template agreement;
30
+ they are not calibrated probabilities or a definitive key estimate.
31
+
32
+ Use your own audio
33
+ ------------------
34
+
35
+ Replace the synthesis and chromagram extraction in the example with:
36
+
37
+ .. code-block:: python
38
+
39
+ chroma, feature_rate = tovis.compute_chromagram_from_file("your-audio.wav")
40
+
41
+ The default backend is CQT. STFT, CQT, VQT, and IIR are available without
42
+ neural models. See :doc:`installation` for the additional requirements of
43
+ the neural backends.
44
+
45
+ Use note annotations
46
+ --------------------
47
+
48
+ For symbolic input, provide note start and end times in seconds and MIDI
49
+ pitch numbers in a DataFrame:
50
+
51
+ .. code-block:: python
52
+
53
+ import pandas as pd
54
+
55
+ notes = pd.DataFrame({
56
+ "start": [0.0, 0.0, 0.0],
57
+ "end": [3.0, 3.0, 3.0],
58
+ "pitch": [60, 64, 67],
59
+ })
60
+ chroma, feature_rate = tovis.compute_chromagram_from_annotations(
61
+ notes, feature_rate=10.0
62
+ )
63
+
64
+ This returns a ``(12, 30)`` matrix at ten frames per second. It can be used
65
+ with the same scale-analysis and visualization functions. See :doc:`api`
66
+ for smoothing, normalization, synchronization, and structure-analysis options.