AudioKit: Noise gate

2019-07-21 16:58发布

问题:

I'm trying to implement a simple noise gate if the amplitude is beyond a certain threshold using AudioKit.

I believe this should be simple and I just need to use the AKAmplitudeTracker and set the output to zero, but I can't work out how to do the latter part.

Source for AKAmplitudeTracker

回答1:

If I understand your question, you don't know how to set the output to zero. I'll go ahead and write the most obvious answer first, send the output through a booster,

...tracker stuff...
let booster = AKBooster(tracker, gain: 0)
AudioKit.output = booster

and then wherever you poll the tracker, set

if tracker.amplitude > threshold {
   booster.gain = 1
}

Mind you, this will be very primitive and you'll have a better noise gate doing things at the DSP level, but this may be good enough for a proof of concept or test.



标签: ios audiokit