---
title: "connect(_:to:fromBus:toBus:format:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avaudioengine/connect(_:to:frombus:tobus:format:)"
---

# connect(_:to:fromBus:toBus:format:)

Establishes a connection between two nodes, specifying the input and output busses.

## Declaration

```swift
func connect(_ node1: AVAudioNode, to node2: AVAudioNode, fromBus bus1: AVAudioNodeBus, toBus bus2: AVAudioNodeBus, format: AVAudioFormat?)
```

## Parameters

- `node1`: The source audio node.
- `node2`: The destination audio node.
- `bus1`: The output bus of the source audio node.
- `bus2`: The input bus of the destination audio node.
- `format`: If not NULL, the engine uses this value for the format of the source audio node’s output bus. In all cases, the engine matches the format of the destination audio node’s input bus to the source audio node’s output bus.

## Discussion

Discussion Audio nodes have input and output busses (AVAudioNodeBus). Use this method to establish connections between audio nodes. Connections are always one-to-one, never one-to-many or many-to-one. note: This breaks any preexisting connections that involve the source’s output bus or the destination’s input bus.

## See Also

### Connecting and Disconnecting Audio Nodes

- [connectNode(_:to:format:)](avfaudio/avaudioengine/connectnode(_:to:format:).md)
- [connectNode(_:to:fromBus:toBus:format:)](avfaudio/avaudioengine/connectnode(_:to:frombus:tobus:format:).md)
- [connectNode(_:to:fromBus:format:)](avfaudio/avaudioengine/connectnode(_:to:frombus:format:).md)
- [connect(_:to:format:)](avfaudio/avaudioengine/connect(_:to:format:).md)
- [disconnectNodeInput(_:)](avfaudio/avaudioengine/disconnectnodeinput(_:).md)
- [disconnectNodeInput(_:bus:)](avfaudio/avaudioengine/disconnectnodeinput(_:bus:).md)
- [disconnectNodeOutput(_:)](avfaudio/avaudioengine/disconnectnodeoutput(_:).md)
- [disconnectNodeOutput(_:bus:)](avfaudio/avaudioengine/disconnectnodeoutput(_:bus:).md)
