'How to ramp PlaygroundOscillator to value with AudioKit in Swift?

Is there a way to change the value (frequency, volume etc.) of an PlaygroundOscillator over time in AudioKit?

I have this code and would like to ramp the volume to 0 at the end, so that there is no click sound when the oscillator is stopped.

var audioEngine = AudioEngine()
var osc = PlaygroundOscillator()                        
audioEngine.output = osc
do {
    try audioEngine.start()
} catch {
    print("could not start audio engine")
}
osc.play()
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
    osc.stop()
}

I would like to do the same as in this question, but I couldn't find the Oscillator() class anymore, so I'm assuming it is deprecated.

Issue with AudioKit v5 oscillator frequency ramp



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source