<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PHASE",
  "identifier" : "/documentation/PHASE/PHASEDucker",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "PHASE"
    ],
    "preciseIdentifier" : "c:objc(cs)PHASEDucker"
  },
  "title" : "PHASEDucker"
}
-->

# PHASEDucker

An object that manages competing sounds.

```
class PHASEDucker
```

## Overview

When a sound plays in any of the source groups, this class lowers the volume of all the target groups so the listener hears the source sound more clearly. You set the source and target using [`PHASEGroup`](/documentation/PHASE/PHASEGroup) objects; see [`sourceGroups`](/documentation/PHASE/PHASEDucker/sourceGroups) and [`targetGroups`](/documentation/PHASE/PHASEDucker/targetGroups).

### Lower Background Music During a Monologue

When an app plays a monologue, the background music may need to lower, or *duck*, to enhance the clarity of the vocals. The following code demonstrates a ducker that configures a group for background music, and another group for the vocals.

```objc
PHASEGroup* bgmGroup = [[PHASEGroup alloc] 
    initWithEngine:_objects->mEngine uid:@"backgroundMusicGroup"];
PHASEGroup* voGroup = [[PHASEGroup alloc] 
    initWithEngine:_objects->mEngine uid:@"voiceOverGroup"];

auto ducker = [[PHASEDucker alloc] 
    initWithEngine:_objects->mEngine
        sourceGroups:[NSSet setWithObject:voGroup]
        targetGroups:[NSSet setWithObject:bgmGroup]
        gain:0.25
        attackTime:0.25
        releaseTime:0.5
        attackCurve:PHASECurveTypeLinear
        releaseCurve:PHASECurveTypeLinear];

[ducker activate];
```

When an app sets up the ducking configuration in advance, PHASE automatically lowers the background music at runtime when the vocals play.

## Topics

### Creating a Ducker

[`-  initWithEngine:sourceGroups:targetGroups:gain:attackTime:releaseTime:attackCurve:releaseCurve:`](/documentation/PHASE/PHASEDucker/init(engine:sourceGroups:targetGroups:gain:attackTime:releaseTime:attackCurve:releaseCurve:))

Creates an object that manages competing sounds.

### Specifying Sounds

[`sourceGroups`](/documentation/PHASE/PHASEDucker/sourceGroups)

The sounds that determine volume reduction.

[`targetGroups`](/documentation/PHASE/PHASEDucker/targetGroups)

The sounds that reduce in volume.

### Configuring Volume Reduction

[`gain`](/documentation/PHASE/PHASEDucker/gain)

The amount of volume reduction.

[`identifier`](/documentation/PHASE/PHASEDucker/identifier)

A unique value for the ducker.

[`active`](/documentation/PHASE/PHASEDucker/isActive)

A Boolean value that determines whether the ducker reduces sound.

[`attackTime`](/documentation/PHASE/PHASEDucker/attackTime)

The amount of time for sound reduction to reach maximum strength.

[`attackCurve`](/documentation/PHASE/PHASEDucker/attackCurve)

A mathematical curve that shapes transition progress as sound reduction begins.

[`releaseTime`](/documentation/PHASE/PHASEDucker/releaseTime)

The amount of time to transition from maximum sound reduction to no reduction.

[`releaseCurve`](/documentation/PHASE/PHASEDucker/releaseCurve)

A mathematical curve that shapes transition progress as sound reduction ends.

### Altering Sound

[`-  activate`](/documentation/PHASE/PHASEDucker/activate())

Instructs the ducker to begin altering sound.

[`-  deactivate`](/documentation/PHASE/PHASEDucker/deactivate())

Stops the ducker from altering sound.

## Relationships

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

---

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)