AVAudioConnectionPoint creates gaps when writing to file

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?

On first read I would have said look at your format sample rates but we did a quick test and it looks like there might be an issue in AVAudioEngine with the setup you've described.


Can you file a bug report, include your test case and system information so we can take a closer look.

Sure, I'll file a bug report. Should I include any code, or will it be enough to describe my AVAudioEngine graph and setup?

A simple test case is always appreciated and you can include the forum link as well. Post the number here when it's submitted so we can have a look. Thanks!

25268054

Any news on this? I think i've got the same problem.


Could you let me know if this bug is fixed?

By the looks of it it's still being analyzed, however a couple of things you could do would be really helpful:


1) Make sure it still replicates on iOS 9.3.2 beta 4 and if so add that comment to the bug.


2) I noticed there was no test case with the report - can you please attach a test case to the bug that replicates the issue. It doesn't need to be a complex project at all -- but something we can built which will yield the output file with the audio gaps as described. Repro. projects are always the best.

AVAudioConnectionPoint creates gaps when writing to file
 
 
Q