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

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

## Declaration

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

## Parameters

- `node1`: The source node
- `node2`: The destination node
- `bus1`: The output bus on the source node
- `bus2`: The input bus on the destination node
- `format`: If non-nil, the format of the source node’s output bus is set to this format. In all cases, the format of the destination node’s input bus is set to match that of the source node’s output bus.

## Discussion

Discussion Establish a connection between two nodes. Nodes have input and output buses (AVAudioNodeBus). Use this method to establish one-to-one connections betweeen nodes. Connections made using this method are always one-to-one, never one-to-many or many-to-one. Note that any pre-existing connection(s) involving the source’s output bus or the destination’s input bus will be broken.

## See Also

### Connecting and Disconnecting Audio Nodes

- [connectNode(_:to:format:)](avfaudio/avaudioengine/connectnode(_:to:format:).md)
- [connectNode(_:to:fromBus:format:)](avfaudio/avaudioengine/connectnode(_:to:frombus:format:).md)
- [connect(_:to:format:)](avfaudio/avaudioengine/connect(_:to: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)
