Last year I learned about music21 and ever since I have been wondering how I can use it to learn more about the Moroccan musical repertoires that I study. Long story short, I ended up building a tool for creating interactive web-based contour visualizations from the command line and I'd like to share it here.
Climbing out of a rabbit hole
|Malhun Performance in Fez, Morocco|
|Malhun Contour Example|
Building a tool
|ContourViz, simple example|
|ContourViz, more complex example|
I am a gigging musician and bass player who has discovered music21, but, alas, I am certainly not a musicologist or academic.
I have seen many of the amazing examples that showcase music21’s capabilities with classical and twentieth-century music, and wanted to show how I use music21. Hopefully these examples show that music21 can also be used to explore jazz and popular music, either via analysis for educational purposes or for developing improvisational ideas.
Jazz Standard Voice Leading LinesMusic21 has an amazing corpus of public domain classical music, but most jazz standards are not available for inclusion. But, since music21 has an understanding of seventh chords and reads MusicXML, a virtual corpus of jazz standards is available for analysis and exploration via another application called IRealPro. IRealPro is a virtual accompanist software program that has chord charts for over 3000 jazz standards, and which can export the chord progressions in MusicXML, a format that will allow music21 to understand the harmony. Once we have that outline of a jazz standard's harmonic structure, music21 can be turned loose.
For this example, lets export the chord chart to the standard “Alone Together” and generate a 3rd to 7th voice-leading line through the entire tune, based on this concept by Burt Ligon, as described here.
Alone Together.XML and Guide Tone Lines with Music21.py)
Since music21 understands harmony, any kind of voice leading line is possible, for instance the 5th resolving to the 9th. Now these voice leading lines can be generated for any jazz standard (or for any chord progression) that can be exported as MusicXML format and these lines can be used as jumping off points for making solos or studying voice leading.
Jazz Solo AnalysisAnalyzing jazz solos from the masters is another way to get improvisational material, but it is better known as stealing someones licks! Since music21 can understand the relationship of any note to any chord, it can be used to analyze the functional relationship of the notes in a solo.
Here is an example of Miles Davis’s solo on “Freddie Freeloader” with the notes being labeled so they represent their function against the chord being played, for example, an F note on a Bb7 chord being the fifth.
Miles Solo XML and Melodic Labeler.py)
This same Music21 code was used to analyze Charlie Parker's solo on Bloomdido, and a walking bass line over F blues by Ron Carter.
Now any solo line that can be exported as MusicXML can be analyzed by music21 and then explored even further. What notes are favored? What beats of the bar do certain notes get played on? How many times do certain notes get played? Are there repeating phrases that a certain player uses over and over? All of this can be cataloged or graphed once it has been brought into the music21 world. The included code needs a chord symbol over every measure.
Hopefully these examples show that music21 is not only for musicologists exploring the pitch class space of Bartok's string quartets or for twelve-tone row composers! Students and musicians can use it for very useful and practical purposes as well. Many thanks to Michael for allowing this guest posting from big music21 fan!
(Ed: Thanks Dan! The examples included here are copyrighted by their respective composers and publishers. We believe their inclusion here for educational and instructional purposes are supported by all four factors of the Fair Use test).
My two biggest problems preventing success have been (1) Maintaining an Inbox Zero philosophy, where at least daily, I get my Inbox to zero, by deleting messages, doing a very quick reply, or immediately creating a task for a message that requires more than 2–5 minutes to take care of, and (2) being realistic about the number of tasks that I can possibly say yes to and have the time to actually do.
Sometimes, I can maintain Inbox Zero for six or eight months. Other times, I get way behind on Inbox Zero and need to resort to an Inbox DMZ to reset the obligations that I have. Usually the thrill of an empty inbox at that point will let me get out of DMZ in a few weeks. Maybe someday I'll write about how this happens to me and how I break the cycle (at least so I can read this post again later), but at this moment, I'm almost out of Inbox/Email Hell. So my big problem lately is the second one.
When I was a graduate student, or just starting out as a professor, I was so thrilled that someone was asking little ol' me to be on a committee, help them with a problem in my field ("Can you transcribe this medieval song?"), or, big honor, fly out and give a talk at their school. I am still honored to be asked, but fortunately or unfortunately, at this point in my career, I'm asked to do far too many things that I could possibly do.
One of the hardest parts about saying "no," is that I have always been far too much of an optimist about how long a particular task will take. Sure, it'd just take twenty minutes to write that recommendation letter, IF I were in the right mental state, not distracted, had all my ducks in a row, etc. Realistically, I've never gotten one done in under an hour, and three hours is more usual. An article review? I need to learn that I write far too many notes to the author, duplicate too much of the research, order sources from ILL, etc., and so eight hours is a realistic timeline for me for a twenty-page review.
I've figured that I have about sixty hours of work in me per week (not just academic work but also counting certain stressful obligations, such as being a trustee, dealing with a plumber, etc. that I don't consider fun time). Of those sixty hours, I know that recurring obligations such as teaching and advising will take up about 30 hours a week most of the year. This leaves about 30 hours per week (1500 hours per year) to do everything else I've either agreed to do, or need to do to continue to develop as a professor (researching and writing articles and books, developing music analysis software, etc.). Twenty letters of recommendation and ten article reviews per year eats up 10% of that time. Joining a board is probably 50 hours a year. Etc. etc. Adding it all up and it's easy to see why the years when I say "No" often, I can write, say, two chapters and three articles, and those that I don't, I'm lucky to get a single article out.
(And then there's the damage I do to others when I say "Yes, sure!" and then end up stretching or breaking deadlines or needing to cancel later; this is the worst of all possible options.)
Each day I try to create a realistic plan for the day during a morning review. It always begins with Inbox zero as a task. (Since 2012, I've tried to make every task begin with an action verb. "Inbox zero" has somehow remained as an exception, since I always know what to do about it). Each task usually has two tags attached to it, a location tag ("@Any" is the most common. "@Home", "@MIT" also appear), and a time tag ("5 min," "15 min", "1 hr", etc.). When I've organized the ToDos in a good order for the day, and adjusted the times to what I think are realistic, I run the thingsToCal.scpt which puts all the todos on the calendar, making sure that they don't interfere with any events already in the calendar. The results are below:
I can now see that, hmm... given that it's my turn to cook, I'm going to need to be willing to work until around 9:30 if I'm going to get all these things done; for a weekday, that's fine. For Sunday night, I think I'd rather not. Something (probably that "Get an Outline" for Tuesday's talk event) will need to go till to tomorrow. (And that was before I added an hour-long "Blog about this system" todo). After rearranging, etc., I rerun the script and the events for the day get removed and readded in the new order.
I'm hoping that this system works well. If you are geeky and want to try it out, the code is at this link. It runs only with Things (if Time tags are set up properly) and OS X/macOS Calendar (with a calendar called Things) and you'll need to use it at your own risk (Sorry if something gets screwed up in your calendar), hence I'm not providing installation instructions beyond this link. But if I can get it to run faster (currently, figuring out my existing schedule on Calendar takes 20-30 seconds) and perhaps to work with next items beyond today (and maybe preserving non-working hours, etc.) then I'll make it a nicer script.
Wish me luck! Especially if you've been waiting on a reply or for me to do something for you.
It Could Be Very Fresh:
Structure, Repetition, and Reception in Einstein on the Beach (1999; part 2)
While he is correct in stating the five chords can be heard as a modulation from f minor to E major, it is certainly questionable whether any listener will hear it as such, or especially whether the twentieth repetition of the cell will produce such an effect on the listener.16 The ability to hear this passage tonally is particularly hampered by the voice-leading from the fifth chord to the first chord of the repetition. While the other four transitions between chords followed traditional four-part voice-leading rules,17 the motion from E major to f minor contains three major “errors”: There are parallel octaves between the “alto” and “bass” voices, parallel fifths between the “tenor” and “bass”, and a doubled leading tone. After hearing this non-common practice transition, it is unlikely that the listener will perceive further repetitions tonally; the use of IV♭ as a pivot chord was already a stretch to hear the first time.
The lengthening of chords (and thus cells) follows two distinct processes and thus divide the section. The first cell, A (repeated three times) acts as an introduction and a presentation of what becomes the standard form of the motive—when five is heard at the end of “Building,” A is the only form presented. The next five cells, B-F, present the process of lengthening the motive from 3♪ to 4♪ beginning with the fifth chord and progressing toward the first. Cell F alters the process slightly by reducing the fourth chord to 3♪ while augmenting the first to 4♪. Avoidance of the projection of regular meter within a cell seems to be the overriding reason for this decision.
The next five cells, G-K, present a similar process, lengthening from 4 (or 3) eighth notes (via 6♪ ) to 7♪ beginning with the first chord and moving roughly from front to back: 1, 2, 4, 3, 5. The cell which at B lasted 16♪ is expanded by K to 33♪. The shift back to the quick transitions between chords of L feels like a tightly stretched rubber band being suddenly released. Without a change of tempo, the speed of the cell has been dramatically increased and, with the return of the rhythmic profile of the introduction, the process feels complete. By repeating L six times rather than three Glass makes the coda more satisfying to the listener: while each chord is much faster (3 or 4♪ rather than 6 or 7♪), by the fourth repeat (which does not exist in any other cell) we are able to hear the cell not as a five-chord motive but as two five-chord motives, a total of 36♪. Thus rather than lessening the tension of increased cell length (B-K), L acts as a culmination of this process. By focusing our aural “gaze” on two different levels of activity, the pattern can be heard as both accelerating and broadening simultaneously and without contradiction.
(The analysis of Einstein will continue in the next blog post)
It Could Be Very Fresh:
Structure, Repetition, and Reception in Einstein on the Beach (1999; part 1)
Structure of the Opera
2 Throughout this paper, small caps will be used to denote motives in the opera. These motives can be found in charts in the appendix.
Addition of Wilson's Comment
Visual and Non-musical Structures
To be fair, ‘Einstein’ was a co-creation of Mr. Wilson and Philip Glass, the composer. But most people not only saw it as basically Mr. Wilson’s work—so much so that Mr. Glass was openly aggrieved, and has declined further collaboration with Mr. Wilson—but as the capstone to a series of remarkable large-scale Wilson theatrical creations that dated back to the 1960s. (New York Times, 26 November 1978, p. 5)
The transformations of the train into building and spaceship in Act 4 also have their roots in relativity thought experiments. The building, seen from both the front and side simultaneously, is a demonstration of how observers at rest see light reflected off objects moving at high speeds.11
The spaceship image, in addition to being a standard demonstration of relativistic length contraction (along with a rotating ruler or stick or an oblong clock which are also seen in the opera) hints at the prospects for future nuclear apocalypse which Einstein’s work on nuclear physics made a frightening possibility.12
The length contraction demonstrated by the spaceship manifests itself in several other ways in the opera. The tall, narrow chairs used throughout the opera are examples of this physical phenomenon on stage. Further analysis of how the staging parallels the teachings and life of Einstein will have to await a video viewing of the opera.
Ambiguity and Certainty in Minimalist Processes
Dublin Conference on Music Analysis, June 2005
(2015): The paper began with several definitions of process in minimalism which were given in expanded form in other articles. They will be put in a separate post. It ended with discussions of process in Lucier and Beethoven, which will also be put in a separate post. What remains here are the elements of the paper that fit into the narrow niche of Ambiguity and Certainty. For this reason, Figure numbers do not begin at 1.
I’m mostly going to confine myself to “top 40” minimalist pieces; the hits, in order to keep things in more familiar territory. Let us consider a passage from Glass and Wilson’s Einstein on the Beach, given in a modified score as Figure 4. The music is taken from the connecting passage between the first and second acts, Knee Play 2.
Although the work uses only two rhythmic values (quarter and eighth notes) and simple diatonic intervals favoring stepwise motion and motion by thirds--in a word, simple--the melodic line is constructed with practically no repetitions among various sections. The line has enough distinct material that even very short melodic sections played by any musician and which jump out of the texture give enough information to identify where each instrument is in the melody. Figure 7 gives a list of the places where hearing two or more notes is insufficient to precisely locate a player within the sixty-five-note score.
There are fifteen two-note segments which do not identify the player's location. These represent thirty-three of the sixty-four possible two-note starting places, or about half. If three contiguous notes can be heard from a single instrument in the texture, then there are only five segments that do not identify the location of the player. In fifty-five of the sixty-three possible places, the musician's position in the score will be known to the listener. With four contiguous notes, there are only two places of ambiguity, and with five notes, the listener always can have complete certainty of a musician's location.
I am not saying that Rzewski has purposely arranged his material to create maximum distinctiveness—in fact, I had a computer program generate 1000 random melodies, sharing only Rzewski’s notes and rhythms and his predilection for stepwise and 3rd motion, and the results were similar.5 The distinctiveness of short motives is not a result of his ordering, but rather of his choice of melodic material (non-tonally oriented skips and no apparent reason behind the choice of longer notes) and the lack of any distinctive ordering. We can contrast the 65 notes of Moutons with the first 65 notes of the clarinet entrance of Mozart’s concerto. Hearing any isolated note in Mozart’s work will give you a better idea of your location in the work, but there are many more locations where hearing three, four, or even five or six notes will not pinpoint your location. A movement from a Bach solo ’cello suite would almost certainly have a lower level of distinctiveness by this metric.
A similar effect can be heard in Satie’s oft-cited “proto-minimalist” work, Vexations, whose bass line is given in Figure 8.
Here Satie has composed the line out of extremely distinctive intervals, approaching the construction of an all-interval set. Any two consecutive pitches or intervals in the bass will uniquely identify where the performer is within the line. The piece is thus constantly sending signals about where the performer is in within this short line. The larger form of the piece is completely different, consisting of 360 repetitions of this bass line organized into 840 larger repetitions played over 12 to 24 hours. Maddeningly, these interval-based signals constantly give localized information about the position in the line but give absolutely no information about where we are in the overall form of the work.
Cuthbert received his A.B. summa cum laude, A.M. and Ph.D. degrees from Harvard University. He spent 2004-05 at the American Academy as a Rome Prize winner in Medieval Studies, 2009-10 as Fellow at Harvard's Villa I Tatti Center for Italian Renaissance Studies in Florence, and in 2012–13 was a Fellow at the Radcliffe Institute in 2012-13. Prior to coming to MIT, Cuthbert was Visiting Assistant Professor on the faculties of Smith and Mount Holyoke Colleges. His teaching includes early music, music since 1900, computational musicology, and music theory.
Cuthbert has worked extensively on computer-aided musical analysis, fourteenth-century music, and the music of the past forty years. He is creator and principal investigator of the music21 project. He has lectured and published on fragments and palimpsests of the late Middle Ages, set analysis of Sub-Saharan African Rhythm, Minimalism, and the music of John Zorn.
Cuthbert is writing a book on Italian sacred music from the arrival of the Black Death to the end of the Great Schism.
Download what is almost certainly an out-of-date C.V. here (last modified June 2012)
Bologna Q15: the making and remaking of a musical manuscript, review for Notes 66.3 (March), pp. 656-60.
"Palimpsests, Sketches, and Extracts: The Organization and Compositions of Seville 5-2-25," L’Ars Nova Italiana del Trecento 7, pp. 57–78.
Der Mensural Codex St. Emmeram: Faksimile der Handschift Clm 14274 der Bayerischen Staatsbibliothek München, review for Notes 65.4 (June), pp. 252–4.
"Generalized Set Analysis and Sub-Saharan African Rhythm? Evaluating and Expanding the Theories of Willie Anku," Journal of New Music Research (formerly Interface) 35.3, pp. 211–19. [.pdf]
Unless otherwise mentioned, the writings, compositions and recordings on this site are licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.
Copyright 2010-11, Michael Scott Cuthbert. Web design by M.S.C.
Fonts for musicology: Ciconia (14th/15th c.) and ClarFinger (clarinet music).
In my copious spare time as a junior faculty member on tenure track, I do web design and programming consulting for the National Bureau of Economic Research.
Lectures on the web
enChanting: Musical Artifacts in Unlikely Places, lecture March 3, 2009
Ambiguity, Process, and Information Content in Minimal Music, podcast of a lecture to Comparative Media Studies at M.I.T.
Just for fun...
Mondrian meets Finding Aids in a map of books in my former apartment.
Numeric Deathmatch, a game I coded that was taught to me by Jon Wild. More fun in person, but the web interface encourages trashtalking.
Musicology Buzzword Bingo, useful for AMS meetings (requires Bach and Futura fonts)
Automatic New Musicology Paper Generator based on the Dada engine