Sound - error when trying to construct any object

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

import processing.sound.*;
SawOsc saw;

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

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:

java.lang.ArrayIndexOutOfBoundsException: -1
	at java.util.ArrayList.elementData(
	at java.util.ArrayList.get(
	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(
	at processing.core.PApplet.handleDraw(
	at processing.awt.PSurfaceAWT$12.callDraw(
	at processing.core.PSurfaceNone$

Thanks in advance!

1 Like


Try using the minim library instead.
The one you are using is under maintenance. Check this thread : Early builds of the new Processing Sound library available for testing


@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:

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?

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!