AVAudioEngine for connectionless ‘tapping’ from within own app

For reasons too convoluted to go into, I have the need to ‘tap’ the final audio going to the output device (speaker, headphones, etc) from within the app I’m working on. (just need to grab my own audio)

It would be really important to not know any structures in the app, and tie into them.

It seems like AVAudioEngine / installTapOnBus is the way to go, but it’s unclear what exactly would be the input-

I have implemented all of the AVAudioBufferList -> CMSampleBufferRef code through to the expected output, and all I get is silence.

It seemed like just attaching to the mainMixerNode should have done it, but now it seems like a “device” input would be necessary.

So the questions are:

  • Is AVAudioEngine the SDK for this task?
  • If not, then what?
  • If yes, then what AVAudioNode would serve as an input?
  • Is there an AVAudioUnit that is just the ‘current device output’?

I’m not looking for a complete solution, just the last few lines that can complete this connection, or a pointer to the framework that could accomplish this.

I'd be interested in an answer as well. In my application I have multiple AVPlayers (some with video, some audio only) that are playing simultaneously. I would like to tap into the final mixed output that is going to speakers, so that I can send it to my streaming backend. For various technical reasons I to stay with the high-level AVPlayers.

What is the recommended framework/technology for achieving this? AVAudioEngine look promising, but so far I have not found any way to attach a high-level AVPlayer to the lower-level AVAudioEngine. Are these two incompatible, or did I just miss something?

I'm going to pursue AVAudioUnit - possibly search for the "current audio output" unit, and use that as the AVAudioEngine input node.

if that doesn't work, perhaps Voodoo

AVAudioEngine for connectionless ‘tapping’ from within own app
 
 
Q