I'm using AVAudioEngine to record input from the microphone as well as various sound effects to a single file.
My AVAudioEngine graph looks like this:
soundfileNode ----> mainMixer ---> outputNode (speaker)
|
| (AVAudioConnectionPoint)
v
inputNode (mic) --> secondaryMixer ---> tap (write to file)
I'm splitting the output from my mainMixer using AVAudioConnectionPoints to make it output audio to a secondaryMixer and to the speaker. I'm doing this so that only the sound from the sound file nodes are played back through the speaker while recording, as I don't want the mic input to be heard during recording.
The error occurs when the output from the mainMixer is written to an audio file using a tap I have installed on the secondaryMixer. The recorded sound "stutters" - there is a very short silence - or gap - about 3 times every second, which probably occurs every time my tap closure is called. It's as if not the entire buffer is written to the output file. The sound from the mic is written to the file exactly as it should, with no gaps, so the problem seems to be the AVAudioConnectionPoint from the mainMixer to the secondaryMixer, which isn't in complete sync or drops parts of the buffer.
Has anyone else experienced this problem?