Oscillator

Continuous sine-wave synthesis routed to the main destination

This example demonstrates how to synthesize a pure tone using an oscillator. The Oscillator node generates a continuous sine waveform that is routed directly to the main destination of the audio context. This flow represents the simplest structure of synthesis.

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

// Configure a sine-wave audio source (Oscillator)
let source = Oscillator()
source.waveform = .sine

// Configure node connections
try context.connect(source: source, to: context.destination)
oscillator.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