Tuesday, June 15, 2010

Mensural Canons and Other Applications of Stream Transformations


We have a number of powerful Stream transformation methods available now, including transpose() and augmentOrDiminish(). My favorite task with such utilities is creating mensural canons. The example below does just that, using a Bach soprano line as the melodic source.

Further explanation can be found here:

from music21 import *
src = corpus.parseWork('bach/bwv323.xml')
ex = src.getElementById('Soprano').flat.notes

s = stream.Score()
for scalar, t in [(1, 'p1'), (2, 'p-5'), (.5, 'p-11'), (1.5, -24)]:
part = ex.augmentOrDiminish(scalar, inPlace=False)
part.transpose(t, inPlace=True)
s.insert(0, part)
s.show()



















New Documentation Chapter on Meters

We have a new documentation chapter, with numerous examples and demonstrations, on using and processing time signatures and meter-related data:




Friday, June 4, 2010

Meter Objects at ICMC 2010


This week we presented a paper on music21 Meter objects at the 2010 International Computer Music Conference. There were a number of people happy to see an easy-to-use, powerful, object-oriented representation of symbolic musical structures.

The paper can be downloaded at the link below. I will be posting a few examples, and a new documentation tutorial, in the coming days.



Friday, May 21, 2010

Music21 Launch!

Music21 has released its first Alpha for download. The site is up at http://web.mit.edu/music21/. As an alpha release many of the features are not yet enabled and the documentation is not complete, but don't expect it ever to be since we're constantly expanding and developing the code. We plan on keeping the main syntax for Notes, Chords, and Streams exactly as it is -- it's been over two year's worth of work and refinements to get it where it is, and I think you'll be pleased. MusicXML import and export are quite well-developed and most rudimentary Humdrum/Kern support is there. Join the music21 mailing list at Google Groups to give feedback and ask questions.

Automatic adding of German Notes

Thursday, April 1, 2010

music21: Visualizing Messiaen’s Mode de valeurs

Oliver Messiaen (1908–1992) was one of the most innovative and interesting composers of the twentieth century. He worked birdsong deep into the fabric of his pieces. He played with rhythms (some descended from Hindu chant) that sounded the same forwards and backwards. And he created a whole new style of composition for the organ, invigorating the repertoire for this venerable instrument.

One of the most influential of Messiaen’s innovation was extending the ideals of twelve-tone music to go beyond pitch. The twelve-tone method, as developed Arnold Schoenberg and his followers, involved arranging pitches in fixed orders so that each note would have equal prominence and the tendency to write music too-mired in the sounds of the past would be eliminated (or at least greatly reduced). While much of the musical world reacted (and still reacts) to Schoenberg by believing he went too far in alienating modern music from the past, Messiaen and a small group of (at the time) young composers believed that he did not go far enough. By not organizing rhythms and loudness (called dynamics or, in French, intensités) similarly to the way he had serialized pitch, Schoenberg’s music could still be rooted in the rhythms and swells of the past.

Messiaen’s 1949 piece “Mode de valeurs et d’intensités” from Quatre études de rythme (“Organization of durations and dynamics” from Four studies in rhythm) was the first European work of “total serialism.” (In America, the composer Milton Babbitt had already made independent but similar creative discoveries). In this piece for piano, three “rows” are used simultaneously. Each pitch in each row is then assigned a particular duration and dynamic that always appears with that pitch (and only with that pitch.) Within each row, the durations get longer as notes get lower.

The precise relationship between pitch and duration is often hard to imagine when looking at the score, but with music21 these relationships become obvious. This code runs a Finale version of the score for the middle row of the Messiaen piece through our graphing tools:
messiaen = converter.parse('d:/desktop/messiaen_valeurs.xml')
messiaen.show()
notes = messiaen.flat.stripTies()
g = graph.PlotScatterWeightedPitchSpaceQuarterLength(notes,
title='Messiaen, Mode de Valeurs, middle voice', xLog=False)
g.process()

output of Messiaen graph
The 1:1 correspondence between pitch and duration is obvious: each pitch has exactly one quarter length associated with it, and the lengths get longer as the pitch descends. But the non-serially determined aspects of the score are equally obvious. Unlike Schoenberg’s ideal of using each pitch the same number of times, higher pitches appear much more often in the Messiaen piece. But the correspondence is not perfect. For instance, the pitch D 4 appears 11 times while the higher E-flat 4 appears only 10 times. For the most part, the amount of time that each pitch is sounded is roughly constant – at around 20 quarter-notes. But the two shortest notes (G5 and C5) appear as outliers to this theory, appearing only for about 9 and 13 quarters respectively.

What also jumps out in the graph is its shape: it is cubic, that is, it approximates the graph of f(x) = –x3. There are several functions in nature and human society that are modeled by cubic equations, such as magnetic strength, the twisting force of rubber bands (like in wind-up toy planes), and the costs involved with manufacturing. One example from one piece is of course nowhere near enough evidence to suggest that post-tonal pitch and duration relationships could be another place where cubic equations might guide composers. But it does give an idea for further research. As more serial and other post-tonal compositions are inputted into machine-readable formats, I’ll be checking back with whether this relationship holds often enough in Messiaen and other’s music to be significant.

The code for this example has been submitted to the International Symposium on Music Information Retrieval as part of a proposed paper on the music21 system.

Wednesday, March 31, 2010

TimeMap by Cuthbert and Natasha Skowronski

One of the hardest parts of learning music history (and I suppose art and other histories as well) is that though styles change over time, the changes happen extremely scattered with little uniformity. Thus students tend to believe that a more "advanced" sounding piece was composed later than a "simpler" sounding one, when the opposite is also extremely likely to be true. One of the biggest recurring problems for learning style in Early Music, for instance, is that the most commonly studied pieces in English Renaissance style are being composed at the same time or after the Italians created new techniques of recitative, basso continuo, and other markers of the Baroque.

This Timeline + Map, developed by myself and Natasha Skowronski (MIT '10) allows viewers to see what pieces were being composed at the same time or in close geographical spans of each other. Each piece (taken from a mix of my syllabus and Craig Wright's Music in Western Civilization) has a thirty second excerpt online while a few have associated YouTube videos. (Students in the class can hear whole pieces). Click the image below to investigate further.

timemap

Monday, January 11, 2010

Leading tone analysis

I just discovered that I missed the main point of Christopher Ariza's program (posted earlier) to find all the C#s in a Bach chorale. His code demonstrates that in this chorale Bach uses raised leading tones only on beats one and three, the two strongest beats in the measure. As music21's key detection algorithms and context objects come online, you'll soon be able to substitute the explicit coding of "C#" for:

   if note.pitch == note.getContextByClass(Key).scaleDegree("#7"):

We're almost there... just hang tight a few more months.

(update: we did get there…it took a little longer, but it’s there!)