# AudioFile ArrayIndexOutOvBoundsException: 3

**URL:** <https://discourse.processing.org/t/audiofile-arrayindexoutovboundsexception-3/4608>\
**Category:** Libraries\
**Created:** [October 18, 2018, 4:35pm UTC](https://discourse.processing.org/t/audiofile-arrayindexoutovboundsexception-3/4608 "2018-10-18T16:35:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FerrariLuigi](https://avatars.discourse-cdn.com/v4/letter/f/5f8ce5/32.png) [@FerrariLuigi](https://discourse.processing.org/u/FerrariLuigi)\
**Post date:** [October 18, 2018, 4:35pm UTC](https://discourse.processing.org/t/audiofile-arrayindexoutovboundsexception-3/4608/1 "2018-10-18T16:35:09Z")

</div>

Dear all,

I developed a very simple project:

```auto
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

---

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [October 19, 2018, 1:56am UTC](https://discourse.processing.org/t/audiofile-arrayindexoutovboundsexception-3/4608/2 "2018-10-19T01:56:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![FerrariLuigi](https://avatars.discourse-cdn.com/v4/letter/f/5f8ce5/32.png) [@FerrariLuigi](https://discourse.processing.org/u/FerrariLuigi)\
**Post date:** [October 20, 2018, 2:28pm UTC](https://discourse.processing.org/t/audiofile-arrayindexoutovboundsexception-3/4608/3 "2018-10-20T14:28:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [October 23, 2018, 2:42pm UTC](https://discourse.processing.org/t/audiofile-arrayindexoutovboundsexception-3/4608/4 "2018-10-23T14:42:46Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![FerrariLuigi](https://avatars.discourse-cdn.com/v4/letter/f/5f8ce5/32.png) [@FerrariLuigi](https://discourse.processing.org/u/FerrariLuigi)\
**Post date:** [October 25, 2018, 7:38am UTC](https://discourse.processing.org/t/audiofile-arrayindexoutovboundsexception-3/4608/5 "2018-10-25T07:38:08Z")

</div>

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