# Sound - error when trying to construct any object

**URL:** <https://discourse.processing.org/t/sound-error-when-trying-to-construct-any-object/3283>\
**Category:** Libraries\
**Created:** [September 5, 2018, 2:23pm UTC](https://discourse.processing.org/t/sound-error-when-trying-to-construct-any-object/3283 "2018-09-05T14:23:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SoundProblems](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@SoundProblems](https://discourse.processing.org/u/SoundProblems)\
**Post date:** [September 5, 2018, 2:23pm UTC](https://discourse.processing.org/t/sound-error-when-trying-to-construct-any-object/3283/1 "2018-09-05T14:23:39Z")

</div>

Hi all, I get “ArrayIndexOutOfBoundsException: -1” error when I run the following example code:

```auto
import processing.sound.*;
SawOsc saw;

void setup() {
  size(640, 360);
  background(255);
    
  // Create square wave oscillator.
  saw = new SawOsc(this);
  saw.play();
}

void draw() {
}

```

- Exception is thrown by the “saw = new SawOsc(this);”
- I installed the official sound library (2.0.0) using the “import library” inside the program
- I’m using Processing 3.4

It also reads:

> Eyl 05, 2018 5:04:14 PM com.jsyn.devices.javasound.JavaSoundAudioDevice   
> INFO: JSyn: default output latency set to 80 msec for Windows 7

on the console.

Here’s the error:

```auto
java.lang.ArrayIndexOutOfBoundsException: -1
	at java.util.ArrayList.elementData(ArrayList.java:422)
	at java.util.ArrayList.get(ArrayList.java:435)
	at com.jsyn.devices.javasound.JavaSoundAudioDevice.getMaxInputChannels(Unknown Source)
	at processing.sound.Engine.startSynth(Unknown Source)
	at processing.sound.Engine.<init>(Unknown Source)
	at processing.sound.Engine.getEngine(Unknown Source)
	at processing.sound.SoundObject.<init>(Unknown Source)
	at processing.sound.Oscillator.<init>(Unknown Source)
	at processing.sound.SawOsc.<init>(Unknown Source)
	at sketch_180905a.setup(sketch_180905a.java:27)
	at processing.core.PApplet.handleDraw(PApplet.java:2404)
	at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1557)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:313)

```

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [September 5, 2018, 2:50pm UTC](https://discourse.processing.org/t/sound-error-when-trying-to-construct-any-object/3283/2 "2018-09-05T14:50:13Z")

</div>

Hi,

Try using the [minim library](http://code.compartmental.net/minim/) instead.  
The one you are using is under maintenance. Check this thread : [Early builds of the new Processing Sound library available for testing](https://discourse.processing.org/t/early-builds-of-the-new-processing-sound-library-available-for-testing/1796)

---

<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:46pm UTC](https://discourse.processing.org/t/sound-error-when-trying-to-construct-any-object/3283/3 "2018-09-06T15:46:56Z")

</div>

@SoundProblems 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)

If you’ve tried using minim, could you please let us know if the sound there worked out of the box for you, or if you also had to configure manually?

---

<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:49am UTC](https://discourse.processing.org/t/sound-error-when-trying-to-construct-any-object/3283/4 "2018-09-07T04:49:42Z")

</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. @SoundProblems it would be very helpful if you could let me know if the update fixes your problem!
