我正在尝试在项目中使用AKAmplitudeEnvelope,它给出了零ADSR整形。我编写了简单的代码来检查这一点-同样的结果:
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()
}
}因此,当我按下按钮(“startPressed”功能)时,-just振荡器开始永久响起,没有任何ADSR振幅形成
发布于 2020-11-27 05:16:48
看起来您仍然在使用AudioKit v4,但是对于v5,有一本充满示例的食谱,其中之一就是ADSR。https://github.com/AudioKit/Cookbook/
https://stackoverflow.com/questions/65029235
复制相似问题