Here are a few tracks and sketches for an album entitled ‘everything incredible’.
I wanted to create generative music that could be encoded in a function, and had to be played with a physical piece of hardware, rather than digital reading. Here I use the Arduino with a piezo. I write a function to generate a string of numbers, which determines the oscillation of the piezo. You can also play with the PWM of the sound.
Example tracks:
int prettyCool(int t){
return abs(16-(t^2)|(t%5)&t^2)%16;
}
int slowIncrease(int t){
int out =((5 + t%3)+ (t>>5) % 42) * (t%2);
if(out==0){out=((t>>5)+1%42);}
return out;
}
int triangle(int t){
int out = (t<<1) %16;
return out;
}
int coolDoubleTriangles(int t){ int out = abs(16-((t/2)<<1)%16)*(t%2); out+= (((t/2)<<1)%16)*((t+1)%2); return out; }
I was inspired by this blog post discussing short c++ scripts to generate complex sounds, but i did not have /dev/audio on my mac, so I built the simple Arduino circuit.
The whole album is also completely open source. You can see how all of the sounds were generated, and tweak, or remix as you wish. The code is available here: github.com/whichlight/everything-incredible, and I ask to be referenced/credited should you choose to use the work. Over time, you will see updates to the code, as the album develops.
Although I want the music to be heard with the piezo, I recorded a few pieces and posted clips on vimeo.
How to play this album
1. Install the Arduino environment, and get your Arduino.
2. Find a piezo. Plug the red wire into pin 9 and the black into ground.
3. Download the script.
4. Plug your Arduino in and upload the script.
5. You will see a bunch of functions below loop() in the script. These correspond to different pieces. There are several ways to load them. In the loop() you can assign ‘pitch’ to the output of any of those functions. I added two more variables: the pulse width, and note duration. Those can be commented out, or changed as well.
Note that as the album develops this structure may change. In the final phase, there will be a button added to toggle between tracks.

