P5js-sound-mic-input example does not take in sound from microphone

I’m trying to run the p5js-sound-mic-input example that you can find here, but it isn’t reading in input from my microphone. There seems to be a problem with Glitch and not the code itself because when I copy and paste the code in sketch.js into the editor for p5.js (here) it works as expected.

If someone could explain why the code doesn’t work with Glitch that would be much appreciated!

What is the expected output? What are you getting?

The project asks for my mic.

For me on this project https://glitch.com/~p5js-sound-mic-input the circle moves to the mic input. Can you show us your version of the project?

1 Like

The circle should move to the mic input but it’s not moving for me at all.

Yeah the project asks for my mic too, but it doesn’t seem to take in anything as input.

Well, the example is hosted on Glitch, so it does work on Glitch, just not your project. Can I have a link to your project page (e.g. projectname.glitch.me) so I can have a look? :slight_smile:


For some reason it isn’t moving for me. I’m sorry for my lack of understanding, but what do you mean when you ask for my version of the project?

To make your own version of a project, you remix it, which is what I assumed you have done here. The first example you gave a link to works for me (the circle moves) and that is hosted on Glitch, so the problem must lie in your remix of the project. Can you clarify the project name of your version, if you have one?

I actually haven’t remixed it yet. I was trying to run the example that I linked and the circle wasn’t moving for some reason. I’m assuming that it’s probably a problem with my computer then if it’s only not working for me. However, I tried running the example on other computers and it still didn’t work. Is there any reason why this could be happening?

What browser are you using? Might be that. It worked for me, I remember. When it asks for your mic, is the right microphone selected? Does your computer have a mic?

I’m using Google Chrome. I’m pretty sure I’m selecting the right microphone and my computer has a mic. Also, I forgot to mention, but the example will sometimes work properly for me and the circle will move, but this rarely happens. And in the unlikely case where the example does work for me, if I refresh the page it will stop working.