function y = HelperAudioToneRemovalProcessing(x,args,tuningUIStruct)
%HELPERAUDIOTONEREMOVALPROCESSING Main processing for audio tone removal.
%
% This function HelperAudioToneRemovalProcessing is only in support of 
% AudioInterferingToneRemovalExample. It may change in a future release.

% Copyright 2013-2016 The MathWorks, Inc.

Fs   = args.SampleRate;

persistent notch
if isempty(notch)  
    notch = dsp.NotchPeakFilter('SampleRate',Fs);
end

if tuningUIStruct.ValuesChanged
    params  = tuningUIStruct.TuningValues;
    notch.CenterFrequency = params(1);
    notch.Bandwidth       = params(2);        
end

u = randn(size(x,1),1);
y = notch([x,u]);