[SOLVED] Sound in p5.js code, how does that work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

[SOLVED] Sound in p5.js code, how does that work?

I want to attach a sound file (mp3) to my p5 code, followed all the instructions in the online reference, but it doesn’t seem to work. I think the file is loaded alright, but I can’t hear it. Can someone see the problem (and solution)? https://code.sololearn.com/WPq863BM1KO3/?ref=app

13th Dec 2019, 5:34 PM
marjel101
marjel101 - avatar
9 Answers
+ 6
good question sista, i have been wondering the same thing🤔
13th Dec 2019, 5:41 PM
toto
toto - avatar
+ 5
Very possible. Ive had users that use iOS have sound issues with my codes in the past And i am using Android with no iOS to test this yeh i have ios and it does not work...so it probably is an ios issue
13th Dec 2019, 6:29 PM
toto
toto - avatar
+ 3
Run loadSound from preload function https://code.sololearn.com/WV1VwhzSsmyc/?ref=app
24th Jun 2020, 5:37 AM
Calviղ
Calviղ - avatar
+ 2
「HAPPY TO HELP」 Really?! That’s great news 😃 Could it be possible that it’s another iOS issue again, that it works on Android but not an iPhones??
13th Dec 2019, 5:55 PM
marjel101
marjel101 - avatar
+ 2
Thanks 「HAPPY TO HELP」 and Sachin Shah for answering ☺️ I included an alert in the code that there’s music, but not for iPhone users 😁
13th Dec 2019, 6:12 PM
marjel101
marjel101 - avatar
+ 2
Okay, last answer in this thread: I disabled the P5 Sound function altogether and inserted an HTML <audio> tag. As long as the controls stay visible, this should work on iOS too 🎶🎵
13th Dec 2019, 6:54 PM
marjel101
marjel101 - avatar
+ 1
It is working 👍
13th Dec 2019, 5:55 PM
Sachin Shah
Sachin Shah - avatar
+ 1
marjel101 Wow only for Android 😂
13th Dec 2019, 6:32 PM
Sachin Shah
Sachin Shah - avatar
+ 1
Working on oneplus 6 here
15th Dec 2019, 12:30 AM
Matteo Mincarelli
Matteo Mincarelli - avatar