Sound Library Issue

I’m having a Sound Library Issue in Processing for Android. Running a sketch in the emulator or on a device (moto 4, Galaxy Tab A (8", 2019); sound play back works good, but when I exit() the sketch then restart it there is NO sound. when I exit() the sketch it is sent to the background. Restarting it produces no sound. If I swipe away or kill the sketch in the background and restart, there IS sound again.
Has anyone experienced this issue? I’ve tried multiple sketches including audio examples that come with the sound library with the same result.
I don’t feel comfortable publishing an app on google play with this issue.
Can anyone help?

@markcosmic ===
i dont use this library but perhaps it works wrapping the mediaplayer API; in this case you have to use onPause() && onResume () to pause && restart the sound.

Which mediaplayer API are you suggesting? Processing 3 only has 2 libraries that can work in Android mode: sound and cassette. Cassette seems to work but I can’t figure out how to make control the volume from within the app. Many apps have controls for say, effects or background music or dialogue. The “sound” library is very robust and would be my first choice to import in an Android app.
Thank you for your input and any future input

@markcosmic ===
i have already put code snippet for using it with P5, try searching this forum or the previous one

and if you are asking for volume control:
MediaPlayer.setVolume(float right, float left);

Thank you for the link. Is there a way to import that MediaPlayer class into a Processing 3 sketch using the Processing development environment?

My suggestion is to dig into the source code and understand the implementation of the Sound library. Then, it is very likely you will need to ensure this internal “sound” structure is disposed properly. I wouldn’t discard this to be a bug and in that case, my approach would be to use Akenaton’s approach and file a bug report. To implement the MediaPlayer, I will start by exploring previous posts and you will find a starting point:

You should address this issue before you publish.


Thank you. I checked out the links. I get it.
Again, thank you.
I also, reported what could be a bug in the Sound library. It most likely wasn’t intended for Processing for Android

Ok, have little understanding about Android mediaplayer but have it working for a single sound “blip”. This is great. Thank you. The links were very helpful. I couldn’t find an example of multiple sound use “blip” “beep” “blip”… It seem obvious to have multiple instances of mediaplayer for each sound. But with my lack of knowledge of the mediaplayer api, I can only assume. Also, I’m not sure if it’s better to release() each mediaplayer instance after each sound use or when I exit() the sketch. Currently, I release() the mediaplayer instance when I exit() the sketch. Further advice or links from you would be appreciated. Again, thank you for the knowledge you’ve shared