We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › proMIDI crash "Exception in thread-6"
Page Index Toggle Pages: 1
proMIDI crash "Exception in thread-6" (Read 503 times)
proMIDI crash "Exception in thread-6"
Sep 15th, 2007, 4:49am
 
Hi, I'm working on a project interpreting a live camera feed, with each image rendered off of the camera (30fps) I am sending 4 midi notes.

Sometimes it can run for 10 minutes or so, but eventually it will generate the following error:

Exception in thread "Thread-6" java.lang.ArrayIndexOutOfBoundsException: 40
at java.util.AbstractCollection.toArray(AbstractCollection.java:126)
at promidi.MidiOut$NoteBuffer.run(MidiOut.java:293)


I used to get a similar error but instead of ArrayIndexOutOfBoundsException, it used to be a NullPointerException. In both scenarios it was Exception in thread "Thread-6" and at promidi.MidiOut$NoteBuffer.run(MidiOut.java:293)

Here is the code for the sound executed each draw():
Code:

void generateSound() {

int[] brightnessAverages = getAverageBrightnessOfQuads();

int[] MIDIAverages = new int[4];
for(int i=0;i<brightnessAverages.length;i++)
{
MIDIAverages[i] = brightnessAverages[i] /2;
}

activeSum1 /= 19;
activeSum2 /= 19;
activeSum3 /= 19;
activeSum4 /= 19;

if(activeSum1 > 127) activeSum1 = 127;
if(activeSum2 > 127) activeSum2 = 127;
if(activeSum3 > 127) activeSum3 = 127;
if(activeSum4 > 127) activeSum4 = 127;

midiout.playNote(MIDIAverages[0],activeSum1,int(random(1000)));
midiout.playNote(MIDIAverages[1],activeSum2,int(random(1000)));
midiout.playNote(MIDIAverages[2],activeSum3,int(random(1000)));
midiout.playNote(MIDIAverages[3],activeSum4,int(random(1000)));


resetAverages();
}


Here is the code sending the note in my MIDIOut class:
Code:

public void playNote(int pitch, int velocity, int order) {
Note note = new Note(pitch, velocity, order);
midiOut.sendNote(note);
}



Some times it causes SimpleSynth to hang on a note and then it needs to re-started... Im not sure if that is a cause or effect.

Any ideas whats causing the crash?

thanks!
Page Index Toggle Pages: 1