作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在项目中使用 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/
我试图在项目中使用 AKAmplitudeEnvelope,它给出了零 ADSR 整形。我写了简单的代码来检查这一点 - 相同的结果: import Foundation import AudioKi
我是一名优秀的程序员,十分优秀!