music: extreme-fidelity synthesis of musical elements
Contributors
Other:
Description
Extreme-fidelity synthesis of musical elements, based on the MASS framework.
pip install -U music
π Tutorial Β· API reference Β· Full changelog
This is the first release with a test suite, type checking, linting and rendered API documentation behind it β and, consequently, the release in which most of the package was found to be broken and fixed.
What was wrong
Roughly thirty routines returned a wrong answer or raised on their own documented defaults. The ones worth naming:
localize_linear()was never implemented β it raisedNotImplementedError. It now computes the position sample by sample and, from it, the interaural time and intensity differences, with fractional delays interpolated rather than rounded.trill()andstretches()raised unconditionally, on an import cycle and on abandoned scratch code respectively.fir()applied the response it was given. It convolved with the magnitudes rather than their inverse transform, so a flat response β "pass everything unchanged" β was a boxcar moving average instead of the identity.- Sixteen sites detected an argument with
type(x) in (np.ndarray, list), so a tuple or an ndarray subclass was silently discarded and the caller got a default-duration envelope back instead of their own audio. No error, just the wrong sound. write_wav_*was broken at 8- and 64-bit depth, and WAV round trips were off by one LSB on every file the package had ever written: the writer scaled by2**(b-1) - 1while the reader divided by2**(b-1).normalize_mono/stereoreturned NaN for any constant signal, and the stereo path silently corrupted a mono vector by reading its first two samples as the two channels.PlainChanges(n)returned a fraction of the peal above five bells β 120 rows of 720 at six, 224 of 40320 at eight.- The waveform tables were three drifted copies of the same four definitions, disagreeing at the triangle's peak sample; the triangle, which is the default table for every note, never reached full amplitude.
Four fixes change rendered output
All are corrections β the previous behaviour was wrong in each case β but a render from this version will not be byte-identical to one from 1.0.1. The complete peal, the exact waveform tables, unity-gain WAV round trips, and fir(). See the changelog's Note for anyone upgrading for the details and for how to ask for the old shorter peal.
What is around it now
- 481 tests at 100% coverage, enforced in CI
mypyclean on Python 3.10 through 3.13, withcheck_untyped_defson β it had been off, which made type checking vacuous over 83% of the coderuffclean at PEP 8's 79 columns- Every docstring converted to numpydoc, and the API reference published at ttm.github.io/music, built with warnings as errors
- A tutorial, whose every code block is executed by the test suite
- A
Sequencer, for scheduling notes onto a timeline - 3 Dependabot alerts cleared
Citing
If you use this package, please cite the article it implements:
Fabbri, R., Vieira da Silva Junior, V., Pessotti, A. C. S., CorrΓͺa, D. C., & Oliveira Jr., O. N. Musical elements in the discrete-time representation of sound. arXiv:1412.6853 (2017).
CITATION.cff in the repository gives GitHub's "Cite this repository" button the same thing in machine-readable form.
Files
ttm/music-v1.1.0.zip
Additional details
Additional titles
- Alternative title (English)
- The music Python package
Related works
- Is supplement to
- Software: https://github.com/ttm/music/tree/v1.1.0 (URL)
Software
- Repository URL
- https://github.com/ttm/music