Friday, June 24, 2011

Fibonacci's Rainstorm

A couple years back I got it in my head that I was going to try and write a musical about time travel.

Yeah, I don't know either.

But perhaps the maddest thing about that idea is that I have next to no musical training. Not that I'm the sort to let that stop me. So instead, the plan was to try and create music using maths. Which is a little weird.

But not actually as mad as it sounds. After all, Pythagoras (yes, that Pythagoras) was the first - or so the legend goes - to study the maths of harmonics, and why certain sounds are more pleasing to the ear than others.

It's all to do with fractions. But I won't go into all that because it's not relevant to my thing - there's a good, brief explanation in this video, How to Solve a Song with Math.


Musical Integers

The basic idea was as simple as this - you assign an musical note to each integer - say, starting with 1 = Middle C, 2 = C#, etc. though there are other methods of assignment - then generate integer sequences and seeing what they sound like.

For a good example of this sort of thing, here's mathemusician Vi Hart on the music of pi.

After playing around with various functions, what I settled on where that Hailstone numbers; which I misremembered as being called rainstorm numbers.


Collatz Conjecture

The Collatz Conjecture (also known as the hailstone numbers) works something like this
Well, all except the last sentence fragment. The actual idea is that, regardless of what starting number you pick, the sequence will always end on the number 1 (full details on the wiki page).

The Collatz Conjecture is currently unproven, though recently someone published a proposed proof - currently under scrutiny. But that's a whole other story.

So you pick some number, generate the sequence and see what it sounds like. Here's the sequence for 12


That is - 12, 6, 3, 10, 5, 16, 8, 4, 2, 1

The problem with using hailstone numbers is that it has the potential for massive jumps - for example 7, 22, 11, 34, 17, 52, etc - and such a sequence would not sound pleasing (this goes back to Pythagoras).


Lateralis

So my second idea was to combine it with the Fibonacci Sequence - that is 1, 1, 2, 3, 5, 8, 13, etc - where each number in the sequence is the sum of the two preceding numbers.

This was actually inspired, slightly, by the Tool song Lateralis, where the syllables of the lyrics form a rising and falling Fibonacci Sequence:
Black / then / white are / all I see / in my infancy / red and yellow then came to be / reaching out to me / lets me see.
So the idea was to perform the Collatz algorithm on the numbers of the Fibonacci sequence - which sounds something like this

 
1 / 1 / 2, 1 / 3, 10, 5, 16, 8, 4, 2, 1 / 5, 16, 8, 4, 2, 1 / 8, 4, 2, 1


Finishing Touches

Now the next part's a bit fuzzy. While I still have the notebook in which I worked out the tune, my notes aren't exactly clear.
But, basically, what happened was that the resulting tune (see above) was far too erratic in places. So I made a lot of modifications to it, but still based vaguely on patterns in the generated tune.

And the final touch I added to make the tune sound richer was chords. Again, I didn't know anything about chords. But a quick look on wikipedia told me how to make major and minor chords, so I decided to add the minor chords of the first notes of each bar.

Here's what the final tune sounds like

 
Yes, it's a bit short and basic. But all things considered, I'd say I did pretty well.


More Math Music

I've already mentioned above the music based on the digits of pi.

There was also a guy who worked out a way to convert games of chess into music.

And, as mention briefly in a previous post, you can go (almost) completely random and generate music using Markov chains - for example.


Oatzy.


[Oh, and I never did write that musical. Not that that should surprise you.]

No comments: