<!--
{
  "availability" : [
    "iOS: 8.0.0 - 27.0.0",
    "iPadOS: 8.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.10.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 2.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioEngine/connect(_:to:fromBus:toBus:format:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioEngine(im)connect:to:fromBus:toBus:format:"
  },
  "title" : "connect(_:to:fromBus:toBus:format:)"
}
-->

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

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

```
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

Audio nodes have input and output busses ([`AVAudioNodeBus`](/documentation/AVFAudio/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)