Is it possible to make processing overwrite recorded files? For example, code records ten audio files then when its reaches ten (rec9.wav) it overwrites the first recording (rec0.wav) with new audio and so on. Code below, any help is appreciated, thank you!
import ddf.minim.*;
Minim minim;
AudioInput in;
AudioRecorder recorder;
AudioPlayer player;
int prevTime;
int delay = 10000;
int recID = -1; //what to have a maximum of 10 ID's
int playID = 0;
boolean isRec = false;
void setup(){
size(512, 200);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 512);
prevTime = millis();
}
void draw(){
if (millis() - prevTime > delay){
prevTime = millis();
if(!isRec){
if(recorder != null && recorder.isRecording()) recorder.endRecord();
else{
recID++;
recorder = minim.createRecorder(in, "rec"+recID+".wav", true);
recorder.beginRecord();
}
isRec = true;
println("RECORDING");
}else{
if(recorder != null) {
recorder.endRecord();
recorder.save();
println("Done saving " + recID);
player = minim.loadFile("rec"+recID+".wav", 2048);
player.play();
}
isRec = false;
println("SAVING REC " + recID);
}
}
}
Can't you just do something like this?