Help, I am getting this error message every time a run a code: Could not run the sketch (Target VM failed to initialize). have tried to run other included examples and they work pretty well, but not my code.
here it is:
import processing.sound.;
import processing.serial.;
SoundFile sample;
FFT fft;
AudioDevice device;
Serial myPort;
float[] spectrum =new float[3];
float r, g, b;
float smoothing = 0.2;
public void setup() {
size(640, 360); // Size of the serial window
device = new AudioDevice(this, 44000, 3);
sample = new SoundFile(this, “TwentyOnePilotsOdeToSleep.mp3”); // select your music here
sample.loop();
fft = new FFT(this, 3);
fft.input(sample);
myPort = new Serial (this, “COM3”, 9600); // Set the com port and the baud rate according to the Arduino IDE
}
public void draw() {
background(0, 0, 0);
fft.analyze();
spectrum[0] += (fft.spectrum[0] - spectrum[0]) * smoothing;
spectrum[1] += (fft.spectrum[1] - spectrum[1]) * smoothing;
spectrum[2] += (fft.spectrum[2] - spectrum[2]) * smoothing;
r = spectrum[0]height4;
g = spectrum[1]height4;
b = spectrum[2]height4;
stroke(255,0,0);
line( width/3 - 50, height, width/3 - 50, height - r );
stroke(0,255,0);
line( 2width/3 - 50, height, 2width/3 - 50, height - g);
stroke(0,0,255);
line( width - 50, height, width - 50, height - b );
myPort.write((int)r % 255);
myPort.write((int)g % 255);
myPort.write((int)b % 255);
}