AVAudioEngine record ignoring device output

I am working app that records voice. Before recording, the app plays the beep sound, and this beep sound should not get into the final recording. I am recording audio through installTap method.
The initial thought was to ignore buffers while playing, but beep sound is very short and I believe both input and output has latency that makes it impossible (or hard) to make a prediction when beep sound will appear in the recording buffer.
Any help will be very appreciated, thanks!
to avoid misunderstanding -- the problem is that the beep is so loud it gets into the mic
AVAudioEngine record ignoring device output
 
 
Q