reverb
TypeScriptget reverb(): ReverbSwift declarationvar reverb: ReverbA reverberation setting the component applies to spatial audio.
struct · iOS 18.0+ · SDK 27.1
struct ReverbComponentA component that defines the reverberation of spatial audio sources. Bring your spatial audio to life by setting a reverb appropriate for your immersive environment. In visionOS, an acoustic simulation of a person's real environment reverberates the spatial audio sources by default. When presenting your content in <doc://com.apple.documentation/documentation/swiftui/immersionstyle/progressive> and <doc://com.apple.documentation/documentation/swiftui/immersionstyle/full> immersive spaces, consider setting a reverb component to make your spatial audio sound like it exists within the environment that your visuals represent. For example, a desert, living room, and concert hall each have unique acoustical characteristics. When the visuals and acoustic properties of sounds in your content are congruent, the environment becomes more effective as a whole. ```swift // Create an entity to hold the reverb component and // use the concert hall preset. let reverbEntity = Entity() reverbEntity.components.set(ReverbComponent(reverb: .preset(.concertHall))) // Add the reverb entity to the reality view. content.add(reverbEntity) // Load an audio file of a violin. if let violin = try? await AudioFileResource(named: "violin") { // Create an entity for playing the violin audio and // set the spatial audio component. let violinEntity = Entity() violinEntity.components.set( SpatialAudioComponent( directivity: .beam(focus: 0.2) ) ) violinEntity.playAudio(violin) // Add the violin entity to the reality view. content.add(violinEntity) } ``` Use the ``SpatialAudioComponent/reverbLevel`` property to adjust the level of audio you send to the spatial modeler. Use the ``SpatialAudioComponent/directLevel`` property to adjust the level of audio you send directly to a person's ears, without additional reverberation. Use the ``SpatialAudioComponent/directivity`` property to define the pattern that disperses sound into the acoustic environment. In macOS and iOS, only one `ReverbComponent` can be active at a time per ``ARView`` or ``RealityView``. In visionOS, a `ReverbComponent` is only active while an app has a <doc://com.apple.documentation/documentation/swiftui/immersionstyle/progressive> or <doc://com.apple.documentation/documentation/swiftui/immersionstyle/full> immersive space open. You can place multiple simulated reverb components in a scene — for example, one entity each for the ceiling, floor, and walls of a virtual room — and the reflections and reverb update as audio sources move through the space. However, only one preset reverb can be active at a time; if both a preset and simulated reverb are present, the preset takes priority. When the content is within a <doc://com.apple.documentation/documentation/swiftui/immersionstyle/progressive> immersive space, the Digital Crown adjusts how RealityKit blends: - The acoustics simulation of a person's real-world environment - The reverberation the `ReverbComponent` generates When your app is in a Shared Space <doc://com.apple.documentation/documentation/swiftui/windowgroup> or an <doc://com.apple.documentation/documentation/swiftui/immersivespace> using a <doc://com.apple.documentation/documentation/swiftui/immersionstyle/mixed> style, RealityKit reverberates the spatial audio from the acoustics simulation and ignores the reverberation from the `ReverbComponent`.
get reverb(): ReverbSwift declarationvar reverb: ReverbA reverberation setting the component applies to spatial audio.
set reverb(value: Reverb)Swift declarationvar reverb: ReverbA reverberation setting the component applies to spatial audio.
static init(reverb: Reverb): ReverbComponentSwift declarationinit(reverb: Reverb)Creates a component from a reverberation setting. - Parameter reverb: A setting the component uses to reverberate spatial audio.
No declarations were skipped in this snapshot.