Detect notes playing with microphone

Hi there,

I’m making a piano-style game with unity where player can play notes and game would recognize the notes that are played. I successfully implemented the pitch-recognizing pattern but now I’m struggling detecting when the player plays a different note.

Here is how my input sound looks like:

You can hear it there : Notes.mp3

I guess I have to detects each “peak”, i.e when there’s a difference in terms of dB through time and detect the start of each “mountain” that we see on the Audacity diagram.

I’m not so much into math and I guess there are some tools that can help easily achieve that.

Would you have any thought or code samples in Unity/c#?

I guess you can explore envelope follower algorithms that will help you identify peaks, or you do that analysis in the frequency domain and identify different root tones.