gpt4 book ai didi

ios - 使用 AudioEngine 的音效

转载 作者:IT王子 更新时间:2023-10-29 05:10:16 37 4
gpt4 key购买 nike

背景 - 我在 Apple 最近的 WWDC 上发布的以下视频列表中看到了一个名为“AVAudioEngine in Practice”的视频,用于将音效应用于音频。 https://developer.apple.com/videos/wwdc/2014/

之后,我成功地使用以下代码改变了音频的音调:

 //Audio Engine is initialized in viewDidLoad()
audioEngine = AVAudioEngine()
//The following Action is called on clicking a button
@IBAction func chipmunkPlayback(sender: UIButton) {
var pitchPlayer = AVAudioPlayerNode()
var timePitch = AVAudioUnitTimePitch()
timePitch.pitch = 1000

audioEngine.attachNode(pitchPlayer)
audioEngine.attachNode(timePitch)

audioEngine.connect(pitchPlayer, to: timePitch, format: myAudioFile.processingFormat)
audioEngine.connect(timePitch, to: audioEngine.outputNode, format: myAudioFile.processingFormat)

pitchPlayer.scheduleFile(myAudioFile, atTime: nil, completionHandler: nil)
audioEngine.startAndReturnError(&er)

pitchPlayer.play()

}

据我所知,我使用 AudioEngine 将 AudioPlayerNode 与 AudioEffect 关联起来,我又将 AudioEffect 关联到 Output。

我现在对在音频中添加多种音效感到好奇。例如,音高变化和混响。我将如何为音频添加多种音效?

此外,在 viewDidLoad 中附加和连接节点是否有意义,而不是我在 IBAction 中如何完成?

最佳答案

只需连接它们即可。

engine.connect(playerNode, to: reverbNode, format: format)
engine.connect(reverbNode, to: distortionNode, format: format)
engine.connect(distortionNode, to: delayNode, format: format)
engine.connect(delayNode, to: mixer, format: format)

关于ios - 使用 AudioEngine 的音效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25333140/

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