HomeiOS Developmentios - convert AVAudioPCMBuffer knowledge to audio in AVAudioEngine()

ios – convert AVAudioPCMBuffer knowledge to audio in AVAudioEngine()


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)")
    }
    
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments