---
title: "fade(to:duration:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/audioplaybackcontroller/fade(to:duration:)"
---

# fade(to:duration:)

Transitions the gain to the given value over a time interval using a linear curve.

## Declaration

```swift
@MainActor @preconcurrency func fade(to newValue: AudioPlaybackController.Decibel, duration: TimeInterval)
```

## Parameters

- `newValue`: The target decibel level.
- `duration`: How long in seconds the fade should last.

## Discussion

Discussion The target gain must be zero or negative, where zero is nominal loudness and negative infinity is silent. If the gain is positive, it will be reset to zero.

## See Also

### Setting the volume

- [gain](realitykit/audioplaybackcontroller/gain.md)
