p5.js-sound
p5.js-sound copied to clipboard
Mic Input not working on mobile browser
No microphone is being found on iPhone when using p5js mic.start() but works on desktop. Found this same issue when viewing the microphone p5 example here Mic has worked on other sites I've visited and the devices settings create no boundary to receiving the input .
Mobile returns:
mic active ? : null
mic source ? : none
Im using this code to activate the microphone:
function setup() {
getAudioContext().suspend();
mousePressed(userStartAudio)
mic = new p5.AudioIn();
mic.start();
level()
sound1()
setInterval(sound1, 60000)
fft = new p5.FFT();
fft.setInput(mic);
}
function draw() {
console.log("mic active ? : " + mic.enabled)
console.log("mic source ? : " + mic.currentSource)
console.log("mic input ? : " + mic.input)
Thanks very much for your help
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.
Can you try something like what's shown here, ie. triggering the audio context via a touch event.
Have tried implementing that to no avail - that example does not even work on my mobile (ios14.6) on chrome & safari
Hi, I’m having this same issue and think it might be related to the amplitude. I’m able to get this example to work on a mobile device: https://editor.p5js.org/Turrett/sketches/SkMyK9OuX
but my code is not working on mobile browsers only. It runs fine on desktop browsers. I am getting the permission pop up for the mic and am clicking “yes” on my mobile browser for my code, just like in that example above. The mobile browser does not seem to recognize changes in amplitude. I’ve tried using a mic plugged in as well, and very loud sounds to check if it was a threshold issue.
Maybe this is a different issue but I found this thread and noticed it was labeled as a bug, so I wanted to offer more info in case it helps resolve the issue!
For reference, I’m on iOS devices and have checked in Safari and Chrome on these devices. Thanks
Hi, I’m having this same issue and think it might be related to the amplitude. I’m able to get this example to work on a mobile device: https://editor.p5js.org/Turrett/sketches/SkMyK9OuX
but my code is not working on mobile browsers only. It runs fine on desktop browsers. I am getting the permission pop up for the mic and am clicking “yes” on my mobile browser for my code, just like in that example above. The mobile browser does not seem to recognize changes in amplitude. I’ve tried using a mic plugged in as well, and very loud sounds to check if it was a threshold issue.
Maybe this is a different issue but I found this thread and noticed it was labeled as a bug, so I wanted to offer more info in case it helps resolve the issue!
For reference, I’m on iOS devices and have checked in Safari and Chrome on these devices. Thanks
Just checked my code on android devices (kindle fire and Google pixel 4) and it runs as expected. This issue seems to be related to iOS devices. I went into settings on my device to see if I could adjust something there to resolve it (not ideal bc it would only work on my device)…. And there doesn’t seem to be a setting to change. I hope this info helps!