Asvarox / allkaraoke

Online Karaoke game with pitch detection in your browser
https://allkaraoke.party
86 stars 17 forks source link

Volume indicator lights up but pitch is not detected #286

Open JacekLach opened 3 months ago

JacekLach commented 3 months ago

Hey; I'm unable to get the site to detect any pitch. The bottom right volume indicator lights up when the mic is in use, but no pitch is ever registered. Inspecting the code, it looks like the aubiojs detector in AubioStrategy is always returning 0 in getFrequency. I noticed the data array is very close to 0 for all values; is this a volume issue? However, sound recorder picks up sound from my mic without issue.

image

The example data being picked up and fed to the detector via https://github.com/Asvarox/allkaraoke/blob/fc977a38ae7f36f6863ab7371a67c37b8d8f8a01/src/modules/GameEngine/Input/MicStrategies/Aubio.ts#L18-L20

data.txt

This is on windows, with a USB mic, on Chrome 126.0.6478.182 in incognito mode

JacekLach commented 3 months ago

happy to contribute a fix here but I'd need some advice on how to debug the issue

Asvarox commented 3 months ago

Hey, thanks for the report :) I won't be able to work on the project much for the next couple weeks so I would appreciate the help even more.

Just to make sure, does the volume indicator change similarly to what's on this video? https://github.com/user-attachments/assets/99bfd35a-1848-4965-ab29-bfc19f27d8f5

To try to pinpoint the issue, you can try setting noiseSuppression, autoGainControl options (true/false) or force enable/disable echoCancellation in the getUserMedia call https://github.com/Asvarox/allkaraoke/blob/fc977a38ae7f36f6863ab7371a67c37b8d8f8a01/src/modules/GameEngine/Input/MicInput.tsx#L24C1-L27C11 and see if that changes anything. Additionally, try using your browser as a remote microphone, so open the game in a regular tab, select "use smartphones" and open the link visible there in an icognito tab - for remote mics, it assumes only one channel in the input. Finally, in https://github.com/Asvarox/allkaraoke/blob/fc977a38ae7f36f6863ab7371a67c37b8d8f8a01/src/modules/GameEngine/Input/MicStrategies/Aubio.ts#L11C1-L11C37 you can play with the value.

Let me know if you're able to check these and if they yield any results,

JacekLach commented 3 months ago

yeah, that video looks correct.

I'll play around with it, thanks. In the meantime, I tested the same mic on a macbook, and everything's picked up nicely; so I suspect it's something to do with how the mic seems to be very quiet specifically on windows 11, and needs a lot of gain applied.