Archive for the ‘Blog’ Category

A gripe about chess annotations

Saturday, April 30th, 2011

More and more these days, analysis of chess games relies on chess engines (playing programs), whether to come up with ideas or just to double-check the human annotator’s calculations. That is not my gripe; computer analysis is just a fact of life these days. My gripe is that the people who are writing the analyses and using the computer programs are oddly reluctant to actually name them. Instead of saying “Rybka suggests 25.Nxf6″ or “Fritz thinks this is now a draw”, they’ll simply refer to “the computer”, e.g., “The computer has a brilliant idea here”. As a software programmer, it really bugs me that the creators of these programs, of which there are dozens with highly individual characteristics, don’t get any credit for their work, as if chess engines (which require an immense amount of both creativity and detail) were completely fungible and simply sprang into existence by spontaneous generation. Annotators, cut it out!

Dmitri Tymoczko: A Geometry of Music

Monday, April 25th, 2011

I have always been a sucker for music theory and analysis. The combination of the fairly strict rules underpinning the way in which music works with the creative freedom expressed on top of them is really appealing to me. It is probably true of any art, but music is the one I know best and it feels especially true there. This new book promised “a revolutionary approach to music theory”, which set off my bullshit detector a bit, but everything else about it (blurbs, published by Oxford University Press) checked out, so I gave it a shot.

And it was great. There is a lot of exciting new stuff here, but Tymoczko doesn’t claim to have replaced the entire field of music theory, just to have discovered an additional way of looking at music that provides interesting insights, and he totally succeeds there. A quick overview, focusing on the stuff that was interesting to me:

n-part counterpoint can be visualized as the movement of a point through an n-dimensional space. Pretty obvious stuff in retrospect, especially if you have a math background, but it lets him do some neat analytical things, especially when he gets to 4+–note chords. Also, that n-dimensional space repeats in a very interesting way (the 2-dimensional case is a Möbius strip; the higher-dimensional ones are even weirder).

There’s a continuum all the way from local 2-part counterpoint to long-range modulation. Basically, Tymoczko is looking at music as much as he can through the concept of efficient voice-leading (transitioning from one set of pitches to another with each individual part moving as little as possible). In the small, this is about melodic counterpoint. In the middle, the same principles can be applied to harmonic motion (and he shows how a lot of chromatic music from Schubert on is best analyzed from this viewpoint). And in the large scale, you can treat scales (and therefore tonalities) as being akin to 7-note (or so) chords and do exactly the same sort of analysis. So for example, your standard modulation from C major to G major can be thought of as following a voice leading from C-D-E-F-G-A-B to C-D-E-F♯-G-A-B. Obviously there are qualitative differences as you move along this spectrum, but the fact that you can be using similar tools at each scale is really neat.

20th century tonality is a natural evolution of classical tonality, not a clean break. The standard history of music is that tonality slowly got stretched and stretched, as harmony got further and further out, until it reached a breaking point in the early 20th century, where it pretty much split into complete atonality on the one hand, and on the other a “tonality with non-functional harmony” that was qualitatively different from the tonality that came before in that the chords in it, although they were still consonant, had lost much of the semantic meaning that they had had through the 19th century. Tymoczko argues pretty strongly that rather than there being a real break between old and modern conceptions of tonality, the transition is actually relatively smooth, in that early 20th century composers were solving perfectly natural problems that had arisen in perfectly natural ways. These problems, as above, tend to be ones of voice-leading and the relationship between chords and scales. He also draws a compelling line from 19th century harmony through 20th century harmony through jazz harmony to 21st century harmony. Clearly everyone can hear jazzy chords in Debussy, for example, and you can think of it as being kind of a coincidence, but he shows that impressionist composers and jazz musicians were faced with similar musical problems, and solved them in similar ways.

There’s a ton more in here, and pretty much all of it was thought-provoking at the very least and genuinely conception-altering at the best. As far as background needed: although it doesn’t have much in the way of music-theoretical prerequisites (because it is approaching a lot of ideas from a different direction), it probably wouldn’t be that interesting to anyone who wasn’t already interested enough in music theory to have learned the more standard approach (if that makes sense). There’s a bit of math terminology but I don’t think it’s that scary. Highly recommended.

Steven Erikson: Memories of Ice

Saturday, April 2nd, 2011

Book three of The Malazan Book of the Fallen does at least return to the same general location and cast of characters as the first book, but in a way, doing so makes the giant scope of the project even more clear, by launching off into entirely new plots with those characters instead of continuing the trajectories they seemed to be on, and throwing in scads of new characters and plots as well.

The first time I read Memories of Ice I was a little frustrated by this. After spending a whole book away from the setting of Gardens of the Moon, I thought that returning to it would entitle me to the answers to many of the questions left hanging in that book. Instead I got a dozen new mysteries, and new characters where I wanted to learn more about the old ones. Combine that with a length of 1200 pages (in mass market paperback, at least), and it’s no wonder that I started to get a little fatigued.

But as with all of the books in this series, it improves on rereading, especially after reading later books in the series so that you have a better sense of how the events and themes of this book fit into the greater plot arcs. In fact, what seems to be the main plotline of the entire series doesn’t even start until this book (I say “seems” because, being only up to book 7 as I write this, I’m not actually sure exactly where things are going). You could regard the “really needs multiple reads” as a positive or negative aspect; I think it’s a positive one. I don’t generally reread books much, but a lot of classical music requires (and expects) many listens before the full structure becomes clear, and it doesn’t seem unreasonable for a book to ask for the same.

All of the things I’ve said about earlier book in the series hold true in this one as well: the epic scope, the cast of hundreds featuring gods just as much as mortals, the relentless tragedy (I think this book is even more of a downer than Deadhouse Gates). I liked it a lot more this time through, even though I think the series really gets off the ground in book 4 when we leave this continent behind (apparently we return in book 8, though…). Anyone who gets this far is probably in it for the long haul, and I am no exception.

One more Ultima Underworld story

Thursday, March 17th, 2011

I can’t believe I forgot this one.

One of the levels (5, I think?) was largely populated by ghouls, with standard flesh-eating names like Eyesnack and Kneenibble. Naturally you could talk to them instead of just fighting them. Jon Maiara (the same guy responsible for the Pac-Man homage) was writing the conversations for them, and included all sorts of things like the opportunity for you to make fun of Eyesnack’s name, to which he would respond by making fun of your name in return. You see the edge case, of course, right?

That’s right, part of our precious 640K was devoted to checking for whether the player’s name is also Eyesnack, in which case, in response to your mockery, the ghoul proclaims indignantly, “But your name same as mine!”

Maybe that will make you feel better about Judy falling into the lava.

Double pin

Saturday, March 5th, 2011

It’s not every day you get to make a move like this. From a 3-minute ICC game:

2r1kb1R/5p2/1Bnp2p1/pp4P1/4n1q1/1N6/PPPQ4/1K2R3

It was very pleasing to be able to play 25.Qxd6.

Ultima Underworld bugs

Monday, February 21st, 2011

While I’m reminiscing about the old days…

As we (Blue Sky Productions, later Looking Glass Technologies / Studios) were developing Ultima Underworld in 1991-1992, largely in a basement room in an office building in Somerville’s Davis Square, we received bug reports both from our own people and the QA team at Origin Systems, who published the game. “Our own people” largely meant MIT friends of the core programming team (me, Doug Church, and Jon Maiara) who we roped into helping out.

Our lead tester was Tim Stellmach (now at Vicarious Visions), a math major. You could tell he was a math major because his bug reports would start with “Consider a door.”

Our producer from Origin was Warren Spector, already a pretty important guy in the industry but someone who has since received yet more accolades for working on, well, Ultima Underworld, not to mention other games such as System Shock (with us), Deus Ex, and Epic Mickey. He is a super down-to-earth guy and we wasted no time in making fun of him, which he took with impressive grace. I guess it was a tradition at Origin to insert characters based on Warren into their games, so we figured we had to as well. Luckily we already had a “spectre” type of monster so it took no work to name one of them Warren. We made sure that Warren was in town the day that Tim was reading through the daily bug report list and said “Bug: There is no reference in the game to Warren Spector”, to which the rest of us immediately piped up, “Fixed!” without further explanation, much to Warren’s chagrin.

We were working with a lot of pretty raw graphics technology, as you can imagine, and it created some unintended graphical results fairly often. The upside was that whenever we ran into some heinous graphics bug that resulted in crazy psychedelic effects, once we figured out what was causing it, after fixing it we kept the code that would make it happen and enabled it when you ate too many mushrooms.

Speaking of graphics… well, probably most of you are far too young to remember the Apple ][, but it had a seriously weird graphics mode, which had not only a crazy palette (black, white, green, blue, orange, and purple) but also placed additional restrictions on how you could use the colors near each other (see here if you really need to know the gory details). Paul Neurath, our CEO, never tired of telling stories of what a pain it was to work with that system when he had written his earlier game Space Rogue. So naturally we added code that would specifically look for a certain file we had planted on Paul’s computer, and if it found it, would switch to a green-blue-orange-purple palette for one frame every half hour or so. Unfortunately I honestly can’t remember whether Paul ever actually noticed it.

One part of one of the levels, designed by Jon, was a Pac-Man homage. You had to run around a maze, which I believe faithfully duplicated the first level of Pac-Man picking up “ore” while avoiding ghosts. How Origin let this through I’ll never know, but they did have one complaint: Jon had named the ore “unobtanium” (yes, the same joke that Avatar used 20 years later), and they insisted that that name was too silly. So we changed it to “zanium” in protest… and apparently they were perfectly fine with that.

The worst bug that made it into the shipping game was probably mine. One of the quests involved talking to a woman named Judy, who could be found hanging out next to a river of lava. It turned out that, given our emergent-gameplay physics-driven simulation philosophy, we never actually prohibited characters from walking into the lava (although of course their AI tried to avoid it). So it was possible (although thankfully rare) for Judy to wander into the lava and die, making your game unwinnable. If you have been enraged at me for the last 20 years, I apologize.

But the best bug report I remember came from Origin. We rendered the world in true 3D but most of the objects (monsters, objects you could pick up) were 2D sprites. There were a few actual 3D polygonal objects, though, such as boulders. When we added the 3D object capability, we needed something to test it out, and we hadn’t created any ourselves yet, so we used a red sports car from some friends who were developing a game with the Car & Driver license, which we plopped down in the middle of a cavern. Sure enough, you could walk all around it and it looked just like a red sports car.

Then the bug report came in, of course. “On the fifth level, at this particular location, there is a red sports car sitting on the floor.” OK, I guess we could have expected that. What we did not expect was the next sentence: “I should be able to enter it and drive around.”

The dangers of self-modifying code

Sunday, February 20th, 2011

One of my coding stories recently showed up on reddit and spawned a giant thread. Having it brought up again reminded me of another fun bug from the early days, in this case 1991.

I had just graduated from college and joined Blue Sky Productions, soon to be renamed Looking Glass Technologies, where we were working on the PC game Ultima Underworld, a first-person 3D dungeon crawl. I needed a machine so I was given an 33 MHz 80486 PC. Everybody else was jealous because not only was it immediately the fastest PC in the office, it was also the only one with a floating point unit. The downside was that everybody wanted to run their tools requiring floating point on my machine.

Anyway, of course the first thing to do as soon as the machine showed up was to run the in-progress version of Underworld on it to see how zippy it would be—perhaps it could get all the way up to 15 frames a second! Unfortunately, the game completely failed on my machine. I can’t remember whether it just crashed, or everything on screen was just black, or what, but it just did not work at all.

After much hair-tearing, we figured out the problem. The texture mapper (in software, not hardware, of course), which had been written by an outside guy (Chris Green—I see he’s now at Valve) and handed to us, was using self-modifying code in an attempt to squeeze as much performance as possible out of the system. Where a normal program might have a loop that accesses a variable each time through the loop, our texture mapper’s loop would just refer to a constant value. Before entering the loop, it would do the variable lookup once, poke that value into its own code, replacing the constant, and then run the loop a bunch of times without having to waste time looking up the value again. Brilliant! Impossible to debug, but brilliant.

Unfortunately, the 486 had its own optimization—an instruction cache. So we were dutifully poking new values into program memory that had already been read and was never reread, which meant that all of the updates were completely ignored. Oops.

I see that the Wikipedia article on self-modifying code has a section on exactly this problem.

Carlos Ruiz Zafón: The Shadow of the Wind

Saturday, February 19th, 2011

I feel like too many of my book posts lately have been of the form “Eh, didn’t really float my boat.” Well, in this case my watercraft was 100% buoyant. The Shadow of the Wind not only should have been my thing, it actually was my thing.

I guess it was a big hit in Spain, where it was originally published, and I can see why. It’s full of books and (metaphorical) ghosts and romance and melodrama in a way that is slightly over-the-top but always enjoyable. It’s set in post-WWII Barcelona, and I really enjoyed the evocation of the time and place. It has a fairly standard metaplot of Young Man Digs Into The Mysteries Of The Past While Getting Dragged Into A Modern-Day Plot And Also Falling In Love With Someone Who May Or May Not Be Good For Him, but it implements it superbly. The characters are kind of two-dimensional (which is to say, they don’t really have three dimensions, but at least they don’t have only one), but who cares. I found myself tearing through it, both wanting to know What Happens Next And What Is The Real Identity Of That Mysterious Guy but also wanting to see how the personal relationships played out. I would call it a guilty pleasure but it was too well written for that.

Zafón has written a few other novels, and I have a feeling I’ll be reading one of them during my next summer vacation.

Cardiacs: “Odd Even”

Saturday, November 6th, 2010

Six months ago I made some general comments about the musical vocabulary of Tim Smith (of Cardiacs). Here are some notes on “Odd Even”, a song that illustrates a lot of his standard tricks. The song is on YouTube here and my transcription is here (PDF file).

The form could not be simpler: three repetitions of verse (a 7-bar phrase repeated twice) and chorus (8 or 12 bars; in the second and third choruses the last 4 bars are repeated). The third verse is instrumental.

The introduction (which foreshadows the end of the verse phrase) is a straight-out “Smith cadence” (♭III–v–I in the key of E), which already renders it unclear whether we’re in the key of G major (starting on the tonic and repeatedly raising the tension) or E major (starting on the flat mediant and repeatedly resolving the tension). This ambiguity will persist throughout the song.

The start of the verse seems to resolve the question by claiming that we’re in G major, and could not refer more explicitly to the Lydian mode, with a C♯ over the G chord. Already this is a hint that we might be moving back to the sharp side soon. There’s an interesting clash between that C♯ of the melody and the C♮ of the C chord that arrives on the second bar. The harmony then moves through A and E back to G, apparently establishing that E is subordinate to G—but then immediately repeats the introductory Smith cadence twice, reestablishing the ambiguity.

The phrase rhythm of the first verse phrase is also quite interesting. From the melody alone it looks like a pretty straightforward [4+4]+4 beats, but the harmonic rhythm, as well as the way that the instruments enter during its first statement, implies 6+6.

The chorus starts by moving fairly strongly to the flat side of G, going all the way to E♭ before slowly relaxing back to G, and right through G all the way to Bm and E again. The feeling of resolution provided by G is lessened this time by it happening for only two beats on the second half of a bar, rather than lasting a whole measure as it did before. The melody here is really nice; a drone-like D is continually returned to on the bottom (it’s a common tone of all the scales passed through, including the E Mixolydian implied by the final destination of E) while the upper implied voice of the line descends from B♭to A to G, then returns up to B♮ and G♯ to both chromatically fill that third and also strongly establish the “surprising” E (not so surprising in reality since the G–Bm–E sequence has been repeating the whole song).

The chorus ends by following yet another path from G to E, this time by repeating the triple plagal cadence G–D–A–E and sitting on the final E for an additional bar. That relaxation of the harmonic tension certainly makes it seem like E was the final destination after all—but when the next verse starts up again, back in G, it feels like a return to the tonic rather than a jump away from it.

The instrumental verse suddenly triples the melodic speed, and it’s interesting to see such a relatively hyper solo in the middle of what is otherwise a fairly sedate song. I wouldn’t have thought of it when I first heard the song, but after listening to a lot of jazz in the last month, the solo has sort of a bebop feel to it, at least when you look at it on the page and imagine it being played by a saxophone rather than by a keyboard.

It looks complicated but it is largely doing the same things found elsewhere in this song or Smith’s work in general—emphasis on that Lydian C♯, liberal use of whole-tone scales, and near the end a gleeful insistence on B♭, a note dissonant against both G major and E major.

The song ends with a final chorus, repeating that G–D–A–E progression four times in a long exhalation and landing with relative finality on E. So maybe it was in E major all along? But I think the fight between the two potential tonics the whole time was a charade; the whole point is that both G and E are equally important, and to proclaim one of them superior to the other is to force one point of view on a song that is all about presenting two.

Bud Powell: “Cleopatra’s Dream”

Monday, October 11th, 2010

I’ve always liked the sound of jazz but have never been as interested in it as rock or classical. Recently my interest has flared up a bit, and I’ve been trying to make up for lost time by listening to more of it with active ears. The standard approved way to work on your analytical technique seems to be to make transcriptions of classical recorded solos, so I picked up the first random jazz CD that was at hand, Bud Powell’s The Scene Changes, and sat down to transcribe the first number, Cleopatra’s Dream. Unfortunately 1) it’s a very fast tune (quarter note = 240), 2) it’s in A flat minor (that’s seven flats), and 3) Bud Powell, like I suppose any good pianist, uses both hands. So maybe it was not the best song to transcribe first. Nonetheless I ended up with something that is at least moderately accurate, especially in the right hand, and it can be found here (PDF file).

I did learn a bit from this exercise about how Powell improvises, and it was good practice for my ears, so it was certainly a success on those fronts. If anyone has suggestions or corrections, especially actual jazz musicians who can tell me, for example, “this line you sketched out in the left hand is not what anyone would ever actually play, he must be doing this instead”, I’d love to hear them.

(By the way, I noted on Twitter that I hear this as being in Ab minor (7 flats), and not G# minor (5 sharps), which you’d think would be more “simple”, and I think I realized why. The leading tone is an important part of the scale, and the major dominant chord that contains it is an important chord; and it’s much easier to think about a V chord that’s an Eb major (Eb, G, Bb) than a D# major (D#, F##, A#). So I think I chose the right key after all.)