Monday, January 14, 2008

Freund: Yet Another Partita Compiler (YAPC), Refactorings Noch Nach Bach

Suites & Partitas of Modern Times

    [50-sec clip, Don Freund, Sonapartita, Adagio, Daniel Rubenstein & Muhiddin Dürrüoglu-Demiriz, 1.3MB MP3]

    [50-sec clip, Don Freund, Sonapartita, Passepied, Daniel Rubenstein & Muhiddin Dürrüoglu-Demiriz, 1.3MB MP3]

    [46-sec clip, Don Freund, Sonapartita, Presto, Daniel Rubenstein & Muhiddin Dürrüoglu-Demiriz, 1.1MB MP3]

    [50-sec clip, Don Freund, Sonapartita, Siciliano, Daniel Rubenstein & Muhiddin Dürrüoglu-Demiriz, 1.3MB MP3]

This exciting and beautiful piece contains extensive musical references to Bach, and other modern composers like Lukas Foss and Stravinsky. The title alludes to ‘Nach Bach’, a harpsichord piece by Georges Rochberg. The ‘Noch Nach’ is ‘Yet Another, After Bach’. For example, the third movement (Presto) replicates the violin part of the final movement of J.S. Bach’s G minor Sonata but has Freund’s imaginative piano part interacting in curious ‘noch nach’ ways with the violin.

David Rubenstein
Besides Rubenstein’s and Demiriz’s superb and sympathetic performance of it, the Freund work is interesting on multiple levels as relates to compositional methods and musical analysis.

Muhiddin Demiriz
The structures of the Bach sonatas and partitas that this ‘sonapartita’ mimics can be cast in computational form—using humdrum, for example. And, although I do not know whether Freund used a computer software to help generate this composition algorithmically, it’s possible to see from his finished result how a series of Java constructors and ‘refactoring’ transformations could be written to do so. Freund’s german title for this piece ‘Noch Nach Bach’ reminds me, in fact, of the old Stephen Johnson AT&T Bell Labs compiler generator utility, YACC (Yet Another Compiler Compiler), part of the original UNIX operating system.


An early decision in writing a compiler is whether the language will be treated in terms of patterns of characters (individual notes) or as patterns of tokens (horizontal motifs and vertical clusters). How do you create a compiler to generate the result you want/expect? We use refactorings such as safe rename and move refactorings, plus advanced refactorings like ‘ExtractMethod’ or ‘ExtractSuperclass’—or in a music composition application, we would use more complicated refactorings to be performed across large spans of each movement such as ‘ApplyMotifSupertype’ or ‘InferTypeArguments’ or ‘GeneratePartitaCounterpoint’.

Refactoring constructors
The refactoring performed on the method A#partita() above first searches for all method invocations to partita. The only occurrence can be found in the constructor of class B. The Freund refactoring inserts the new indirection method indirection(A), which delegates to the original bach partita method. The partita-generating method invocation to partita in constructor B() is redirected to call the new indirection method. This object-oriented refactoring program amounts to a transformational network compiler—in this case, one that automatically composes partitas mimicking the patterns represented in Bach.

David Lewin’s wonderful book covers ‘transformational network’ theory from the point of view of post-composition analysis, not from the point of view of algorithmic composition. Of course, Klumpenhouwer, Lambert, Stoecker, Headlam, Rahn, and Mazzola and many other musicologists have productively applied transformational nets in analyzing music and for music information retrieval (MIR).

To date, though, software composition tools and ‘compiler compilers’ to create composition tools that can generate music that faithfully emulates design and orchestration patterns in established idioms (like Bach’s) have lagged behind. But Eclipse and other platforms for creating compilers and ‘compiler compilers’ have gotten significantly better and easier to use over the past 5 years or so. It is now far more feasible to create decent software-based composition tools than it was just a few years ago.

That side-steps the question of whether using such a tool—even as an ‘assistant’—violates aesthetic principles you hold dear. For my part, I would use such tools, provided their musicality was acceptable. After all, I use ProEngineer™ CAD/CAE software for the engineering that I do in my day-job. I use AdobeIllustrator™ and other computer-assisted art software for graphic art that I create. Those are not ‘crutches’ that in any way replace or undermine the integrity of my role as a designer. Why wouldn’t I happily use a good software composition tool? But the ‘compose’ widget in Finale and the GenJam applet for jazz improvisation aren’t that helpful. And the computational challenges are so daunting that I won’t hold my breath. Twenty years ago, William Schottstaedt worked on software-based counterpoint voice-leading and, since then, most people have used Markov-chain or other stochastic algorithms. These all focus on ‘small-scale’ decisions—Markov is, after all, a nearest-neighbor algorithm for generating a set of choices from which to choose. Schottstaedt used a best-first search algorithm to select a preferred candidate at each step. More recently, genetic-algorithm and simulated-annealing techniques are being used. But none of them is yet, so far as I know, very satisfactory. And none of them has an effective ‘scope’ that extends beyond about a 10-note or 12-note phrase. If there are 10 notes and, say, just 16 ways of moving from one note to the next in a given part or voice, then a phrase of a mere 10 notes begets 1610 possibilities—a combinatoric explosion, even for just one part and just one 10-note phrase. So, if a partita compiler compiler is going to succeed within the memory constraints on currently-available systems (even with 64-bit machines and terabytes of main memory and pagefile store), it will clearly have to go back to Fux’s ‘Gradus ad Parnassum’ or other rule-based processes to generate choices and to supervise polyphonic orchestration. Algorithms to predict the weather or earthquakes have better odds!

I  wonder whether Freund was thinking about YACC when he chose his title. I wonder whether he used any computational tools in creating this nice composition.

Don Freund



No comments:

Post a Comment