py-mir-toolbox
A Python port of MIRtoolbox for music feature extraction, designed as a bridge from music psychology to the Python music information retrieval (MIR) ecosystem.
MIRtoolbox (Lartillot & Toiviainen, 2007) is the MATLAB toolbox most music cognition and music psychology students learn first. py-mir-toolbox:
- keeps the MIRtoolbox function names and default parameters, so existing analyses carry over;
- is validated numerically against MIRtoolbox 1.8.2 (see the Parity report); and
- comes with course notebooks that compute each feature with py-mir-toolbox, librosa and Essentia side by side, runnable in Google Colab with no installation.
Install
pip install py-mir-toolbox
Optional extras: py-mir-toolbox[export] (pandas, for mir.to_dataframe), py-mir-toolbox[parallel] (joblib, for mir.batch(..., n_jobs=4)), py-mir-toolbox[librosa].
Example
import mirpy as mir
a = mir.audio("song.wav") # a = miraudio('song.wav')
rms = mir.rms(a, frame=True) # mirrms(a, 'Frame')
mir.stat(mir.centroid(a, frame=True)) # mirstat(mircentroid(a, 'Frame'))
# One row per file of a folder, saved for R, SPSS or JASP
features = {"rms": mir.rms, "centroid": lambda a: mir.centroid(a, frame=True)}
mir.to_csv(mir.file_table(mir.batch("songs/", features)), "features.csv")
What release 0.1 covers
- Audio and framing:
audio,frame. - Signal processing:
spectrum,cepstrum,autocor,filterbank,sum,peaks. - Dynamics:
rms,lowenergy. - Timbre:
zerocross,centroid,spread,skewness,kurtosis,flatness,entropy,rolloff,brightness,mfcc,flux. - Statistics and export:
mean,std,median,stat,histo,batch,list_audio,get_data,file_table,frame_table,to_csv,to_arff,to_dataframe.
Pitch, tonality, rhythm and structure follow in later releases.
Documentation and course
- Website: https://ccrma.stanford.edu/~jsgomezc/py-mir-toolbox
- API reference and Parity report
- Course chapters (open in Colab from each page): Basics, Dynamics, Spectral shape, MFCCs, flux and statistics
Credits and citing
py-mir-toolbox is translated from MiningSuite (BSD-3-Clause, © Olivier Lartillot and the MiningSuite contributors), the successor of MIRtoolbox. MIRtoolbox 1.8.2 (GPL-2.0) is used only as a numerical reference; its source code is not included or translated. See NOTICE.
If you use py-mir-toolbox, please cite it (see CITATION.cff; metadata also in codemeta.json) and the original MIRtoolbox papers:
- Lartillot, O., & Toiviainen, P. (2007). A Matlab toolbox for musical feature extraction from audio. Proceedings of the 10th International Conference on Digital Audio Effects (DAFx-07), Bordeaux, France.
- Lartillot, O., Toiviainen, P., & Eerola, T. (2008). A Matlab toolbox for music information retrieval. In C. Preisach, H. Burkhardt, L. Schmidt-Thieme, & R. Decker (Eds.), Data Analysis, Machine Learning and Applications. Springer.
mirpy.cite() prints these entries as BibTeX.
Repository layout
| Path | Contents |
|---|---|
src/mirpy/ |
The package |
tests/ |
Unit and parity tests |
validation/ |
Scripts that generate MIRtoolbox 1.8.2 reference outputs |
docs/ |
Sphinx documentation and course (served under /docs/) |
docs/chapters/ |
Course notebooks (Colab-ready) |
reference/miningsuite/ |
MiningSuite +sig, +aud, +mus (BSD-3) |
License
Code: BSD-3-Clause. Course text: CC-BY 4.0.
Metadata
Release files for py-mir-toolbox 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_mir_toolbox-0.1.0.tar.gz | 541.8 kB | With provenance | Details for py_mir_toolbox-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_mir_toolbox-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for py_mir_toolbox-0.1.0-py3-none-any.whl |
Total release size: 619.3 kB
Release files / py_mir_toolbox-0.1.0.tar.gz
| Download URL | py_mir_toolbox-0.1.0.tar.gz |
|---|---|
| Size | 541.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f3520bf10c114aeb165bc3ae11a2d7aff0c22e2b9b1df840360225a0144beab
|
|
BLAKE2b-256 checksum How to use checksums |
ff879e6f6220338d675fbb9a2ac2d2b6103c262a086c00df6590a584443c4805
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / py_mir_toolbox-0.1.0-py3-none-any.whl
| Download URL | py_mir_toolbox-0.1.0-py3-none-any.whl |
|---|---|
| Size | 77.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8085d2bfcc6898bb680c3a4e6aa12b698a71e90b63c348e9ca5865513b924b4
|
|
BLAKE2b-256 checksum How to use checksums |
249421ad31a57c9798c5a8c39d13c189aace0285d700b28881ede50098db2305
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for py-mir-toolbox 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for py_mir_toolbox-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.