I’ve been using the minim library for a program that writes songs according to instructions.
When I try to use AudioRecorder, I keep getting this error:
=== Minim Error === === Couldn't invoke the sketchPath method: null
and the further error:
=== Minim Error ===
=== Couldn't create an AudioRecorder for 426232.wav.
Minim was working fine before I added the recorder. I have
minim = new Minim(this);
In the setup() method, where it’s supposed to be, and further, using println(sketchPath());
does indeed print out the absolute path to the sketch.
Processing doesn’t seem to have a problem with the sketchPath() function, and Minim didn’t seem to either until I added the audioRecorder.
I’m including a shortened version of the program here. I’m not sure what I did wrong. The compile error comes up at recorder.beginRecord();
because for some reason Minim’s audio recorder isn’t working with the sketchPath method.
Any help would be really appreciated!
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
Minim minim;
AudioOutput out;
AudioRecorder recorder;
float timeOfSong;
int lengthOfSong = 48;
int songKey = (int) random(1, 12);
boolean open = true;
static ArrayList<kiNote> kiNotes = new ArrayList<kiNote>();
String[] notes = {"A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"};
void setup() {
String songName = ""+month()+day()+hour()+minute()+".wav";
println(sketchPath());
minim = new Minim(this);
recorder = minim.createRecorder(out, songName);
//*******
//This is all just a long boring program where I have the song
//being written with the notes queued up. Nothing about this section changed
//when I added the recorder
//*******
out.resumeNotes();
}
void draw() {
recorder.beginRecord();
float dTime = millis();
if(millis() > dTime + timeOfSong) {
if(open) {
recorder.endRecord();
recorder.save().close();
open = false;
}
}
}