Classroom Update from "Creative Coding in Audio-Visual Arts" by Dan Tramte


During the first two weeks of my creative coding class at the Rosedale Freedom Project, students learned how to create short electronic music loops using computer code. They are writing their code in the programming language Ruby and running their code in a music-based development and run-time environment called Sonic Pi. Students are quickly learning and utilizing both the language (Ruby) and the music-creation environment (Sonic Pi)

For one of their first assignments, students learned about the concept of “loops” in Ruby by coding the drum beat to Michael Jackson’s Billie Jean, which features a fairly simple drum loop. We listened to the song, focusing on the percussion part at the beginning and then plotting it out on a graph over time for each drum within the repeating pattern.

Screen Shot 2019-06-17 at 5.21.53 PM.png

Then, we discussed how we translate the elements of the pattern into computer code. For example, if we look at the first column of the grid above, we see that the hi-hat cymbal and bass drum play simultaneously, but the snare is omitted. In the second column, only the hi-hat plays. In the third column, the snare and hi-hat play simultaneously. If we imagine that each column is separated by 0.25 seconds, we can write out the events in a sequence, with the following code:

Screen Shot 2019-06-18 at 1.11.41 PM.png

The code above plays the drum sequence perfectly, but it only plays it once. There are hundreds of instances of this beat within the song, and therefore we have a choice of either A. copy-and-pasting it hundreds of times, or B. wrapping a “loop” around the code so that it will play indefinitely:

Screen Shot 2019-06-18 at 1.14.21 PM.png

In this lesson, students learned a fundamental concept in computer programming: the loop. They have since learned how to refactor this code and how to use the code structure to design their own drum loops. They just finished generating melodies and basslines that they have layered on top of their drum loops. This upcoming week, they will encapsulate these loops into musical phrases, and sequence these phrases into full-length tracks. I look forward to hearing what they come up with this week!

Jordan Malone