Persica
February 17, 2021, 12:00pm
1
Hello!
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
josephh
February 17, 2021, 3:11pm
2
Hi,
Welcome to the forum!
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 :
Optimizing-p5.js-Code-for-Performance
p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Proces...
Also on dekstop I have the following errors in the console (press F12
to open it) :
For this one you should be loading p5.js
before p5.dom.js
in your html file because the order is important :
<script language="javascript" type="text/javascript" src="https://autoglyphic.com\js\p5.js"></script>
<script language="javascript" type="text/javascript" src="https://autoglyphic.com\js\p5.dom.js"></script>
I don’t really know where these come from, do you have an idea?
As for the Safari issue, I can’t test this but I found this (quite old) issue on Safari too that has been solved :
opened 06:49AM - 21 Sep 19 UTC
closed 03:16AM - 31 Mar 20 UTC
Didn't see this previously reported. I have a bunch of p5 sound projects that are currently working in Chrome (thanks to...
You said you updated to the latest version of the library?
1 Like
Persica
February 19, 2021, 3:21pm
3
Thank you for the response
I am going through the code optimization now and rearranging p5.dom.js.
Yes It is the latest library.
1 Like
Persica
February 22, 2021, 9:29pm
4
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?