The Music Perception Toolbox: Analytical Methods for Pitch and Rhythm Similarity, Consonance, Complexity, and Structure
Discuss this preprint
Start a discussion What are Sciety discussions?Listed in
This article is not in any list yet, why not save it to one of your lists.Abstract
The Music Perception Toolbox is an open-source package—available in both MATLAB and Python—for computing perceptually and cognitively motivated measures of pitch similarity, consonance, and scale and rhythmic structure. It accepts inputs from symbolic pitch data or from spectral peaks extracted from audio recordings. The toolbox covers three broad areas: (i) similarity and complexity measures based on expectation tensors—continuous densities that embed weighted collections of pitches or time points into a unified framework applicable to both pitch and rhythm; (ii) consonance measures including spectral entropy, template harmonicity, tensor harmonicity, and sensory roughness; and (iii) structural features for scales and rhythms, including Fourier-based balance and evenness, coherence, edge detection, projected centroid, mean offset, and Markov prediction. These measures have been validated as predictors of perceived tonal fit, consonance, affect, and rhythmic complexity across diverse empirical studies, including experiments with microtonal and non-Western tuning systems. Version 2.0.0 introduces a fully analytical framework for constructing, evaluating, and comparing expectation tensor densities, replacing the grid-based discretization of earlier work and yielding exact computation with substantial efficiency gains. This article presents the mathematical foundations—including the first published derivation of the analytical inner product underlying the expectation tensor cosinesimilarity—describes the toolbox’s design, and surveys its empirical applications.