Limiter (Peak)

How to apply Peak control with pre/post level configuration

This example demonstrates how to apply signal limiting using the Limiter node to restrict amplitude peaks and protect the output from clipping. The limiter acts as the final stage in dynamic processing, keeping the signal within a safe margin.

// Configure the graph for rendering
let context = Assembler(rendering: .live).createAudioGraph()

// Configure an audio source (Renderer) from a local audio file
let url = URL(fileURLWithPath: "/path/to/source.mp3")
let source = MediaRenderer(contentsOf: url)

// Configure a limiter and its dynamic parameters
let destination = Limiter()
destination.preGain = 1.0
destination.outputGain = 2.0

// Configure node connections
try context.connect(source: source, to: destination)
try context.connect(source: destination, to: context.destination)
source.play(after: 0)

The following video shows the sample code in action and its real-time processing.

circle-info

For a complete description of each class, method, and property referenced in this section, refer to the official API documentationarrow-up-right, where you will find detailed references, available components, parameters, and additional usage code examples.

Last updated