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

# connect(_:to:format:)

Establishes a connection between two nodes.

## Declaration

```swift
func connect(_ node1: AVAudioNode, to node2: AVAudioNode, format: AVAudioFormat?)
```

## Parameters

- `node1`: The source audio node.
- `node2`: 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 This method calls connect(_:to:fromBus:toBus:format:) using bus 0 for the source audio node, and bus 0 for the destination audio node, except when a destination is a mixer, in which case, the destination is the mixer’s nextAvailableInputBus.

## 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:fromBus:toBus:format:)](avfaudio/avaudioengine/connect(_:to:frombus:tobus: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)
