I am looking to render audio waveform on screen like iOS voice memo app, so I am using AVAudioEngine and installed Tap on input node. But it gives fastest call back on 0.1sec frequency , I need to get buffer data on faster frequency , so that can draw more and more waveform on screen for smooth and realtime visualisation.
Could you please sugger better approach for it ?
let inputNode = self.audioEngine!.inputNode
let format = inputNode.inputFormat(forBus: 0)
inputNode.installTap(onBus: 0, bufferSize: 4096, format: format) { [self] (buffer, time) in
processAudioData(buffer: buffer)
DispatchQueue.main.async {
audioPlotView.setNeedsDisplay(). // Render waveform on screen
}
}