我一直在寻找Swift文档以保存AVAudioEngine的音频输出,但我找不到任何有用的提示.
有什么建议吗?
解决方案 我找到了解决方法,这要归功于matt的答案.这里有一个示例代码,说明如何在通过AVAudioEngine传递音频之后保存音频(我认为在技术上它是之前的)
newAudio = AVAudioFile(forWriting: newAudio.url, settings: nil, error: NSErrorPointer())
//Your new file on which you want to save some changed audio, and prepared to be bufferd in some new data...
var audioPlayerNode = AVAudioPlayerNode() //or your Time pitch unit if pitch changed
//Now install a Tap on the output bus to "record" the transformed file on a our newAudio file.
audioPlayerNode.installTapOnBus(0, bufferSize: (AVAudioFrameCount(audioPlayer.duration)), format: opffb){
(buffer: AVAudioPCMBuffer!, time: AVAudioTime!) in
if (self.newAudio.length) …
Run Code Online (Sandbox Code Playgroud)