Equalization

How to apply equalization filtering to shape the response

This example demonstrates how to apply filtering and tonal enhancement to a signal using the EQ node. In this example, a low-pass filter is applied with adjustable parameters for frequency, gain, and resonance (Q) to shape the spectral response of the sound.

// 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 the EQ node with a lowpass filter
let destination = EQ(filter: .lowpass)
destination.q = 10.0
destination.frequency = 1000.0
destination.gain = 20.0
destination.detune = 0.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