Saturday, February 15, 2014

Random Row Generator

For the longest time I've considered myself computer illiterate. Not in the sense that the term has conventionally been used (e.g., for grannies just learning how to use the mouse), but rather in the sense that the term must be used in a computer-saturated society, one in which the bar for literacy has been raised. Maybe it's optimistic to say this, but I think that “computer illiteracy” these days implies ignorance of programming and other higher level tasks, rather than a total unfamiliarity with the operation of a computer.

In an attempt to remedy my own illiteracy I recently started working through a couple of the courses at Codecademy, which is kind of like a Duolingo for computer languages. Specifically I've done about a third of the JavaScript course, and I've used what I've learned so far to build a random twelve-tone row generator. It is of course little more than a number scrambler (the digits 0–11)—and I'm absolutely sure that its code is inelegant, that there are more efficient ways (to which I'm currently ignorant) of coding its task (I'm thinking particularly of my having to input code for each note, which I doubt is really necessary)—but still it's kind of a cool little thing that some may find useful. In the future I hope to code some tools of more uniquely musical utility (maybe to uncover contrapuntal possibilities between pitch-class sets). Anyway, click the button below to generate a random twelve-tone row:



2/16: After sharing this post with the good people at r/MusicTheory, Reddit's music theory community, a couple users suggested some more efficient ways of generating a random twelve-tone row. Check out what they have to say, and thanks to u/kilimanjaroxyz and u/BinaryBullet for their suggestions! The latter also realized his code in relation to another *.js file that allows you to hear your row. Check it out on Plunker.

Here is [my original] code if anyone is interested:

function randomRowGenerator() {
   
confirm("Please click OK to generate a random twelve-tone row.");

var randomRow = [100,101,102,103,104,105,106,107,108,109,110,111];

for (y = 0; y < 12; y++) {

while(randomRow[y] > 99) {
x = Math.random()

//0//
var noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 0) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x <= 0.083)) {
        randomRow[y] = 0
    }

//1//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 1) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.083) && (x <= 0.166)) {
        randomRow[y] = 1
    }
   
//2//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 2) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.166) && (x <= 0.249)) {
        randomRow[y] = 2
    }
   
//3//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 3) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.249) && (x <= 0.332)) {
        randomRow[y] = 3
    }
   
//4//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 4) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.332) && (x <= 0.415)) {
        randomRow[y] = 4
    }
   
//5//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 5) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.415) && (x <= 0.499)) {
        randomRow[y] = 5
    }
   
//6//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 6) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.499) && (x <= 0.582)) {
        randomRow[y] = 6
    }
   
//7//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 7) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.582) && (x <= 0.665)) {
        randomRow[y] = 7
    }
   
//8//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 8) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.665) && (x <= 0.748)) {
        randomRow[y] = 8
    }
   
//9//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 9) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.748) && (x <= 0.831)) {
        randomRow[y] = 9
    }
   
//10//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 10) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.831) && (x <= 0.914)) {
        randomRow[y] = 10
    }
   
//11//
noteCount = 0
for (i = 0; i < y; i++) {       
        if (randomRow[i] == 11) {
            noteCount = (noteCount + 1)
        }       
    }
if ((noteCount == 0) && (x > 0.914)) {
        randomRow[y] = 11
    }

}

}

alert("Your random twelve-tone row (in integer notation) is: " + randomRow);

}

Saturday, February 1, 2014

George Tremblay's “Definitive Cycle”

Recently, on a whim, I checked out George Tremblay's book The Definitive Cycle of the Twelve Tone Row (1974) from the library. If you don't know Tremblay (1911–82), who I only knew by name before reading this book, he was a Canadian composer who studied with Schoenberg after the latter's move to the U.S.[1] In this case the apple didn't fall far from the tree and Wikipedia says that in 1965 Tremblay founded the School for the Discovery and Advancement of New Serial Techniques. Indeed, such a school is perhaps the only place one might find the above text in active circulation.

The Definitive Cycle is a bit quaint, which is part of what attracted me to it in the first place.[2] One thing that dates the book straightaway is the foreword by one “E.H.H.,” which begins: “Between these covers lies the most innovative concept in the theory of dodecaphonic music.” We don't really make claims like that anymore (at least in print). Moreover, the table of contents lists such sections as “The Chorale” and “The Fugue,” which are difficult to imagine as having anything to do with dodecaphonic innovation (one could of course imagine such innovation being applied to these, but if such sections must be included they might be more appropriately placed at a lower position in the argumentative hierarchy).

The “definitive cycle” of the title (both mine and Tremblay's) is “an array of twenty-four sets of twelve rows each” that is generated by two basic algorithms, one which generates the rows within a set and one which generates from these rows the first row of the next set. Though it's problematic to speak of a true starting point or ‘mother’ row in this scheme, Tremblay conceives of the cycle as having been “developed from one row: the chromatic row,” which serves as the first row of the first set.[3]

(‘Ascending’) Chromatic Row:
<0,1,2,3,4,5 || 6,7,8,9,10,11>
(in integer notation and split into hexachords, H1 and H2)

The second row is derived by applying an algorithm to the first, namely by alternating the pitches of the first row's two hexachords, beginning with H2, such that the following row emerges: <6,0,7,1,8,2 || 9,3,10,4,11,5>. This is a pretty simple procedure, and it seems unlikely that we would have to dig up an obscure text by an obscure composer to see it written about. Nevertheless, the only concept I've come across in my limited exposure to post-tonal theory that resonates somewhat with Tremblay's process is that of the cross-partition.

A cross-partition is defined by Brian Alegant, its original theorizer, as “a two-dimensional configuration of pitch classes whose columns are realized as chords, and whose rows are differentiated from one another by registral, timbral, or other means.”[4] Right away it's clear that aspects of this definition are irrelevant to Tremblay's algorithm, which is abstract and implies nothing about how its input or output rows are realized. Moreover, along those same lines, a cross-partition is a way of deploying a row, not a way of transforming one row into another (though so-called “slot-machine” transformations of a cross-partition are possible). Nevertheless, what does seem relevant is the idea of a one-dimensional row reconceived in two dimensions. As one can see in Alegant's (or Wikipedia's) article there are a limited number of ways to configure a cross-partition (6x2,4x3,3x4,2x6). Of these, the 6x2 configuration best illustrates what Tremblay is up to, particularly as represented in the following matrix (for the sake of formatting, T = 10 and E = 11):

6-0
7-1
8-2
9-3
T-4
E-5

Note that these matrix elements represent order numbers (i.e., positions within the row) of the input row, not pitch classes (though in this case [i.e., the case of Set 1, Row 1] these are the same). Basically, the two hexachords are set up as the partitional harmonic units (in the above order, or one that preserves its adjacencies), and then the output row is generated by tracing the cross-partitional strands left-to-right and top-to-bottom (the directions would change of course if the hexachords were swapped or the vertical order was reversed). This is admittedly a kind of trivial application of the cross-partition concept, but as I've said it's the only post-tonal concept I'm familiar with in terms of which Tremblay's process can be described (their essential point of contact is a shared reliance on the interpolatory reconfiguration of a row).

Anyway, however you want to understand what Tremblay is doing, the way each set of his definitive cycle is spun out is by recursively applying the above algorithm to each new output row, until you end up back where you started. If you do this starting with the ‘ascending’ chromatic row, the following set of twelve rows is what you end up with:

— Set 1
  1. 0,1,2,3,4,5 || 6,7,8,9,10,11 (chromatic scale)
  2. 6,0,7,1,8,2 || 9,3,10,4,11,5 (alternating tritones)
  3. 9,6,3,0,10,7 || 4,1,11,8,5,2 (discrete tetrachords = fully dim. 7th chords)
  4. 4,9,1,6,11,3 || 8,0,5,10,2,7 (discrete trichords = maj./min. triads, namely AM–BM–Fm–Gm; also, H2 the same in Sets 9 and 17)
  5. 8,4,0,9,5,1 || 10,6,2,11,7,3 (discrete trichords = aug. triads)
  6. 10,8,6,4,2,0 || 11,9,7,5,3,1 (the two whole tone scales; H1=WT-0, H2=WT-1)
  7. R of 1
  8. R of 2
  9. R of 3
  10. R of 4
  11. R of 5
  12. R of 6
(Note that the color-coating is meant as a visual aid only.)[5]

Each set consists of six unique rows and their retrogrades. In Set 1—given that its starting point is the ne plus ultra of chromatic symmetry, the chromatic scale—it shouldn't be surprising that these rows are highly systematic. Particularly cool is Row 4, which demonstrates a triadic progression that completes an aggregate in the most efficient manner possible (i.e., in four chords). Having completed the set—as cross-partitioning Row 12 will simply yield Row 1—the first row of the next set is constructed in terms of the initial pitches of each of Set 1's rows in order (this is the second of the two algorithms I mentioned at the beginning of my post). So Set 2, Row 1 is <0,6,9,4,8,10,11,5,2,7,3,1>. This of course provides the starting point for the spinning out of the other eleven rows of the set, at which point the third set can be constructed, etc. etc. etc. until you have twenty-four sets of twelve rows each.

So what is the advantage or appeal of the definitive cycle in relation to the conventional paradigm of P-I-R-RI relationships? I think Tremblay would say that the cycle's selling point is its systematic unification—according to a pair of recursive principles—of a large variety of rows. Recursive networks such as the definitive cycle (or the circle of fifths for that matter) are useful to the composer because all that is needed to create colorful and coherent music is a mastery of the basic recursive algorithm (e.g., the dominant-tonic relationship in tonal music). If one were to develop through experience a facility in effecting the two basic modulations in Tremblay's system, one could coherently link any of the cycle's 288 rows. By contrast, a conventional twelve-tone matrix, according to the elusive E.H.H., is based upon a set of simple “devices” applied to a single row. He claims that “in [Tremblay's] cycle, the retrograde is created by logic and order rather than as a device” and that it contains “no inversion, no retrograde inversion, and no transposition.”[6] I don't think the standard P-I-R-RI paradigm is as substantially different from Tremblay's cycle as E.H.H. claims (i.e., they're both just row networks based on different principles of transformation), but the latter certainly allows for a much greater deal of pitch variety, which may be attractive to composers.

2/2: Just to clarify, the differences between Tremblay's cycle and a standard twelve-tone matrix are not trivial. The greater pitch variety of the former is mostly a function of its continual transformation of the intervallic content of its rows, whereas a standard matrix preserves its rows' shared intervallic identity (i.e., it makes explicit all the ways in which a certain series of intervals can be expressed). Nevertheless, my point is that I don't buy—as E.H.H. claims—that Tremblay's transformations are distinguished from the P-I-R-RI paradigm by their “logic and order.” I think that any hierarchical privileging of Tremblay's algorithms over the conventional “devices,” or vice versa, is ultimately based on nothing more substantial than “This relationship strikes me as more meaningful than that one.” They're both just transformative approaches to twelve-tone rows. Even if one says “Yeah, but P-I-R-RI preserve intervallic identity, so they're a fundamentally different thing than Tremblay's system,” this argument depends on the assumption that interval content is a strong basis for row identity (which is itself dependent upon the historical hegemony of P-I-R-RI). One could imagine, perhaps, an alternate history in which Schoenberg's big innovation was the definitive cycle, and generations of theorists and composers grew up feeling that chromatic scales and whole-tone scales were closely related much in the way that P0 and I6 of a row seem to be related from our actual perspectives. One counterargument for this dehierarchization is that the familiar twelve-tone operations in fact have a longer history in tonal music, and also that they relate rows in a way that's easier to render audible than the definitive cycle. Still though, I think the preference for one over the other is more a matter of taste than a question of “logic and order.”

***

[1] Incidentally, a more famous Canadian musician also died in 1982, Glenn Gould.
[2] I have a bit of a fetish for out-of-date books. Whenever I buy collections of poems, myths, etc. I go for older editions because their introductions are usually more entertaining.
[3] I say it's problematic to identify a fundamental row because the cycle is … well, cyclical; if you stick to the algorithms you eventually end up back where you started. The definitive cycle, in other words, could be generated from the first row of any of its twenty-four sets, or even from any of its 288 rows if we conceive of rows themselves as edgeless and cyclical (i.e., as directional series of adjacent pitches that theoretically loop) and of the boundaries between the sets as arbitrary divisions. Thus, to describe (as Tremblay does) “the entire fund of material” in the cycle as deriving from the chromatic row (as an ordered set, which Tremblay seems to imply) is arbitrary, a bit like describing Europe as the West and Asia as the East.
[4] Brian Alegant, “Cross-Partitions as Harmony and Voice Leading in Twelve-Tone Music,” Music Theory Spectrum 23, no. 1 (Spring 2001), 1. Alegant actually credits Donald Martino (“The Source Set and its Aggregate Formations”) with first exploring two-dimensional representations of linear sets.
[5] What I mean is that the color-coating is a bit haphazard and is intended only to facilitate the visual parsing out of the relevant subsets (i.e., one shouldn't assume that everything blue in this article, for instance, is related somehow). Within rows I will sometimes use more colors to avoid confusion (e.g., the fourth row splits into blue-green vs. red-orange to indicate minor vs. major triads in the respective hexachords).
[6] These “devices” are sometimes present incidentally, but not systematically.