gpt4 book ai didi

audiokit - AKAmplitudeEnvelope 不起作用,只是绕过信号

转载 作者:行者123 更新时间:2023-12-05 06:56:51 25 4
gpt4 key购买 nike

我试图在项目中使用 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”功能)时 - 振荡器开始持续发声,无任何ADSR振幅形成

最佳答案

看起来您仍在使用 AudioKit v4,但对于 v5,有一本充满示例的食谱,其中一个是 ADSR。 https://github.com/AudioKit/Cookbook/

关于audiokit - AKAmplitudeEnvelope 不起作用,只是绕过信号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65029235/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com