[go: up one dir, main page]

Wednesday, May 9, 2012

Music21 speedups in Chordify and with PyPy

The biggest recurring complaint about using music21 is the speed at working with large scores. I wanted to point out two resources that are available in the latest SVN releases. Both will appear in the next public release, but for some people you might want to try it already:

  1. Some parts of chordify move from O(m^2) time to O(m) where m is the number of measures in a part – for very large scores, this will mean a huge speedup. (usually noticeable after about 100 measures)
  2. Music21 works with the rewrite of python called PyPy – which is a sped-up version of python 2.7. The only parts that don’t work are plotting algorithms, since matplotlib and numpy aren’t yet ported to pypy. Most operations will see about a halving of the speed – the exception is in parsing files a second and subsequent time (however, the first time is quite a bit faster).

Work on running music21 on multiple systems is proceeding, so we should be able to demonstrate that soon.

Thanks for the patience. My motto is “make it work first, make it faster later.” which I sometimes translate as, “we’ve waited 200 years to have a tool that can analyze thousands of works at once; we can wait another 20 minutes.” but that doesn’t mean we’re not working all the time to make music21 run as fast as we can.

Friday, April 27, 2012

Music21 External Overview

R. Michael Winters of McGill University has written up a short summary of some of the uses of music21 on his website. Thanks to R. Michael for his work and the shoutout!

Music21 was also a part of Florence Levé et al.'s work on rhythm extraction on polyphonic music in ISMIR 2011. See the paper here. It also helped enable Patrick Mennen's thesis "Pattern Recognition and Machine Learning based on Musical Information". Thanks also to Andrew Hankinson et al. for the shoutout in their paper Creating a large-scale searchable digital collection from printed music materials and to David Lewis et al. in their paper "Tools for Music Scholarship and their Interactions: A Case Study".

We're also thankful for the writeup about music21 by Douglas Mason in his article for the Department of Energy (p. 5) which won a 2011 DOE Emerging Writer Essay award. Douglas will be presenting aspects of music21 for data visualization at SIGGRAPH.

A new version of music21 was recently released. For the first time, regular and noCorpus versions are available (the latter for embedding in systems with low memory space or for fully LGPL'd needs). Download it at Google Code.

Saturday, February 11, 2012

music21 Theory Analyzer

The music21 Theory Analyzer, currently under development by the music21 team at MIT, has the potential to transform the way students and teachers approach music theory education. The package provides analysis tools to identify common counterpoint errors, such as parallel fifths and improper resolutions, in a student’s assignment. It can then display the results directly to the student, or send an email to the professor containing the results coupled with an annotated version of the student’s assignment.


In nearly all courses of introductory music theory, students are taught the rules of common-practice contrapuntal composition. In 1725 Johann Joseph Fux published what is often considered the first “textbook” on composition, Gradus ad Parnassum, in which he outlined the many rules of counterpoint according to the Palestrina style. Surprisingly, the approach to teaching music theory has not changed much since its publication. Students learn the rules by reading a textbook, listening to musical excerpts, and studying with their teacher. They are asked to complete written compositional assignments in which they adhere to these strict rules. The teacher then must go through the assignments, checking for each rule. The entire process is fairly laborious and tedious, which can often be discouraging for both student and teacher.

The music21 Theory Analyzer utilizes the python-based music21 toolkit to transform the way students and teachers approach common-practice music theory education. The package pre-grades student assignments by analyzing them for common practice errors, checking the accuracy of textual responses, and returning results to the student’s professor.

The project began at the Boston Music HackDay in November 2011 where a small proof-of-concept music theory checker site was developed. Since then, the project has expanded in functionality and features. The curriculum of the package is specifically tailored to one of the most commonly used books to study music theory, The Musician’s Guide to Theory and Analysis, published by W.W. Norton & Company, Inc.

The package is currently implemented as a plugin for the open-source music notation editor, MuseScore. Through the plugin, students navigate to the exercise they wish to complete, and the exercise is loaded from the music21 server.


The student reads instructions regarding the exercise, and completes the assignment, often involving part-writing above or below a cantus in addition to several textual components such as labeling harmonic intervals. The student may then submit the assignment to their professor via email from within the plugin.

The professor then receives an email with the results of the music21 theory analyzer. This email contains a list of the comments generated by the analysis regarding the student’s assignment.


The package’s modular design allows different assignments to be easily analyzed for different subsets of music theory rules. For example, a typical novice-level part-writing assignment might check for basic counterpoint errors, such as parallel motion by fifth or octave and improper resolutions of dissonant harmonic intervals. The assignment would only be checked for counterpoint rules learned for that assignment, disregarding more complex rules taught later in the course. The package can also analyze textual input submitted by the student, dynamically determining accuracy by comparing the responses to the notes the student actually wrote.


Additionally, the results email includes an attachment with an annotated version of the student’s exercise. The score is colored according to the errors identified, allowing the professor to more easily locate the students’ mistakes.

Music21 Theory Analyzer is designed as a pre-grading and instructional tool. The package may be easily adapted for use by both the student and professor, serving as a tremendous educational tool.

The package is currently under development, although we welcome comments and suggestions. Future plans include expanding the analysis routines to include a larger suite of music theory concepts. We are also investigating additional interface options beyond MuseScore. This package is being developed as a UROP project by MIT undergraduates Beth Hadley and Lars Johnson, with support from the lab’s principal investigator Michael Scott Cuthbert, lead programmer Chris Ariza, and fellow UROP student Jose Cabal-Ugaz.

Music21 + ELVIS = NEH/Digging into Data Grant

The music21 project as part of a larger project called ELVIS on the study of chords from 1300-1900 has just received an NEH/Digging into Data grant on the order of $500k (of which $175k will go towards music21 projects). Read more here.

Wednesday, October 5, 2011

Audio applications in music21

My name is Jordi Bartolomé Guillén and I spent this last summer collaborating at MIT in the music21 project. It was a fantastic experience for me!

I started my days in Cambridge learning music21 a little bit. First, I developed a converter from NoteWorthy Composer notation into music21.

Later, I developed different audio applications using music21:

- Transcriber: It is a software that records monophonic music and shows you the corresponding score in the laptop.

- Score Follower: It shows you the score that you want to play in the screen and, using the microphone of the laptop, detects which part of the score you are playing. Consequently, it slides the page automatically when it decides that is the best moment to do it.
Using this software you can play a song without having to slide the pages manually. It could be useful in concerts!

- Repetition game: Finally, I developed a two-people game which consists of the repetition of the note played by the other player and the addition of a new one. The player that fails first one of the notes loses the game!

These are some pictures of the applications. I hope you can enjoy them soon!



P.S.: Michael, Chris, Tina, Jose and Neena, thank you for this summer!