2

我似乎无法让 AudioKit 乐器按照我想要的方式运行:我希望能够连续改变频率,并且让乐器可以无限播放时间,就像振荡器一样。但是,我什至无法获得像下面这样的简单游乐场来输出任何声音:

//: ## Flute
//: Physical model of a Flute
import AudioKitPlaygrounds
import AudioKit

let playRate = 2.0

let flute = AKFlute()

let reverb = AKReverb(flute)

var triggered = false
let performance = AKPeriodicFunction(frequency: playRate) {
    if !triggered {
        flute.frequency = 240.0
        flute.amplitude = 0.6
        flute.play()

        triggered = true
    }
}

AudioKit.output = reverb
try AudioKit.start(withPeriodicFunctions: performance)
performance.start()

import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true

我想要的行为是能够随时设置频率并让音符永远响起。这可能吗?

4

1 回答 1

0

将 flute.play() 更改为 flute.trigger()

于 2019-08-27T21:02:47.483 回答