Friday 23 August 2013

Seeing music through the eyes of a programmer

I always intended this blog to have a music-only focus. I've often found myself wanting to blog about other things that interest me, but always refrained because it would have been outside the scope of the topic. However, I'm going to make a slight exception for this post because although it isn't exclusively music-related, music does come into it and I think it might be of interest to the very few people who read my blog.

A couple of years ago I did a web design course, learned about HTML and CSS, and loved it. This encouraged me to pursue IT further, and 3 months ago I enrolled in an introductory computer programming course which is just coming to an end at the time of writing. Although the course only taught the very basics of programming, even within a few weeks of starting it I had begun to 'think like a programmer'. Let me provide a few examples of what I mean.

There is a weatherboard house in my street which has always fascinated me because of the unusual staining of the wood. It appears that over time the stain on the boards exposed to the weather (furthest away from the eaves) wore off. The result is a perfect gradient, with the boards near the bottom of the house very pale and those directly under the eaves still a dark brown color. I found myself trying to figure out how I could write a program to manipulate an image to create the same effect. I never actually did it, but later on in the course we worked with gradients so I got to experiment then.

More recently, I attempted to draw parallels between music and programming from a conceptual point of view. In case any geeks are curious to know what I actually came up with, it was along these lines (I added the 'print' statement just to make it do something; it's kind of cool because it shows you the bars and the strong beats in each bar):

for bar in range (120):
      for note in range(1, 4, 2):
            print bar, note

The idea is a piece 120 bars in duration, where each bar is in 4/4 time and contains 2 minims. Obviously a very boring piece of music (where every note is the same duration!) but I needed something that simplistic to be able to translate it to this context at all.

The thing I love about studying programming is it's given me a whole new perspective, not just on music but on EVERYTHING. It's made me think about everything from a logical, even a slightly mathematical, perspective, and it's also made me realise that, contrary to what I've always thought, I don't actually hate maths.

Learning Jython has been intense and pretty stressful at times, but in the past 3 months I've discovered that although programming can be incredibly frustrating, the thrill when you finally solve a problem you've been scratching your head over for weeks is huge. I can't wait to move on to learning Java. In the meantime, to relax a little (haha, we'll see about that...) I'm returning to web design, this time to learn JavaScript.