// Example by Krister Olsson
import krister.Ess.*;
AudioChannel myChannel;
void setup() {
// start up Ess
Ess.start(this);
// load "cell.aif" into a new AudioChannel
myChannel=new AudioChannel("cell.aif");
// randomly move the in and out loop points
myChannel.in((int)(random(myChannel.size/3)));
myChannel.out(myChannel.size-1-(int)(random(myChannel.size/3)));
// snap the in loop point to the nearest zero crossing
myChannel.snapInToZero();
// snap the out loop point to the nearest zero crossing
myChannel.snapOutToZero();
// cue to our in loop point
myChannel.cue(myChannel.in);
// start the sound looping forever
myChannel.play(Ess.FOREVER);
}
void draw() {
}
// we are done, clean up Ess
public void stop() {
Ess.stop();
super.stop();
}
|