<!--
{
  "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/PHASEMixerDefinition",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "PHASE"
    ],
    "preciseIdentifier" : "c:objc(cs)PHASEMixerDefinition"
  },
  "title" : "PHASEMixerDefinition"
}
-->

# PHASEMixerDefinition

An object to initialize a mixer with a given configuration.

```
class PHASEMixerDefinition
```

## Overview

A mixer combines multiple layers of audio to a single signal for transmission to the output device. The framework creates a mixer when you provide a mixer definition. Instead of creating an instance of this class, instantiate one of the mixer definition subclasses instead:

- [`PHASEChannelMixerDefinition`](/documentation/PHASE/PHASEChannelMixerDefinition): When your app outputs sound through a channel mixer, the framework maintains the channel configuration of the source audio. For example, the left and right channels of a stereo input file play on the left and right speakers, respectively.
- [`PHASEAmbientMixerDefinition`](/documentation/PHASE/PHASEAmbientMixerDefinition): When your app outputs sound through an ambient mixer, the framework overrides the output channels to give the mixer an orientation, which creates the effect of pointing in a specific direction in 3D space.
- [`PHASESpatialMixerDefinition`](/documentation/PHASE/PHASESpatialMixerDefinition): Audio that your app outputs through a spatial mixer specifies a position and orientation in 3D space. Spatial mixers require the app to define sources that emit audio, and a listener that hears audio. Sound playback changes depending on the relative positions of the listener and sources.

### Play a Sound Using a Mixer

To play a sound using a mixer, create a mixer definition and pass it to a sound event. The following code creates a [`PHASEChannelMixerDefinition`](/documentation/PHASE/PHASEChannelMixerDefinition) and passes it into a node definition the app can invoke to play the channel-based audio file `drumloopSoundAsset`:

```swift
// Create a channel mixer definition.
let stereoMixer = PHASEChannelMixerDefinition(channelLayout:stereoLayout!)

// Pass the mixer to a sound event node definition that plays an audio file.
let drumloopSamplerNode = PHASESamplerNodeDefinition(soundAssetIdentifier:drumloopSoundAsset.identifier, mixerDefinition:stereoMixer, identifier:"drumloopNode")
```

## Topics

### Controlling Volume

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

The mixer’s volume.

[`gainMetaParameterDefinition`](/documentation/PHASE/PHASEMixerDefinition/gainMetaParameterDefinition)

A template for a parameter that changes the mixer’s volume gradually over a period of time.

## Relationships

### Conforms To

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

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

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

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

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

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

### Inherited By

[`PHASESpatialMixerDefinition`](/documentation/PHASE/PHASESpatialMixerDefinition)

[`PHASEChannelMixerDefinition`](/documentation/PHASE/PHASEChannelMixerDefinition)

[`PHASEAmbientMixerDefinition`](/documentation/PHASE/PHASEAmbientMixerDefinition)

### Inherits From

[`PHASEDefinition`](/documentation/PHASE/PHASEDefinition)

---

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)