Reputation: 123
I'm developing an experimental website which uses p5.Sound
to analyze a certain song and I use the frequencies of this song to draw on a canvas.
The sound sounds great on my laptop & PC, but the problem is that when I try to listen to it on mobile, it starts to flicker, and it's slowed down (a lot...)
I've tried on other phones and it's the same. Even on the official docs: https://p5js.org/examples/sound-sound-effect.html It's laggy for a simple ring sound.
Does anyone experience this issue?
It's working fine if I use regular JavaScript and HTML <audio>
elements.
Also, do you know others simple ways to get frequencies of a sound played from html <audio>
elements?
Upvotes: 2
Views: 315
Reputation: 123
So I found the solution by looking at how p5.sound works.
I ended up using the Web Audio API. I created an audio context then an analyzer and the sound was no longer distorted on mobile. The process is almost the same as if you where using p5 :)
Upvotes: 1