Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The library folder doesn't have the ".jar" file, so Processing IDE is unable to recognize sound files #106

Closed
SammySylvester opened this issue Nov 21, 2024 · 6 comments
Labels

Comments

@SammySylvester
Copy link

Hello everyone!

I just downloaded the zip folder and extracted it in the libraries folder inside Processing sketchbook, but it seems that Processing IDE doesn't recognize it since it gives me the following error message: "The class does not exist"
Searching online about this issue, it found out that for installing a library inside Processing sketchbook without Contribution Manager, that library needs to have a ".jar" file with the same name as the library inside the library folder. All the other Processing libraries have this ".jar" file, but this library doesn't.

What is the solution for installing this library even without the ".jar" file?

Many thanks in advance!
Sammy

@kevinstadler
Copy link
Collaborator

Hello,

the sound.jar is inside the library/ folder (which is itself a subfolder of sound/, which should be found inside your Processing installation's libraries/ folder after extracting the zip). The jar is definitely present in the latest zip release, link here: https://github.com/processing/processing-sound/releases/download/v2.4.0/sound.zip

Is there a particular reason why you can't install the library from the contribution manager? This is the recommended way to install libraries.

Best

@SammySylvester
Copy link
Author

Hi!

The reason is an error that Processing IDE throws when I try to run a code that contains the "import processing.sound.*" line.. This didn't happen from the beginning, but since a while I guess.. And it seems that the same error occurs both from contribution manager-installed sound folder as well as the downloaded zip folder.
The error looks like this:

Exception in thread "Thread-15" java.lang.NullPointerException: Cannot read the array length because "list" is null
at processing.app.Library.wrapFiles(Library.java:427)
at processing.app.Library.getApplicationExports(Library.java:437)
at processing.mode.android.AndroidBuild.copyImportedLibs(AndroidBuild.java:839)
at processing.mode.android.AndroidBuild.createAppModule(AndroidBuild.java:481)
at processing.mode.android.AndroidBuild.createProject(AndroidBuild.java:262)
at processing.mode.android.AndroidBuild.build(AndroidBuild.java:223)
at processing.mode.android.AndroidMode.handleRunDevice(AndroidMode.java:294)
at processing.mode.android.AndroidEditor$17.run(AndroidEditor.java:421)

The "Thread-15" keeps changing each time I run the code!
I saw a similar thread on this subject and I followed your solution from there, but it didn't work for me. Is there any other way to make sound work in Processing Android?

Best regards

@kevinstadler
Copy link
Collaborator

Ah, I didn't realize you were on Android. Please try the following:

  1. delete the current sound/ directory inside libraries/
  2. then extract sound-android.zip and try again

@SammySylvester
Copy link
Author

Hi again!

I've downloaded the sound-android.zip folder from this page's link, but it gave me error on any audio file I tried to run.. After that, I went on the other page's link, downloaded the folder from there, extracted it into the libraries/ directory as you said and tested three audio file-formats: MP3, AIF and WAV in both Java and Android Mode.

In Java Mode, AIF and WAV worked very good, but MP3 gave the following exception RuntimeException: javax.sound.sampled.UnsupportedAudioFileException: Stream of unsupported format.

In Android Mode, AIF and WAV also worked very good, but MP3 gives the following FATAL EXCEPTION:

FATAL EXCEPTION: Animation Thread Process: processing.test.sound_test_android, PID: 13687 java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/sound/sampled/AudioSystem; at processing.sound.SoundFile.<init>(Unknown Source:57) at processing.sound.SoundFile.<init>(Unknown Source:1) at processing.test.sound_test_android.sound_test_android.setup(sound_test_android.java:28) at processing.core.PApplet.handleDraw(PApplet.java:1878) at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:478) at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:518) Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.sound.sampled.AudioSystem" on path: DexPathList[[zip file "/data/app/~~m1KnjY1o5s7OTZ6JLbv3sQ==/processing.test.sound_test_android-MBHsqdrDkgmutQ8u7HhOgg==/base.apk"],nativeLibraryDirectories=[/data/app/~~m1KnjY1o5s7OTZ6JLbv3sQ==/processing.test.sound_test_android-MBHsqdrDkgmutQ8u7HhOgg==/lib/arm64, /system/lib64, /system/system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) at java.lang.ClassLoader.loadClass(ClassLoader.java:637) at java.lang.ClassLoader.loadClass(ClassLoader.java:573) ... 6 more

So after all this ordeal, I decided to use Android Mode with your folder (playing only WAV and AIF files, which is pretty good for me) and Java Mode with the original sound folder (where I can use all three main audio file-formats). :)

Thank you very much for your help and assistance!
And please check this page's sound-android.zip folder and why it is giving error (something about duplicate classes as far as I can remember) on any audio files' playing attempts..

Keep up the good work! 👍
Sammy

@kevinstadler
Copy link
Collaborator

That's great to hear, thanks for your feedback! Yes we are aware that only WAV/AIF are supported on Android at the moment, but they are the most stable/recommended formats anyway.

Could you please just confirm whether it was this sound-android.zip that worked for you in the end: https://github.com/processing/processing-sound/files/12718916/sound-android.zip
whereas this one didn't?: https://github.com/processing/processing-sound/releases/download/v2.4.0/sound-android.zip

@SammySylvester
Copy link
Author

Hi, thanks!
I'll be fine with WAV/AIF file formats! :)

Yes, this one worked for me: https://github.com/processing/processing-sound/files/12718916/sound-android.zip

Good luck! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants