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);
  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:

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!

1 Like

Hi,

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

2 Likes

@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

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!