I tested delay function in Sound library with the simple sequencer.
You can control start and stop by space bar.
When delaySw = false, it goes well. But, delaySw = true, the dry sound is not output.
In addition, I would like to adjust balance of dry and wet sound.
How do I can like that?
import processing.sound.*;
SoundFile[] file;
Delay delay;
boolean delaySw = false;
void setup() {
noLoop();
delay = new Delay(this);
file = new SoundFile[2];
file[0] = new SoundFile(this, "kick.wav");
file[1] = new SoundFile(this, "snare.wav");
if (delaySw) {
delay.process(file[1], 1);
}
delay.time(0.375);
delay.feedback(0.5);
loop();
}
int tick = 0;
int interval = 500;
int seq = -1;
boolean run = false;
void keyPressed() {
switch (key) {
case ' ':
run = !run;
break;
}
}
void draw() {
if (!run) {
seq = -1;
tick = millis();
return;
}
if (millis() < tick) {
return;
}
tick += interval;
seq++;
int cnt = seq % 4;
switch (cnt) {
case 0:
case 2:
file[0].stop();
file[0].play();
println(cnt + ":kick");
break;
case 1:
case 3:
file[1].stop();
file[1].play();
println(cnt + ":snare");
break;
}
}