Instance Method


Installs an audio tap on the bus to record, monitor, and observe the output of the node.


func installTap(onBus bus: AVAudioNodeBus, bufferSize: AVAudioFrameCount, format: AVAudioFormat?, block tapBlock: @escaping AVAudioNodeTapBlock)



The node output bus to which to attach the tap.


The requested size of the incoming buffers. The implementation may choose another size.


If non-nil, attempts to apply this as the format of the specified output bus.

This should only be done when attaching to an output bus which is not connected to another node; an error will result otherwise. The tap and connection formats (if non-nil) on the specified bus should be identical. Otherwise, the latter operation will override any previously set format.

For AVAudioOutputNode, tap format must be specified as nil.


A block to be called with audio buffers. See AVAudioNodeTapBlock for the block parameters.


Only one tap may be installed on any bus. Taps may be safely installed and removed while the engine is running.

AVAudioEngine *engine = [[AVAudioEngine alloc] init];
AVAudioInputNode *input = [engine inputNode];
AVAudioFormat *format = [input outputFormatForBus: 0];
[input installTapOnBus: 0 bufferSize: 8192 format: format block: ^(AVAudioPCMBuffer *buf, AVAudioTime *when) {
// ‘buf' contains audio captured from input node at time 'when'
// start engine

See Also

Installing and Removing An Audio Tap

func removeTap(onBus: AVAudioNodeBus)

Removes an audio tap on a bus.