AudioFile ArrayIndexOutOvBoundsException: 3

Dear all,

I developed a very simple project:

import processing.sound.*;

SoundFile f1;
SoundFile f2;
SoundFile f3;
SoundFile f4;
SoundFile f5;
 
void setup()
{
  loadAudioError();
}
 
void draw()
{
}
 
void loadAudioError()
{
  f1= new SoundFile(this, "f1.mp3");
  f2= new SoundFile(this, "f2.mp3");
  f3= new SoundFile(this, "f3.mp3");
  f4= new SoundFile(this, "f4.mp3");
  f5= new SoundFile(this, "f5.mp3");
}

First file (f1) is loaded correctly but the progam stops at the ssecond line
f2= new SoundFile(this, "f2.mp3");

and the following error message is displayed:

ArrayIndexOutOvBoundsException: 3

Unfortunately I don’t use array and the size of each MP3 file is less than 20Kbyte (I have a PC with 12GB RAM)
Did you have any similar problem ?
How do you fix it ?
Thank you very much for your help and cooperation
regards

I can’t be able to replicate the error. Is that your full code? Try to make a copy f1.mp3 and rename it f2.mp3, f3.mp3 etc. Does the error still occur?

It is full code. I replaced all mp3 files with wave file but the problem remainns

Following up on Sarah’s suggestion, if you run this sketch, does it work?

import processing.sound.*;

SoundFile f1;
// SoundFile f2;
// SoundFile f3;
// SoundFile f4;
// SoundFile f5;
 
void setup() {
  loadAudioError();
}
 
void draw() {
}
 
void loadAudioError()
{
  f1= new SoundFile(this, "f1.mp3");
  // f2= new SoundFile(this, "f1.mp3");
  // f3= new SoundFile(this, "f1.mp3");
  // f4= new SoundFile(this, "f1.mp3");
  // f5= new SoundFile(this, "f1.mp3");
}

If not, try with a different mp3 file – one from the Processing examples that is “known-good.”

If it does work, try adding a second SoundFile pointed at the same mp3. Then a third, fourth, fifth.

If those all work, then try changing one of the files to a different mp3. Et cetera.

Dear all,
I fixed it changing the sound library.
Now I’m using minim library and it worka fine.
Thank you very much.
regards

1 Like