A small problem with Krister.Ess library
in
Contributed Library Questions
•
3 years ago
Hi there,
Could someone please have a look at the following code and see why I might be getting a NullPointerException?
Whenever I try to compile it highlights the line 'myFile.read(buffer,0, BSIZE); ' but i can't figure out why.
Hope you can help,
-dave
------------------------------------------
import krister.Ess.*;
AudioStream myStream;
AudioFile myFile;
int BSIZE = 4096;
AudioStream myStream;
AudioFile myFile;
int BSIZE = 4096;
void setup() {
size(256,200);
float[] buffer = new float[BSIZE];// start up Ess
Ess.start(this);
// get ready to stream our radio station (KXJC)
// (Ess.READ does not require a sample rate)
myFile=new AudioFile("t.wav",0,Ess.READ);
myFile.read(buffer,0, BSIZE);
for(int n = 0; n < BSIZE; n++){
println(buffer[n]);
point(n/50,buffer[n] * 400.0 + 100.0);
}
}
void draw() {
}
public void stop() {
Ess.stop();
super.stop();
}