AudioKit (iOS) - Add observer for frequency / amplitude change

后端 未结 1 1014
离开以前
离开以前 2020-12-18 10:29

I\'m using the AudioKit framework for developing a small application that is able to listen for the microphone input frequency & amplitude and I want to trigger an event

1条回答
  •  眼角桃花
    2020-12-18 10:37

    Instead of using a timer, you should let the DSP check for your conditions for you. To do this you'll have to edit the frequency tracker or create your own copy. The good news is that AudioKit's amplitude tracker already does something like this, calling a function whenever a certain volume is heard ie. an amplitude threshold is reached:

    https://github.com/AudioKit/AudioKit/blob/master/AudioKit/Common/Nodes/Analysis/Amplitude%20Tracker/AKAmplitudeTrackerDSPKernel.hpp#L97

    If you do it in a general way, you could even make a pull request and commit the code back to AudioKit. In fact, if you want to do that, I can help steer you in the right direction further. But, I think you can get pretty far using the amplitude tracker as a template.

    0 讨论(0)
提交回复
热议问题