Homework 2 is about synthesizing an auditory streaming illusion using FM tones.

Preloading of the pattern class

Like 4against3.html, click the mouse to start an accelerating pattern. This demonstrates how to move the code for the IsoRhythm class to a separate .ck file which gets preloaded, simplifying the amount of code displayed here. The IsoRhythm class has been defined as a public class in the file isoRhythm.ck. By preloading that file the class becomes available for use in the live code below.

////////////////////////////////////////////////////
live code
// global int mouseX, mouseY; // mouse position is unused global Event playRiff; IsoRhythm iso; // instantiate an IsoRhythm object fun void mousePlay() { while (true) { playRiff => now; // howLong, accel, minInterOnsetInterval spork ~ iso.play(15::second, 0.9, 40::ms); } } spork ~ mousePlay(); 1::week => now;