I've been unable to find any examples that walk one through how to export audio that you have piped through AudioKit's 5 filters.
I want to add some effect to the audio (like reverb..etc) then export filtered audio
here my try:
// load empty file to write
let docs = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let dstURL:URL = docs.appendingPathComponent("rendred.caf")
var audioFile:AVAudioFile!
do {
audioFile = try AVAudioFile(forReading: dstURL)
} catch {
Log("Could not load file")
}
// duration of audio after add some effects
let duration = self.conductor.player.duration
let rendredTime = Double(duration)
// using AudioEngine() to export mixed audio but it's not work <----
do {
try? self.conductor.engine.renderToFile(audioFile, duration: rendredTime, prerender: {
self.conductor.player.play()
})
}
I'm not sure how renderToFile() function work