continuous counting of the recordings - minim
in
Core Library Questions
•
1 year ago
Hi everyone,
I did a little program with the help of the
Zemen's code and I was wondering if there is a way to continue the counting of the recordings, without starting always from the 0, everytime the application initializes. that starting is currently happening with my code. does anyone has some tip?
I created the int programCycles in order to increment +1 always when the program is finished, but it seems it's not the way...
thanks!
- import ddf.minim.*;
- Minim minim;
- AudioInput in;
- AudioRecorder recorder;
- int programCycles = 0;
- int nextName = 0; //it changes the name
- void setup()
- {
- minim = new Minim(this);
- in = minim.getLineIn(Minim.STEREO, 2048); // default sample rate is 44100, default bit depth is 16
- newRecording();
- }
- void draw()
- { }
- void keyReleased()
- {
- if (key=='r')
- {
- if ( recorder.isRecording() )
- {
- recorder.endRecord();
- println("End of recording.");
- }
- else
- {
- newRecording();
- recorder.beginRecord();
- println("Start of recording.");
- }
- }
- if ( key == 's' )
- {
- nextName++; //change the file name, everytime +1
- recorder.save();
- println("Done saving.");
- println(nextName-1); //check the name
- }
- }
- void newRecording() //change the file name
- {
- if (programCycles>0)
- {
- nextName=0;
- }
- else
- {
- recorder = minim.createRecorder(in, "recording" + nextName +"_"+programCycles+ ".wav", true);
- }
- }
- void programCycles()
- {
- programCycles++;
- println(programCycles);
- }
- public void stop()
- {
- programCycles();
- in.close();
- minim.stop();
- super.stop();
- }
1