I’m not always the best at making time for play. It’s very easy as an entrepreneur to have everything be about work in some way or another. Once the vision is big enough, there is no practical end.
This evening I discovered something wonderful (to me): WebChuck
It instantly transported me back to my days in PLOrk, where I first learned computer science, in ChucK.
(I do not recommend ChucK as your first programming language, I had a lot of unlearning to do.)
I hacked one of the demos for fun. It’s a little arpeggiator that plays a harmonic series. I added a low pass filter and an echo. I also added a slider for the filter frequency and a slider for the echo mix. Change chop
to change the base frequency. Change slow
to change the tempo.
Today, I made just a little bit of time for play. I’m glad I did. Maybe I’ll try it again someday.
Copy and paste the code below into the editor at WebChuck to play with it yourself.
// Harmonic Series Arpeggiator
// Written by Terry Feng
// CHANGE ME! ADD MULTIPLE SHREDS!
// Completely ruined by Raymond Weitekamp
1 => float chop; //let's go bro
1 => float slow;
//GUI bro
0.5 => global float f; // global variables create a GUI slider
0 => global float e;
220 => float baseFrequency; // starting frequency
12 => int numHarmonics; // number of harmonics to play
125::ms => dur noteDur; // note duration
// Unit Generator
SawOsc osc => LPF lpf => Echo a => dac;
osc.gain(0.5);
while (true)
{
// Loop through the number of harmonics
for (0 => int i; i < numHarmonics; i++)
{
// Update the oscillator frequency to the next harmonic
(baseFrequency + (i * baseFrequency))/chop => osc.freq;
//gui freqs
f * 20000 => lpf.freq;
e => a.mix;
// Advance time to play the note
(noteDur * slow) => now;
}
}