Mountains out of Molehills: Pullbacks for numpy

At the time of my writing my undergrad thesis, I bit off more than I could chew computationally. Though my whole intention was to come up with a computational model and algorithm for spelling the notes in a musical score (‘choosing sharps and flats’), the math ended up keeping me sufficiently busy. I laid out a theoretical roadmap for implementation, without explicitly doing any programming. In particular, I left myself quite a hefty empirical study to do, in which I would train the algorithm on a large corpus of musical scores. I am now embracing the messiness of real data from real musical scores and tackling this problem with a trusty Python stack. Here I’ll talk about a numpy abstraction that keeps coming up in development.

Read More

music21, pandas and condensing sequential data

music21, developed by Michael Scott Cuthbert, is an extensively featured and well maintained Python package for computational music theory. Lately, I’ve been using its highly useful musicXML parsing capability and model of notated music in tandem with pandas DataFrames. I wanted to share a trick I’ve found for condensing rows of the dataset while keeping the sequential order intact.

Read More