// Example by Krister Olsson
import krister.Ess.*;
AudioChannel myChannel;
WhiteNoise myNoise;
void setup() {
size(256,200);
// start up Ess
Ess.start(this);
// create a new AudioChannel
myChannel=new AudioChannel();
// set the channel size to 5 seconds
myChannel.initChannel(myChannel.frames(5000));
// generate 3 seconds of soft white noise
myNoise=new WhiteNoise(.1);
myNoise.generate(myChannel,0,myChannel.frames(3000));
// generate 2 seconds of loud white noise
myNoise.volume=1;
myNoise.generate(myChannel,myChannel.frames(3000),myChannel.frames(2000));
// play
myChannel.play();
}
void draw() {
}
// we are done, clean up Ess
public void stop() {
Ess.stop();
super.stop();
}
|