Low Dimensional Topology

January 5, 2015

Topology of musical data

Filed under: Algebraic topology,Computation and experiment,Metric geometry — Ryan Budney @ 5:36 pm

A few years ago a musician friend asked me “there’s this new tool topologists have called Persistent Homology.  I’d like to see what it can do when you apply it to data from music.  Want to help?”

That friend is also an electrical engineer and knows some things about signal processing.  This was important to me — we had some external criterion (from outside of mathematics) for determining whether or not the insights from Persistent Homology were interesting or not.

So I said “okay!”  Not really knowing what I was getting myself into.

We got to work, over some rather cool, soggy Victoria winter days.

The idea was to take piles of data from music, put various standard metrics on them, feed them into software that computes the barcodes, and analyze the output, to see if the barcodes see anything that we did not already know about the data.  The answer turns out to be yes.

Sometimes the barcodes saw some rather subtle and insightful things.  Sometimes they saw some subtle and relatively mundane things.   Let me tell you about a few.


First, a quick summary of persistent homology.  Jesse has talked about this quite a bit on the blog, but if you’ve forgotten or missed it, the idea goes back to Vietoris.

Given a finite metric space X, you form a family (parametrized by a non-negative real number ε≥0) of simplicial complexes X(ε) whose vertex set is X.  You give X(ε) an edge if the distance between two vertices of X is less than ε, similarly you give it a simplex is the pairwise distance between all the prospective vertices is less than ε.  The family X(ε) forms a filtration of a contractible simplicial complex X(∞), so the homology of the spaces X(ε) is a family of abelian groups and inclusions, which eventually “dies” when the parameter ε is larger than the diameter of the metric space X.  Similarly, the homology of X(0) is that of a finite discrete space.  The homology classes that exist for large ε-intervals are called persistent, and one imagines them as describing somewhat relevant shapes in your data. The bar codes essentially represent these intervals over which homology classes live.

The subject of Persistent Homology is advancing fairly rapidly at present, but there are still many unsolved foundational problems in the field.  If a person has envy for all the successes of Milnor, Thom and Serre, setting up the foundations of algebraic and differential topology, I can’t imagine a better field to go into.


Anyhow, back to our computations.  One of the more interesting computations we looked into was the homology of certain points in the space of rhythms.  Here we think of rhythms as the periodic beating of a drum.  To make a space from rhythms, we consider the finite-subset space of a circle.  Typically this is denoted exp(S^1). A point of exp(S^1) is a finite (non-empty) subset of the unit circle.  The metric on exp(S^1) is the Hausdorff distance.  That is the longest distance between a point in one set, and a point in the other.   One thinks of a point in exp(S^1) as an explicit periodic beating of a drum, with one point for each beat, and the beat repeats itself every 2π units of time.  This does not suffice because two essentially-identical beats can be phase shifts of each other, so our periodic rhythm space is the metric quotient exp(S^1)/SO_2 where SO_2 acts on the circle in the natural (linear) way.    So this model for beats ignores many things — for instance the loudness and duration of a drum strike are ignored.   There is no notion of different types of drums in this model, and so on.

As our data set, we took a table of Afro-Cuban rhythms.   Here are the barcodes.

Persistent homology of afro-cuban rhythms

Persistent homology of afro-cuban rhythms

There are a few nifty things about this computation.  There are no homology classes other than in dimension 0.   So these barcodes say the data begins as a collection of isolated points, and then after a certain threshold (near ε=0.06) a transition occurs, and the simplicial complex becomes contractible.  This strongly suggests the data is a metric tree.  We checked, and it turns out the data is a metric tree.  The tree appears to be the genetic tree for how afro-cuban rhythms evolved (I don’t know this branch of music well enough to know for sure, but that’s my hunch).  Specifically, the centre of the tree of Afro-Cuban rhythms is known as son clave (or clave son), which is thought to be the first afro-cuban rhythm.  It would appear the remaining rhythms evolved from this, by making individual changes — doubling a drum strike here, or shifting one there, etc.

Other metric spaces we considered were things like the space of pairs of notes, where one note occurs immediately after another in a composition.  The feature we saw most often here in the barcodes were things like a composer’s tendency to “return” to a theme note, with little departures here and there.

On a more topological side, there were some fun observations that a certain “octave-reduced space of 3-note melodies” were homeomorphic to S^1 x S^2, so the homology of S^2 sometimes appears naturally when studying melodies in this manner.


There are several databases out there of various condensed forms of all world music — close to everything recorded in human history.  It’s interesting to speculate about what the shape of that data would be.  It would be interesting to discover if there is much relatively unexplored territory in this space — is it because we lack the imagination to find it, or is it because it’s all too atonal?  More pessimistically, it could be a gaussian distribution centred on Britney Spears.

This leads to one of my personal favourite questions: what kind of normality tests are there for data, using persistent homology? 

6 Comments »

  1. This is really interesting! Is there a paper draft available?

    Comment by Scott Taylor — January 6, 2015 @ 8:40 am | Reply

  2. Very cool! I wonder if there are other areas of the arts that could be analysed similarly. It helps that these rhythms live in a well defined, relatively low dimension space.

    Comment by Henry Segerman — January 7, 2015 @ 10:50 am | Reply

    • I think there’s a giant list of potential things to study, and geometric topologists have some of the most refined tools for attempting these kinds of experiments. I hope more people make similar experiments, in a wide variety of fields.

      Comment by Ryan Budney — January 7, 2015 @ 11:41 am | Reply

  3. Any idea why all the top 5 bar in the Afro-Cuban rhythms barcode collapse at exactly the same scale? Does this imply that all the edges in the genetic tree are the same length?

    By the way, now that you have a genetic tree, you should look at Karen Vogtmann’s work (with Billera and Holmes) on adapting ideas from outer space (as in Out(F^n)) to phylogenetic trees. http://www.math.cornell.edu/~vogtmann/papers/Trees/

    Comment by Jesse Johnson — January 10, 2015 @ 3:02 pm | Reply

    • Yes, all the edges were the same length. We had a slightly quirky variant of the Hausdorff metric, if I remember correctly. I know Karen’s work somewhat. My roomate back around 1999 / 2000 was a statistician studying phylogenetic trees, and would talk with her at length about this topic with her.

      Comment by Ryan Budney — January 11, 2015 @ 12:38 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: