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

# attach(_:)

Attaches an audio node to the audio engine.

## Declaration

```swift
func attach(_ node: AVAudioNode)
```

## Parameters

- `node`: The audio node to attach.

## Discussion

Discussion An instance of AVAudioNode isn’t usable until you attach it to the audio engine using this method. // Create a player node that's used for audio playback. let playerNode = AVAudioPlayerNode()

// Attach the player node to the engine. engine.attach(playerNode)

## See Also

### Attaching and Detaching Audio Nodes

- [detach(_:)](avfaudio/avaudioengine/detach(_:).md)
- [attachedNodes](avfaudio/avaudioengine/attachednodes.md)
