I want to play sound directly from a microphone in iOS using Swift. For this I use AVCaptureSession. Install my input device, output and delegate. Delegate method: captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!) active.
But how can I get sound from samplebuffer and play with AVAudioPlayer?
Maybe there is a much easier way to solve my problem?
I do not want to record audio! "Only" capture and playback through speakers.
source share