The code I'm about to describe uses a binary interpretation of data to create a rhythm. Is it a musical rhythm? Decide for your self by listening on Y

Data As Music

submited by
Style Pass
2022-05-15 02:00:06

The code I'm about to describe uses a binary interpretation of data to create a rhythm. Is it a musical rhythm? Decide for your self by listening on YouTube here.

I like code, so why not start this blog post with code. The code above is the (fake) traffic data I used to develop a piece of music. And because I like code, I'll jump straight into the next section of the code.

live_loop is a construct in Sonic Pi that allows you to-- Wait, maybe I should define Sonic Pi. Sonic Pi is a program, available at sonic-pi.net, that allows you to use code to create music. --anyway, as I was saying, the live loop allows you to define some sounds, and have them continue in sync with the beat that the Sonic Pi keeps track of. I gave my live loop the name :binary for reasons that will become clear soon.

n is a selected data point from the traffic data set. Note that fake_traffic_data from above is both fake data, and also a ring structure, which means it acts like an endless looping list. With the value of n in hand, 12.times do instructs the program to do something twelve times. Notice that that something includes sleep 0.25. If you do the math, you'll find that those sleep calls add up to 3 units of time.

Leave a Comment