## Response to “A Mathematician’s Lament”

A poem in response to Paul Lockhart’s “A Mathematician’s Lament”, inspired by the mathematical doodles of Vi Hart.

 Inside a box a triangle sits, Somewhere, perhaps in your mind’s eye, Wide as the box, and just as high. In short, the triangle barely fits. What will the triangle’s area be? A quarter of the box? Or maybe a third? More than the box? No, that’s absurd. Hmm, there’s a game here, you can see. A curious game — but how to play? Maybe you should draw a line. To split the triangle, that looks fine, From top to bottom, all the way. Now two boxes sit astride Where there had only been just one. Twice the shapes means twice the fun! And each contains more shapes inside. The leftmost box is cut in half – A line is slicing it in two. Now equal shapes jump out at you. It’s enough to make you laugh. For on the right it’s just the same. Your triangle, you can say with pride, Takes half the box’s space inside. It seems that you have won the game!

## Candies all the way down

One problem with musical candy buttons is that sooner or later you run out of space to put all of the notes. Or, if you’re hungry, you might run out of notes altogether. Imagine you’re right in the middle of composing a delicious symphony in the key of Grape (I mean, um, in the key of B flat), and suddenly you run out candy buttons — or worse, you even run out places to put your candy buttons.

Never fear, there is a way out. In honor of the late, great Benoit Mandelbrot, I hereby introduce fractal musical candy buttons! I don’t have an interactive Java applet ready for you to play with quite yet. My eventual plan is to give you a way to zoom in and out, and otherwise navigate through the fractal score.

But I can show you a visualization of how such a space might look. Around the central tonic pitch (Peach), I’ve arranged half sized candy buttons representing the other six notes in the same key. Around each of these are still smaller candy buttons, and so on, ad infinitum.

Once I implement a way to let you zoom into this space, then there will be infinite melodies for you to explore, in an endless variety of colorful (and tasty) musical possibilities.

But that will probably have to wait until next year. 🙂

## Candy button musical space

I thought it would be nice to give you a way to create your own original candy button musical space — something between a musical score and a musical instrument.

I’ve also started decorating the candy buttons, because everybody knows that low notes and high notes taste quite different, and you wouldn’t want to eat the wrong note! Candy buttons in the second octave now have little hearts painted on them. Candy buttons in the third octave have little painted stars.

As you can see in the image below, the top and right edges are all the flavors in the key of C major. The left and bottom edges are all the flavors in the key of C# major.

But you can try it for yourself. Click on the image to link to the on-line Java applet:

## Counterpoint

Xiao’s helpful comments have encouraged me to iterate yesterday’s design. Rather than using words in the buttons of the latest little candy button music machine, I’ve adopted the philosophy of “less is more”, and have switched over to pictorial icons. This way the machine will be equally useful (or useless) everywhere in the world.

I also added a speed slider, so you can run the machine fast or slow or even backwards. As usual, you link to the applet by clicking on the image below.

Meanwhile, I’m thinking that making music with candy buttons would make for a very nice board game. The general idea might be that you have to play a melody to advance in the game — a kind of mash-up of Simon and Candy Land.

## Rainbow fugue machine

Today I found myself in a bit of a fugue state, and it wasn’t all that bad. So I decided I would make a candy button machine to create fugue states.

Drawing inspiration from Xiao’s comment about the circle of fifths, I realized that if I could make a melody go around the entire circle of fifths, then my machine could use every candy button of the rainbow.

Coincidentally, today I reached page 152 in Vernor VInge’s novel Rainbows End. That’s the page where it is pointed out that the title of the book is actually a declarative sentence (and, when you think about it, a very sad sentence at that).

But in fact rainbows do not end, because rainbows are actually completely circular. Like Skittles.

So I decided to make a candy button rainbow fugue machine. In other words, a machine to generate never-ending fugues that go all around the circle of fifths, visiting every color of the rainbow on the way.

As you can see in the picture below, the machine has 12 spiral arms arranged around a circle (the circle of fifths, in fact). Each arm consists of the four notes of a dominant seventh chord in some random order, as candy buttons.

There are only two kinds of controls: less ↔ more to vary the number of voices, and thin ↔ wide to vary how far those voices spread around the circle of fifths.

It’s surprising how many musical variations you can get with just those controls. But don’t take my word for it. Try out the applet for yourself, by clicking on the image below:

## Chasing rainbows

The 1917 song I’m Always Chasing Rainbows, by Harry Carroll and Joseph McCarthy, borrowed its melody from the middle section of Frédéric Chopin’s 1834 Fantaisie-Impromptu in C-sharp minor.

There have been many recordings of this wonderful song by everyone from Bing Crosby to Alice Cooper, but perhaps my favorite was the achingly sad rendition by Judy Garland in the 1941 film Zeigfeld Girl.

One of the things that intrigues me about the candy buttons representation of music is the way it blurs the distinction between musical score and musical instrument. I’ve transcribed the first few bars of I’m Always Chasing Rainbows onto a strip of candy buttons. The image below links to an applet that lets you play the song by moving your mouse across successive rows of candy buttons (it’s up to you to play with the correct rhythm).

Or you can roam your mouse freely over the applet, using the score as a kind of musical keyboard, to create your own melodies. The original melody you create will be a kind of collaboration between you, Harry Carroll and Frédéric Chopin.

Happy rainbow chasing!!!

## Musical candy buttons, revisited

Today I decided to try making a simple musical instrument with candy buttons, using my new expanded palette of chromatic musical notes.

One interesting thing about this arrangement is that the six candy buttons that surround any candy button are its half-step, whole-step and minor-third pitch neighbors. For example, the six candy buttons around the candy button that plays a C note will play A, A#, B, C#, D and D# notes.

You can try it for yourself by clicking on the image below to link to the on-line java applet:

## Evolved virtual keyboards

Mari’s comment on yesterday’s post about the Candy colored musical keyboard was: “I typed different words and listened.”

Which was absolutely brilliant!!!

Today I tried typing different words and phrases into the applet, and listened to the melodies that emerged. Mostly it sounded more or less like a parody of Schönberg, with “melodies” that seemed rather arbitrary.

Then I spent some time searching for words that would produce a strong lilt. Some words, like “once”, had a lovely melody, and occasionally an entire phrase, like “who am I”, sound as though it could be the melody for a song with that title.

But for the most part the results just didn’t add up. Since my keyboard layout was mapping to the 12 notes of the chromatic somewhat randomly (given the quirkiness of QWERTY), this was to be expected.

But what if we were to map the keys in a way that tried to optimize for mapping words to good melodies? For example, we could map letters, such as “s” or “d”, that often occur at the ends of words to the tonic or dominant note of a scale. And common letter combinations like “th” could map to pleasant intervals, such as the major third.

Of course it’s hard to know, a priori, whether a mapping will be good. So one possibility would be to evolve our keyboard, starting with keys mapped to notes at random. Then we would have the computer “type” a typical text, while we listened for whether interesting melodies emerge.

Then, just as Karl Sims evolved virtual creatures through genetic algorithms, we could incrementally change our mapping in random ways, and always choose the alternative that sounded best.

Maybe I’ll try something like that. 🙂

## Candy colored musical computer keyboard

The I figured that the best way to refine my version of the chromatic scale would be to try to use it for something. And so I have repurposed an old project, in which I had used the computer keyboard as a kind of a piano keyboard. In the new version, I assign a color to every pitch.

In the course of playing with this today, I realized I could just color the seven “white” keys with pastel colors borrowed from our old friend Roy G. Biv (Red / Orange / Yellow / Green / Blue / Indigo / Violet) — with the one notable exception that Red becomes Pink on a pastel palette.

The colors of the five “black” keys — Deep red, Brown, Deep green, Navy blue, and Purple — are chosen so as to lie between the colors of their respective white key neighbors.

The resulting keyboard is certainly more cheerful than the original. The four rows of the keyboard are tuned, from bottom to top, to the even-tempered C# major, C major, B major and A# major scales, respectively. This means that when you play on any row, the row above it contains all the appropriate sharps and flats in their proper positions.

Since the “home keys” row of ASDFGHJK… corresponds to a C natural scale, which contains only white keys, you can see the pastel rainbow laid out on that row. Interestingly, the “F” and “G” keys correspond to their actual respective pitches (you might also find it useful to remember that “K” corresponds to C above middle C).

You can get to the applet itself by clicking on the image below:

## Chromatic scale

It was fun encoding notes of the musical scale as colors in my recently posted Candy buttons musical palindrome machine, but it seems somehow limiting to restrict things only to the white keys (the keys C,D,E,F,G,A,B on the piano).

Why not use color for all of the notes of the musical scale — including the black keys? That would allow candy-based musical machines to be a lot more powerful. We could create Skittles serenades, M&M motets, Reese’s Pieces, um, pieces.

But how to map colors to notes? It’s not so easy to find a sequence of colors that are clearly visually distinct, and also reasonably yummy. I decided I only need to encode one octave, since I can use other cues, like the size of the candy, to distinguish between notes in different octaves.

But even getting a nice set of colors for the 12 notes of the chromatic scale — C, C#, D, D#, E, F, F#, G, G#, A, A#, B — can be a challenge.

What I’ve come up with so far does two things: it generally goes around the rainbow, and it also represents the “black” keys by dark colors and the “white” keys by light colors. Hopefully that will make the notes easier to remember and recognize when it’s time to start laying down musical candy tracks:

 As you can see from the picture to the left, the seven “white” notes I picked can stand on their own, creating a kind of pastel rainbow. Meanwhile the five “black” notes create a complementary rainbow of dark colors. When woven together, the two sets of colors do a nice job of turning the chromatic octave scale into a kind of rainbow — a spectrum of light to represent a spectrum of pitch. My original plan was to give all of the colors cool candy names, but then I got completely stuck on the light blue colors, because that’s not really a food color. It would be weird to call a candy color “sky”, because then you’d have to “eat the sky”. In fact, that happens to be the title of a very decent book about food and climate change by Anna Lappé, but I have a hard time seeing how making musical candy machines will help save our planet Earth — much as I’d like to help out. Why am I telling you this? Mostly because the picture of the twelve notes and their pretty colors turned out to be really tall and skinny on the web page, and I felt the need to put something here on this side of the page, just to kind of even things out. Feel free to stop reading at any time. There are apparently 25 distinct flavors of M&Ms, but many of them look suspiciously similar to each other, if you ask me. Personally, I think it’s a scam. Skittles originally contained only five colors (Red, Green, Purple, Orange, and Yellow), but I hear rumors that they have since expanded.

Hopefully this “chromatic scale” will be good enough to serve as the basis of a series of machines that I plan to build and post here, to allow people to explore the space of music composition as a game (with candy).