Flower Game: P5 audio does not play on safari, and crackles terribly on android


This is my first post and I am a beginner P5.js user.

I made a little game where you grow a flower which can be accessed here:
p5.js example
(audio plays as the flower develops)

Everything runs fine on a PC, however the audio crackles terribly on android, and the audio doesn’t play at all on safari.

I have updated to the latest p5.sound.js and included .OGG formats.

Is there anything I can do to resolve these issues yet?

1 Like


Welcome to the forum! :wink:

Nice project for a beginner user!

I tested this on Android (Samsung Galaxy A3) and it works fine, the sounds are ok but as you know phones (at least not the most recent ones) are less powerful than modern computers in terms of CPU and graphics power so the frame rate is a bit low.

I think that it might cause the audio to crackle as you said. To solve that, you can try to optimize your JavaScript code so it uses less computation / memory.

For this you can take a look at the following page on the GitHub wiki :

Also on dekstop I have the following errors in the console (press F12 to open it) :

As for the Safari issue, I can’t test this but I found this (quite old) issue on Safari too that has been solved :

You said you updated to the latest version of the library?

1 Like

Thank you for the response :slight_smile:
I am going through the code optimization now and rearranging p5.dom.js.

Yes It is the latest library.

1 Like


So I rearranged the dom, and went through the optimization page. I can’t figure out what the problem would be since it’s not a complex project.

The code runs just as it should on PC, but it does still get this error which is to do with Audio so perhaps this is relevant to mobile use?