Fork me on GitHub


Music structure segmentation based on SIPLCA analysis of chroma features

This package contains the implementation of the algorithm for identifying repeated harmonic patterns in music and structure segmentation described in [1]. It is primarily written in Python but calls Matlab for feature extraction and performance evaluation.

It depends on numpy and scipy, Matplotlib for plotting, and the mlabwrap package for running Matlab code.

Included is Dan Ellis’ beat-synchronous chroma feature extraction code, also available from: Also useful (but not included) is Dan’s code for resynthesizing chroma.

All code in this package is distributed under the terms of the GNU General Public License. See the file COPYING for details.


You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://

Example usage

>>> import segmenter
>>> wavfile = '/path/to/come_together.wav'
>>> rank = 4  # rank corresponds to the number of segments
>>> win = 60  # win controls the length of each chroma pattern
>>> niter = 200  # number of iterations to perform
>>> np.random.seed(123)  # Make this reproduceable
>>> labels = segmenter.segment_wavfile(wavfile, win=win, rank=rank,
...                                    niter=niter, plotiter=10)
INFO:plca:Iteration 0: divergence = 10.065992
INFO:plca:Iteration 50: divergence = 9.468196
INFO:plca:Iteration 100: divergence = 9.421632
INFO:plca:Iteration 150: divergence = 9.409279
INFO:root:Iteration 199: final divergence = 9.404961
INFO:segmenter:Removing 2 segments shorter than 32 frames
(You can also watch the video of the EM algorithm in action.)
>>> print labels
0.0000 21.7480 segment0
21.7480 37.7640 segment1
37.7640 55.1000 segment0
55.1000 76.1440 segment1
76.1440 95.1640 segment0
95.1640 121.2360 segment1
121.2360 158.5360 segment2
158.5360 180.8520 segment1
180.8520 196.5840 segment0
196.5840 255.8160 segment3

See the segmenter and plca modules for more details.


This material is based upon work supported by the NSF (grant IIS-0844654) and by the IMLS (grant LG-06-08-0073-08).


[1] R. J. Weiss and J. P. Bello. “Identifying Repeated Patterns in Music Using Sparse Convolutive Non-Negative Matrix Factorization”. In Proc. International Conference on Music Information Retrieval (ISMIR), 2010.

2010-05-27 Ron Weiss <>