I am looking for a software which allows me to do statistical analysis on music. Assuming the music is given in midi or similar form (ie. the note/pitch/duration... data is available for processing). What I then want to be able to do is feed it a library of music, lets say all works by a certain composer, and define search patterns and the software then gives me the statistics of how often certain things happen. For example if I feed it with 4 voice chorals, I want to know which note is doubled most commonly. Or what is the distribution of how far voices jump. I see those kind of statistics appear sometimes in older (and maybe also newer) music theory/harmony/counterpoint books. For example there are some in de la Motte's Harmonielehre. Obviously in old times (before computers) those statistics were all produced by hand. But that seems quite unpractical nowadays. Is there any standard software solution that is used to do this kind of analysis? I imagine one could do it with python or R. But is there any established way, ideally with some databases of statistics already calculated...
1 Answer
You will find a useful set of resources for Python at the Python In Music page. This includes tools for feature extraction from Audio files as well as for MIDI & Music XML processing.
For your specific task I suggest taking a look at music21 and it's documentation
It comes with a huge corpus of Music XML files and you can add your own from local or online files. (e.g. the reference corpus for Bach includes 433 works)
Music21 has lots of analysis tools of it's own or you can interface it with others such as pandas.