5

As in topic subject, I want to analyze buffer of the output signal. I've used this function ( InstallTapOnBus ) for microphone signal, but i does not work for output. Anyone know how do that?

    let bus = 0 
    let node = engine.outputNode
    node.installTap(onBus: bus, bufferSize: AVAudioFrameCount(BUFFER_SIZE), format: node.outputFormat(forBus: bus), block: { (buffer : AVAudioPCMBuffer ,time : AVAudioTime) in

        ...

    })
    try! engine.start()
}

It provides me an error : "required condition is false: _isInput"

Szymon Mrozek
  • 117
  • 1
  • 6

2 Answers2

2

Have you tried tapping the mixer instead of the microphone directly?

Microphone-to-mixer-to-output with Mixer Tap

Chris
  • 2,739
  • 4
  • 29
  • 57
2

Try mainMixerNode instead of outputNode.

This worked for me (iOS 12):

let outputNode = self.audioEngine.mainMixerNode let format = self.audioEngine.mainMixerNode.outputFormat(forBus: 0)

Then installTap on mainMixerNode like you did.

Nick
  • 1,248
  • 12
  • 18