如何在不更改音高的情况下更改AKAudioPlayer(或AKPlayer)的速率? 我现在正在使用AKVariSpeed节点,但它也会改变播放器的音高 我可以以某种方式更改玩家的速率吗? 例如,当我使用AVAudioPlayer时,我可以简单地通过更改.rate属性来更改速率,可能是AKAudioPlayer吗?
// Works without changing pitch
let avPlayer = try! AVAudioPlayer(contentsOf: url)
avPlayer.enableRate = true
avPlayer.rate = 2
avPlayer.play()
// Also changes pitch
let akPlayer = try! AKAudioPlayer(file: file)
let variSpeed = AKVariSpeed(akPlayer, rate: 1)
AudioKit.output = variSpeed
try! AudioKit.start()
akPlayer.play()
variSpeed.rate = 2