---
title: "prepareAudio(_:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/audio/prepareaudio(_:)"
---

# prepareAudio(_:)

Prepares multiple audio resources for synchronized playback without starting them.

## Declaration

```swift
@MainActor static func prepareAudio(_ resourcesAndEntities: [(AudioResource, Entity)]) throws -> AudioPlaybackGroupController
```

## Parameters

- `resourcesAndEntities`: An array of tuples pairing each audio resource with the entity that emits it. The same entity may appear multiple times with different resources, and a single entity can participate in multiple groups.

## Return Value

Return Value A controller that coordinates playback of the synchronized group.

## Discussion

Discussion Use this method to set up a group of audio sources that you want to play together. Each resource is paired with the entity that emits it. Call play() or play(at:) to begin playback. note: An error if audio preparation fails.

## See Also

### Playing audio resources

- [playAudio(_:)](realitykit/audio/playaudio(_:).md)
- [playAudio(_:at:)](realitykit/audio/playaudio(_:at:).md)
