processing / processing-sound

Audio library for Processing built with JSyn
https://processing.org/reference/libraries/sound/
GNU Lesser General Public License v2.1
149 stars 50 forks source link

ArrayIndexOutOfBoundsException: 20823 #11

Closed rockyhawk64 closed 6 years ago

rockyhawk64 commented 6 years ago

The code was working perfectly normal before the new API thing, and now it keeps giving this same error highlighted here:

menus = new SoundFile(this, "menu.mp3");

That's just the first sound file there so that's probably why it chooses that one but is there a way to use the old version that was working perfectly for me? (the new version that broke it was 2.0.1)

ERROR:

ArrayIndexOutOfBoundsException: 20823

Sep 11, 2018 11:12:31 PM com.jsyn.devices.javasound.JavaSoundAudioDevice <init> INFO: JSyn: default output latency set to 80 msec for Windows 10 Sep 11, 2018 11:12:31 PM com.jsyn.engine.SynthesisEngine start INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.8.0 (build 463, 2017-10-16)

kevinstadler commented 6 years ago

Can you please post the full stack trace of the exception, and possibly also upload the mp3 file somewhere so I can test it?

It's possible that this is fixed by applying GlaDOSik/JavaMP3@73bd62e01a7170ded3435ffdec0241898472f978 to the Sound libraries JavaMP3 dependency, but I'm not 100% certain.

CodingCellist commented 6 years ago

I have also run into this problem. I tried with both

explosion = new SoundFile(this, "explosion.mp3");

and

explosion = new SoundFile(this, "../data/explosion.mp3");

I get the following stack trace:

Sep 28, 2018 10:20:56 AM com.jsyn.engine.SynthesisEngine start
INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.8.0 (build 463, 2017-10-16)
java.lang.ArrayIndexOutOfBoundsException: 16
    at fr.delthas.javamp3.Decoder.samples_I(Decoder.java:1506)
    at fr.delthas.javamp3.Decoder.decodeFrame(Decoder.java:517)
    at fr.delthas.javamp3.Sound.decodeFullyInto(Sound.java:228)
    at processing.sound.SoundFile.<init>(Unknown Source)

EDIT: The issue persists with version 2.0.0

kevinstadler commented 6 years ago

Thanks for the information, this is definitely to do with the patch I linked to above. I will try to get a fixed version out within a day or two!

kevinstadler commented 6 years ago

@teh6 I've uploaded a new release that should fix the problem: https://github.com/processing/processing-sound/releases/tag/v2.0.2 Could you do me a favour, download the zip, replace your current installation of the Sound library (under libraries/sound in your Processing folder) with the content of the zip, restart Processing and let us know if you can successfully decode the mp3 with the new version? Many thanks!

CodingCellist commented 6 years ago

@kevinstadler Apologies for the late reply. I have tried the new version you have linked, and it works with my .mp3 files. Thank you so much!

P.S. I get the following info to stderr, I assume this is intended:

Oct 03, 2018 9:49:05 AM com.jsyn.engine.SynthesisEngine start
INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.8.0 (build 463, 2017-10-16)
Oct 03, 2018 9:49:43 AM com.jsyn.engine.SynthesisEngine$EngineThread run
INFO: JSyn synthesis thread in finally code.
kevinstadler commented 6 years ago

@teh6 fantastic, thanks for testing, I'll roll the fixed version out as soon as possible! And yes, that stderr redtext is semi-intended (see #12)

boloramg commented 6 years ago

@teh6 fantastic, thanks for testing, I'll roll the fixed version out as soon as possible! And yes, that stderr redtext is semi-intended (see #12)

Hello, kevinstadler, I'm working with an mp3 sound file on windows 10 using the latest version of Processing. I get the below error message when run the code:

**ArrayIndexOutOfBoundsException: 16

Oct 23, 2018 2:13:39 AM com.jsyn.devices.javasound.JavaSoundAudioDevice INFO: JSyn: default output latency set to 80 msec for Windows 10 Oct 23, 2018 2:13:39 AM com.jsyn.engine.SynthesisEngine start INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.8.0 (build 463, 2017-10-16)**

Would you by any chance be able to help me as well?

haschdl commented 6 years ago

Experiencing the same error ArrayIndexOutOfBoundsException in Windows 10.

multimentha commented 6 years ago

I also experience the same problem with certain mp3 files under Windows 7 and using version 2.0.2 of the sound library.

A temporary work around is to convert your mp3 files to wav. I used Audacity to convert to 16 bit signed integer wav and those files play back fine.

haschdl commented 6 years ago

I tried the conversion to AIF and WAV using VLC player but it didn’t work. I ended up switching to Minim library, which is much older... but so far so good.

rottenoats commented 6 years ago

EDIT: Just noticed #228 , worked with wav. I think the Processing3 docs need to be updated to indicate that wav needs to be used instead of mp3.

Hello, I'm getting an IndexOutOfBoundsException with the version 2.0.2

background = new SoundFile(this, "background.mp3");

Stack Trace:

Oct 27, 2018 12:28:48 AM com.jsyn.engine.SynthesisEngine start
INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.8.0 (build 463, 2017-10-16)
java.lang.IndexOutOfBoundsException
    at java.io.BufferedInputStream.read(BufferedInputStream.java:338)
    at fr.delthas.javamp3.Decoder.readInto(Decoder.java:1784)
    at fr.delthas.javamp3.Decoder.samples_III(Decoder.java:628)
    at fr.delthas.javamp3.Decoder.decodeFrame(Decoder.java:546)
    at fr.delthas.javamp3.Sound.decodeFullyInto(Sound.java:228)
    at processing.sound.SoundFile.<init>(Unknown Source)
    at sketch_181026a.setup(sketch_181026a.java:42)
    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)

Sound file is in my data folder and is named "background.mp3"

Link to the sample music downloaded here (the 64 kpbs version) http://mp3normalizer.com/download?id=bTdtSVo1djV2SFU=

TenaciousBirdofPrey commented 5 years ago

I tried converting from mp3 to wav and got the following:

Dec 04, 2018 4:59:37 PM com.jsyn.devices.javasound.JavaSoundAudioDevice INFO: JSyn: default output latency set to 80 msec for Windows 10 Dec 04, 2018 4:59:37 PM com.jsyn.engine.SynthesisEngine start INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.8.0 (build 463, 2017-10-16) Dec 04, 2018 4:59:42 PM com.jsyn.engine.SynthesisEngine$EngineThread run INFO: JSyn synthesis thread in finally code.

kevinstadler commented 5 years ago

@deep-howlround the output you posted is just status information, not an error message. Your sketch should be working as expected (for the 5 seconds that it was running).

abrotons commented 4 years ago

With Sound 2.2.3 I was getting the same IndexOutOfBoundsException only with a couple of MP3 files out of a handful. When I opened the files with Audacity I realised they were the only mono files. So converting them to stereo fixed the problem.

I'm not sure if there is a quicker way to do this, but I imported them to Audacity, created an empty stereo track, copied and pasted the original sound to the new track, removed the old mono track and exported again.

Rezahans commented 1 year ago

i have tried ,you can use with any other file except .mp3