Search Unity

Question Detect notes playing with microphone

Discussion in 'Audio & Video' started by yohanscritch, Jan 21, 2021.

  1. yohanscritch

    yohanscritch

    Joined:
    Apr 30, 2020
    Posts:
    28
    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#?
     
  2. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    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.