I have an issue with the Sound library import into the Android Mode. All works fine when in Java Mode, all sounds are playing as they should, but in Android Mode the " import processing.sound.* " line of code gives me the following error:
Exception in thread "Thread-119" 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)
Without the abovementioned line of code, all works well!
What is the problem? Why the Sound library doesn’t work in Android Mode?
I use the Processing 4.3 IDE.
Also the “Thread-119” portion gets changed with other numbers each time I compile my code!
@SammySylvester84@joshuamv I don’t think this is an issue with the Processing Sound library, rather Android Mode in general. It appears that both sound libraries that support Android (P4/Sound and Pd4P3) both throw cryptic errors that seem to be related to importing external libraries.
I can confirm that Pd4P3 works on Android via Android Studio, but not when using Android mode, at least on Windows.
I will report this to the processing-android team.
I had a lot of problems with the Sound Library.
I removed the existing Sound library and downloaded the last version of Processing-Sound from github (Download the zip file and extract it into the Processing Library Directory). You can run the sketches from “Examples” to check if they run correctly.
I removed the existing Sound library and downloaded the latest version of Processing-Sound from Github as you adviced, but it gives me an error when adding a Sound File (“The class SoundFile does not exist”). After an online research, it seems that the Processing IDE needs a “.jar” file inside library folder of this extracted folder to recognize Sound Files and this zip folder from Github doesn’t have it. I opened an issue with this subject on Processing-Sound Github page and I am waiting for an answer.
What about you? Have you managed to play a Sound File with this downloaded folder?
Hi
Yes, I wrote a few sketches and they work.
If you use a Sound File it must be in .aiff format.
Try to run the example “Sampler” Under IDE/File/Examples/Libraries/Sound/Sound/Soundfile/Sampler
and check if it works.
Thanks for these solutions, MPROCD and Sammy. I’ve moved my current project from Processing to p5.js in part because of the sound for Android issue, and in part just to make the whole project browser-based and therefore easier for cross-platform. But if/when I come back to prototyping something new in Processing, I’ll keep this sound option in mind.
It doesn’t work… It’s giving me the same error message like in the beginning… The strange fact is that at the beginning of the year sound worked fine in Android Mode. I don’t know what happened in the mean time…
Hi everyone!
After trying all kind of versions, I’ve managed to get Android Sound working by downloading this folder from Github. It works only with WAV or AIF file formats in both Java and Android Mode, but for me this is better than nothing, since I can convert online MP3 files to WAV files at anytime.
So I think this is the best solution I found so far and my project works now very well with this library, so I recommend it to you as well!
Under Category Processing for Android, see Post title: Problems with Sound Library in Android by MPROCD. Under this post see sub post dated Aug 29, beginning with: Problem solved.
Good luck
Yes, I tried that too, but it didn’t work for me. Don’t know why… But I am good with the current result. The guy that uploaded the folder I was talking about asked me very precisely what folder worked and what folder didn’t. He seemed to be in charge with Android Processing and he was the one that made changes to the initial folder, so I believe he will make the necessary adjustments for Android Sound to work better in the future!
So I recommend all of you to put questions on Github or anywhere if you have issues of any kind, because all improvements can be possible if you tell exactly what are you dealing with!