<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioEngine/connectNode(_: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:error:"
  },
  "title" : "connectNode(_:to:fromBus:toBus:format:)"
}
-->

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

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

\abstract 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.

---

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)