---
title: "installTap(onBus:bufferSize:format:block:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avaudionode/installtap(onbus:buffersize:format:block:)"
---

# installTap(onBus:bufferSize:format:block:)

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

## Declaration

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

## Parameters

- `bus`: The output bus to attach the tap to.
- `bufferSize`: The size of the incoming buffers. The implementation may choose another size.
- `format`: If non-nil, the framework applies this format to the output bus you specify. An error occurs when attaching to an output bus that’s already in a connected state. The tap and connection formats (if non-nil) on the bus need to be identical. Otherwise, the latter operation overrides the previous format. For AVAudioOutputNode, you must specify the tap format as nil.
- `tapBlock`: A block the framework calls with audio buffers.

## Discussion

Discussion You can install and remove taps while the engine is in a running state. You can install only one tap on any bus. 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 captured audio from the node at time 'when' }]; .... // start engine important: The framework may invoke the tapBlock on a thread other than the main thread.

## See Also

### Installing and Removing an Audio Tap

- [installAudioTap(onBus:bufferSize:format:tapProvider:)](avfaudio/avaudionode/installaudiotap(onbus:buffersize:format:tapprovider:).md)
- [removeTap(onBus:)](avfaudio/avaudionode/removetap(onbus:).md)
- [AVAudioNodeTapBlock](avfaudio/avaudionodetapblock.md)
