[SOLVED] Sound in p5.js code, how does that work? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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
怌ļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ ļ¼“ļ¼Æ ļ¼Øļ¼„ļ¼¬ļ¼°ć€ 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 怌ļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ ļ¼“ļ¼Æ ļ¼Øļ¼„ļ¼¬ļ¼°ć€ 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