Search code examples
javascriptffteventtrigger

trigger event on sound input pitch frequency


I'm trying to trigger an event from sound input pitch, I have this code https://webaudiodemos.appspot.com/pitchdetect/index.html but I'm searching for an easier way to de that.

Please help me, thank's by advance.


Solution

  • For high frequencies, you can try using the Goertzel algorithm. Compare the energy output of a Goertzel filter with the total audio energy over the same time period, and see whether that meets some threshold or statistical decision criteria.

    For lower pitched frequencies, to solution may not be easier, but much harder, as you might need to use a pitch detection algorithm, which can be much more complicated that just detecting a pure frequency. This is because pitch is a psychoacoustic phenomena arising from complicated waveforms that are different from just a pure sinusoid wave frequency.