Im trying to use AKAmplitudeEnvelope in the project, and it gives zero ADSR shaping. I wrote simple code to check this - the same result:
import Foundation
import AudioKit
class ViewController: UIViewController {
lazy var osc = AKOscillator(waveform: AKTable(.sine), frequency: 150, amplitude: 1)
lazy var envelope = AKAmplitudeEnvelope(osc)
override func viewDidLoad() {
super.viewDidLoad()
envelope.attackDuration = 0.01
envelope.decayDuration = 0.2
envelope.sustainLevel = 0.5
envelope.releaseDuration = 0.5
AudioKit.output = envelope
do {
try AudioKit.start()
} catch {
print(error)
}
osc.start()
}
@IBAction func startPressed(_ sender: UIButton) { //pressing the button
envelope.stop()
envelope.start()
}
}
So, when I press the button("startPressed" function) -just oscillator starting to sound permanently, without any ADSR amplitude forming