# Weird out of bounds issue with the sound library

**URL:** <https://discourse.processing.org/t/weird-out-of-bounds-issue-with-the-sound-library/2810>\
**Category:** Libraries\
**Created:** [August 21, 2018, 12:25am UTC](https://discourse.processing.org/t/weird-out-of-bounds-issue-with-the-sound-library/2810 "2018-08-21T00:25:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ducco](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ducco/32/1749_2.png) [@ducco](https://discourse.processing.org/u/ducco)\
**Post date:** [August 21, 2018, 12:25am UTC](https://discourse.processing.org/t/weird-out-of-bounds-issue-with-the-sound-library/2810/1 "2018-08-21T00:25:07Z")

</div>

i’m working on a game and i want to add sound effects so i installed the sound library but every time i try to load a sound it returns “ArrayIndexOutOfBoundsExeption: -1” and i don’t understand why. the sound file is in the right place and the library is installed correctly (because if that wasn’t true i’m sure i would’ve gotten a different error) i’m just really confused.

```auto
import processing.sound.*;
SoundFile file;

void setup() {
  size(640, 360);
  background(255);
    
  // Load a soundfile from the /data folder of the sketch and play it back
  file = new SoundFile(this, "sound.wav");
  file.play();
}      

void draw() {
}

```

(this demo code wont even work)

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [August 21, 2018, 1:14am UTC](https://discourse.processing.org/t/weird-out-of-bounds-issue-with-the-sound-library/2810/2 "2018-08-21T01:14:09Z")

</div>

Please try the minim library. The current sound lib is going through a revamp. Minim works as advertised.

Kf

---

<div class="post-metadata">

**Author:** ![kevinstadler](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@kevinstadler](https://discourse.processing.org/u/kevinstadler)\
**Post date:** [September 6, 2018, 3:49pm UTC](https://discourse.processing.org/t/weird-out-of-bounds-issue-with-the-sound-library/2810/3 "2018-09-06T15:49:21Z")

</div>

@ducco it seems like your default sound card does not have any output channels, maybe try manually selecting the appropriate sound card using the new `outputDevice()` method: [https://www.processing.org/reference/libraries/sound/Sound\_outputDevice\_.html](https://www.processing.org/reference/libraries/sound/Sound_outputDevice_.html)

The `ArrayIndexOutOfBoundsExeption` sure isn’t very helpful, I’ll add a more meaningful one as soon as possible, thanks for reporting!

---

<div class="post-metadata">

**Author:** ![kevinstadler](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@kevinstadler](https://discourse.processing.org/u/kevinstadler)\
**Post date:** [September 7, 2018, 4:47am UTC](https://discourse.processing.org/t/weird-out-of-bounds-issue-with-the-sound-library/2810/4 "2018-09-07T04:47:58Z")

</div>

This issue has now been fixed and the new 2.0.1 update of the Sound library should become available from the Content Manager at some point during the day. @ducco it would be very helpful if you could let me know if the update fixes your problem!

---

<div class="post-metadata">

**Author:** ![ducco](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ducco/32/1749_2.png) [@ducco](https://discourse.processing.org/u/ducco)\
**Post date:** [September 29, 2018, 12:10am UTC](https://discourse.processing.org/t/weird-out-of-bounds-issue-with-the-sound-library/2810/5 "2018-09-29T00:10:25Z")

</div>

i just used minim sorry for not responding @kevinstadler
