I’m attempting to get audio of microphone as a byte Array after which I wish to convert AVAudioPCMBuffer knowledge to audio and play it, convert AVAudioPCMBuffer knowledge to audio? and is that this greatest methodology to transform AVAudioPCMBuffer knowledge audio
let audioEngine = AVAudioEngine()
func getAudio() {
let inputNode = audioEngine.inputNode
var error: NSError?
let bus = 0
inputNode.installTap(onBus: bus, bufferSize: 2048, format: inputNode.inputFormat(forBus: bus)) {
(buffer: AVAudioPCMBuffer!, time: AVAudioTime!) -> Void in
print(buffer)
}
audioEngine.put together()
do {
strive audioEngine.begin()
} catch {
print("Cannot begin the engine: (error)")
}
}