<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/AmbientAudioComponent",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation21AmbientAudioComponentV"
  },
  "title" : "AmbientAudioComponent"
}
-->

# AmbientAudioComponent

A component that configures the ambient rendering of sounds from an entity.

```
struct AmbientAudioComponent
```

## Overview

Ambient audio sources emit each channel of an audio resource from an angle projected from the entity, without reverberation. Ambient
audio sources take into account the relative orientation of the source and the listener. Position is not taken into account; the channels
do not get louder as the user moves toward them.

The audio resource’s front channels (e.g., mono, center) are projected into the entity’s -Z direction, with the rear channels projected
into +Z. The left channels are laid out in -X and the right channels are laid out in +X.

```swift
let entity = Entity()
let resource = try AudioFileResource.load(named: "MyAudioFile")
entity.ambientAudio = AmbientAudioComponent()
entity.playAudio(resource)
```

The `AmbientAudioComponent` allows you to set the overall level of all sounds played from the entity with the `gain` property,
in relative Decibels, in the range `-.infinity ... .zero` where `-infinity` is silent and `.zero` is nominal.

```swift
entity.ambientAudio?.gain = -10
```

Ambient audio sources are well suited to play back multichannel content which captures the acoustics of its originating environment in
the recording process (e.g., multichannel field recordings of outdoor environments).

---

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)