Tuesday, September 27, 2016

This just popped up

As ever, this blog tends to feed itself once it's active. In my previous post, I wrote about happening on a Bach fugue and converting the notation from the ungainly key of C-sharp Major to the slightly more gainly key of D-flat Major. I mentioned discussing this fugue with pianist/blogger Erica Sipes, who's spent a lot of time with Book II of The Well-Tempered Clavier. In a Facebook conversation, she wrote: "The fugue reminds me of popcorn popping...starting with a kernel or two as the oil heats up and then speeding up as they all start popping. Profound, eh?"

Well, to me this actually seemed perfectly profound and on point (especially because of the way 32nd notes are gradually introduced to quicken the texture), so I started thinking about how to play with the concept. Since my piano tuner has advised against pouring hot oil into the piano, I decided to head back to the world of Scratch, MIT's marvelous graphical programming environment for kids (and kids at heart). I've actually learned enough "grown-up" programming since I last posted Scratch projects (see: here, here, and here) that I should really start learning how to do animations in JavaScript; but I wanted to see Bach popping right away, so I started scratching.

Scratch does have some limited MIDI capabilities (basically, you can tell it to play notes at a given pitch, for a given length, by a given "instrument"), but getting it to play a three-part fugue in which the beats stay synchronized, even as the tempo changes, meant I got to experience what it's like to build a MIDI system almost from the ground up. As I'll discuss more in a future post, this kind of problem-solving provides an interesting vantage point from which to think about how music works. Mundane functions like pausing, restarting, and jumping around within the music all required procedures that had to be thought through and executed. (In my programming experience, the latter is always much harder than the former!)

As for the popcorn animation, my first instinct turned out to be the best - nothing but a simple skillet in which each note "played" causes a kernel to jump up and then get randomly popped around the pan. I got to revisit my long dormant trigonometry skills as a way of ensuring that the randomly distributed kernels end up falling in a circular pattern. (Simply sending kernels to random values of X and Y resulted in a square distribution that looked silly with the round skillet.)



[The only nod to the actual musical structure is at 1:16 when the alto voice states the subject in augmentation (longer note values); if you look closely, you'll see especially emphatic pops for those four notes.]

Then, like kernels popping randomly in all directions, I found the project also started sprouting outwardly in unexpected ways. I spent a good bit of time trying to design a pop sequence that somehow shows the melodic shape of the three parts. This took a lot of work - and, frustratingly, resulted in something less elegant and realistic-looking than the simple random approach. The kernels that (for reasons unknown to reality) shoot popping kernels into the bowl look a bit too much like little bugs; perhaps a "bug" in the program. But I'm pleased with having met the challenge, although this version exists as an unfinished side curiosity for now. (Those are bass kernels in lower left, alto in upper left, and soprano in upper right.)


Other features crept in, including the fairly rudimentary functionality of being able to change instruments, tempo, volume balance, and key on the fly. Changing key (which, in a way, is how I got myself "into this fugue" in the first place) gave me the idea of allowing the user to change the key for each voice part individually. This led to the idea of a feature in which the music changes key randomly every beat, which creates a kind of 12-tone fantasy effect. (We all have different fantasies.) Then, it occurred to me that the integers I was inputting for pitches don't have to be integers, and suddenly a microtonal option was on the menu. (Unfortunately, "viola" is not one of the instrument options in Scratch's soundfont.) For the user who finds the popping kernels are inducing hunger, this microtonal option might help to erase any appetite.

Finally, because I already have the music entered into Lilypond, and because Lilypond is wonderfully flexible about output options, I converted the score into 35 one-bar systems which allow the user to view the score two bars at a time in the small window. It's not the most practical way to follow along, but it's nice for reference, and one can easily switch back and forth between staves and stovetop.

After I'd made it this far in writing this very post, I realized I needed to add a feature which inverts the music. Rather than simply invert each part within its own range, the parts are completely flipped so that the bass becomes soprano and the soprano becomes bass. Although it wouldn't have been so difficult to produce a nice elegant engraving of this new "score," I decided it's more fun to flip the existing measures upside down like so*:

Notice that the C-sharp which begins the subject in the bass is still a C-sharp two octaves up, and it even looks like a C-sharp in the inverted bass clef staff!

Here's a quick demo of most of these functions**:


That gets a little insane at the end as I flew to close to the sun in choosing a tempo that would get me to the end more quickly. All the more reason for you to try these fun features out on your own. Just go here or click the image below, which surrounds the embedded "game" within all the instructions you'll need.


Unfortunately, Scratch uses Flash technology which is becoming more and more outdated, so this program won't work on most mobile devices, and might not work on some computers, depending on what your browser thinks of Flash. This is why I'm not going to keep trying to iron out all the leftover kinks. (Sometimes, for reasons I don't feel like fixing, the kernels will suddenly grown enormous and overtake the entire screen - which is actually kind of a nice bug.) Time to move on and learn how to do this more elegantly and efficiently.

I have much more to say about "playing with" Bach in this way, and will post more soon. For now, I'll just say that the line between "playing Bach" (as in, performing it "respectfully" on a keyboard instrument) and "playing with Bach" perhaps shouldn't be so clear. Although there's no clear aesthetic purpose in inverting a fugue with microtonal distortions, I like to think of this program as a way of holding the music in virtual hands and turning it around to inspect like one would a snow globe.

In my last post, I quoted the great Charles Rosen about the satisfying way in which Bach's counterpoint fits the fingers. In the larger context, he's discussing the fact that this music was never intended to be performed publicly, but rather for more private encounters in which following the score (by performer and possibly by a few other listeners) is part of the experience of the music. Rosen writes:
Playing Bach for oneself or for a friend or pupil looking at the score...raises few problems; nothing had to be brought out, the harpsichordist experienced the different voices through the movement of the hands, the listener saw the score and followed all the contrapuntal complexity disentangling the sound visually while listening. Bach's art did not depend on hearing the different voices and separating them in the mind, but on appreciating the way what was separate on paper blended into a wonderful whole. [pp. 199-200]
Rosen goes on to suggest that modern performance in concert necessitates having the performer "bring out" the contrapuntal details more pointedly. I'm not sure I agree with that, especially because we know Bach loved secrets and hidden meanings, so he might enjoy the idea that various kinds of thematic connections are buried under a euphonious surface; but for now, I'm more interested in the idea that encountering this music can happen in lots of ways. And, yes, I'd agree that the best such encounters happen at the keyboard. Here again is my humble effort at playing this prelude and fugue shortly after learning them in my D-flat "version." (Fugue begins at 1:45).

 
 
Thanks again to Erica for her Bach/popcorn brilliant idea. Check out her brave and insightful online practice sessons and her lovely book on practicing. Come to think of it, practicing is something I should probably be doing! (I don't think it counts for me but, even as I type on a Tuesday night, I'm listening to my daughter zip through Bach's A Minor violin fugue, so I'm having a live fugue experience. Bach is the best!)



* Flipping the music upside-down distorts a lot of the tonal function, though the vague major-to-minor effect is cool.

** One feature I decided not to include, though I toyed around with it, is to have the notes played backwards. It's very easy to reverse the note/rhythm sets and that sounded cool in places, but running notation backwards also raises the question of whether notes should begin where they ended going forward (so that a whole note would begin right at the beginning of a backwards bar) or where they started going forward (so that a whole note wouldn't be played until the very, very end of a backwards bar), which aligns note attacks more often with the other voices but produces odd collisions going the other direction. If that didn't make sense, just think of how a record sounds played backwards. Assuming you're not trying to recreate that whooshing effect caused by reversing a note's sustain, then you're basically going to end up with significantly different rhythmic relationships among the parts.

No comments: