[TRANSCRIPT] Hi everybody, this is Jon Kulp in Lafayette, Louisiana and I'm excited today because I've got a special microphone on loan to me from the guy who does our music media area at the University of Louisiana at Lafayette where I teach. This is a really fancy, expensive-looking Shure microphone that is…what would you call this thing…it's in a shock-mount mic clip and I think it's gonna make my voice sound pretty good. The microphone I've used before is a Shure SM58, which is more of a live-sound-reinforcement microphone, and this one is much more of a studio microphone and Chris recommended that this is the one I should use if I want to do just spoken word.

And so I thought I would take advantage of this opportunity to knock out one of the topics that has been on my to do list for a really long time, and that is the 12-Tone Technique and my use of a script to generate a random 12-tone row.

Now this whole scripting of the random 12-tone row is something that came about when I got my Raspberry Pi for the first time about two years ago, and the idea was that I had the Raspberry Pi set up next to my bed and it was networked, and so I could theoretically have it play music off the Internet and I…and I used to do that—I would have it stream radio stations and stuff like that like into my pillow speaker, and I thought, well, I could use it as an alarm clock as well, and I could have it just play some random audio file from my computer. But then I had the…what to me was a brilliant idea and—this is from a music nerd point of view—of having it generate a new alarm every day and have it be my "Random 12-Tone Row of the Day."

Now for this to make sense I would probably have to back up a little bit and explain what a 12-tone row is. The 12-tone row is the building-block of 12-tone music. And I have to back up even further now because I have to explain what 12-tone music is.

At the early part of the 20th century—talking now about the years 1908–1912, 1913—a number of composers were experimenting with atonality, which is music that does not have a tonal center. So you can no longer say, for example, this piece is in the key of D major or F minor or whatever it might be. This is music that does not have a key. There were corollary movements in the other arts, things like in visual arts the move toward abstraction, toward non-representation, and so atonality in music is very similar to abstract art.

Now the leader in this movement was a guy named Arnold Schoenberg, who was a composer in Vienna, and he had a couple of students Alban Berg and Anton Webern, and these guys were very much interested in atonal music. And they did not necessarily see this as a break with tradition but rather as a logical next step in the evolution of music that had been lately brought to what was nearly atonality by the German composer Richard Wagner. Wagner's music sounds very beautiful and mostly tonal, but if you actually look at it there are many places in his music where you cannot say for sure what key it's in, even though you hear very beautiful harmonies and melodies and so forth.

And so Schoenberg and his followers felt like the logical next step was to intentionally abandon tonality and to avoid anything in their music that would suggest tonality. And so they consciously avoided octaves and triads and things like this that suggested traditional tonality. They were…you know, they had some music that was…modestly successful, I suppose, in their little circles. The general public typically did not like this music very much. It was not very well received, because people heard it as something that was very dissonant. They couldn't understand it, they didn't know where the composers were going with this stuff, and just thought it was ugly.

And the composers themselves, while they did not necessarily think the music was ugly, they did recognize a certain problem inasmuch as they no longer had the basic foundation of musical form that had been in place for a couple of hundred years and that is key relations, tonality. In forms such as sonata form, binary form, things like this, the long-term structure of the piece is based on movement from one key to another and then back to the home key, and when the music is atonal and has no key, you don't have this anymore. And so one of the solutions they had was to write just really short pieces, where movement from one key to another would kind of be irrelevant. Another thing they did was write vocal, music where the poetry that they were setting would give the music its structure.

But around…I don't know, 1920 or so, Arnold Schoenberg started to experiment with a new system that would impose a certain rigor upon atonal music, and that was the 12-tone system. In the 12-tone system, all 12 pitches of the chromatic scale are considered equal. And before I go any further I'm going to play you a chromatic scale. A chromatic scale is the scale between a note and an octave higher…all half-steps—it's the scale that has all half-steps, and here's what a chromatic scale sounds like.

[plays MIDI of chromatic scale]

A chromatic scale from C to C

Pretty, huh? All half-steps. Now his idea was to have a single melody that is the structural basis of the piece. This may sound very familiar if you heard my episode about the fugue, where there was a subject that was the main idea for the whole piece, and in certain ways it is similar. He also subjects the theme—which is in this case called a row, a tone row, or sometimes the 12-tone row—he subjects it to the same kind of manipulation that, say, J.S. Bach would've done to a fugue subject. The row is transposed, it's inverted (in other words it's turned upside down so all of the intervals they went up in the original would go down in the inversion), it's done in retrograde and so forth.

And so what you come up with is a kind of music that is extremely well structured. It…it's kind of fun to analyze these things because you can see where the row is and you get to put together this fancy thing called a matrix, which shows you all the possible permutations of the row, and you can use the matrix to help you analyze the music. And so it looks great on paper. It's really kind of fun.

For me the problem has always been that while I can recognize this rigid structure and appreciate it intellectually, I simply cannot hear it, and so 12-tone music to me still is not all that satisfying. However, as a project for a Raspberry Pi where I'm trying to do something kind of nerdy and script something, the "Random 12-Tone Row of the Day" seemed like a genius idea to me.

And so I wrote a bash script (of course that's kind of what I do) and the bash script takes all 12 pitches of the chromatic scale and shuffles them, and then generates a score, and I use Lilypond as the main engine for all of this. So my script…I think I'm just…in the show notes I'm going to link to my "12-Tone Row of the Day" webpage…and every night at either midnight or 1 AM or something like that, the script runs on my server and posts a static HTML page with the 12-Tone Row of the Day as a little bit of score, and it also has a play button under so you can listen to it.

And in general terms the way the script works is that I spell out all 12 pitches in Lilypond notation—C, C♯ D, D♯, E, F, F♯ and so forth—and then I run them through the shuf command (S-H-U-F) which will take them from their ascending order that I just spoke out to you and shuffle them all around randomly. And then what I do is add a series of rhythms to them and I have a "todo" in my script, and that is to randomize the rhythms. Now I never did this, but there was a guy—I wanna say he was in Great Britain somewhere—who contacted me after reading my blog post about this and thought, man, what cool thing to do. I'm gonna try to randomize those rhythms, and he did it, he came up with a solution. And I'll be honest I don't remember where it is, I don't have in front of me here. So I apply rhythms using the Lilypond numbers like the first rhythm is a quarter note then there is a double-dotted quarter note, followed by a 16th note, followed by a quarter, a dotted-quarter, an eighth, a dotted eighth, and then a dotted half. And all of these will add up to the right amount of rhythms.

So anyway I apply some rhythms, the pitches have been shuffled randomly, and then I have a block of code that will stick all the pitches in the right place in a Lilypond file, and then I run Lilypond on this file to create the score and to create the MIDI file.

After that there is a function that will optimize the PNG file by running optipng, and also it did uses the netpbm tools which—I plan to record an episode about the netpbm tools again later—but it converts the PNG file to PNM so that it can be worked with, and then runs it to PNG again creating a transparent background by finding every pixel on the whole thing that is white and turning it transparent. And then I run the optimize PNG command on it to reduce the file size.

After that there is a function that creates a block of static HTML and sticks the image in there and it also puts an HTML 5 audio player, and at some point there must be…ah here it is. I use timidity to play the midi file and pipe it through lame, the mp3 engine, and then I use mp32ogg on that mp3 file to make an ogg version. So I end up with a MIDI version, mp3, and ogg, and all of those are stuck in the right place and a web page is generated that has the image, the audio file, and also has a link to my script that does the whole thing.

Now let's listen to one example. I just generated this one a few minutes ago. Here's an example of a "12-Tone Row of the Day."

[plays MIDI of randomly-generated 12-Tone Row]

randomly generated 12-tone
 row

Beautiful, isn't it? Wouldn't you like to be woken up by that every day? Now I never did actually use this as an alarm like the original intent was, but I still periodically will go back to my "12-Tone Row of the Day" page and just play the example. A new one is generated every day, however I probably don't look at more than once…one of them per month.

Anyway I hope you guys have enjoyed hearing about that technique from the early 20th century, the 12-Tone Technique, and I'll have links in the show notes to more information about that if you're at all curious. But thanks for listening. This has been Jon Kulp on a new microphone in Lafayette, Louisiana, and I am signing off now. Bye.