<!--
{
  "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:format:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioEngine(im)connect:to:format:"
  },
  "title" : "connect(_:to:format:)"
}
-->

# connect(_:to:format:)

Establishes a connection between two nodes.

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

This method calls [`connect(_:to:fromBus:toBus:format:)`](/documentation/AVFAudio/AVAudioEngine/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`](/documentation/AVFAudio/AVAudioMixerNode/nextAvailableInputBus).

---

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)