Unity's Native Audio Plugin SDK Pitch Detection demo fails below below a certain frequency

Apologies if this is the wrong place to ask, I’m working on a game that requires detecting the pitch of the player’s voice using microphone input.

I began by searching for a way to detect this within Unity and stumbled on unity’s official Native Audio Plugin SDK which contains a demo for microphone pitch detection which seems to potentially work quite well for my needs, however it seems to fail for any note below C#3 ~140 Hz, at least using the default mixer parameters (my only change was reducing Threshold from 0.05->0.02%).

I’ve tried using all sorts of voice samples and tweaking the mixer parameters to try to address this issue but so far i’ve not been able to get around it, would really appreciate if anyone with more insight than me as to how this works could explain why this happens and whether it’s possible to work around?

for anyone else that might stumble on this i got around this by creating my own pitch detection algorithm based on the Yin FFT implemention here and passing it in the data from AudioSource.GetOutputData that i ran through this unity FFT implementation i found in this Answers post here and the result seems much more accurate in general, handles the low notes really well and seems to have pretty decent performance for something that’s not even using a native plugin or multithreading.

1 Like

Did you build your own plugin in C++ or did you convert it into a C# implementation?