My requirement is that, when you start recording using screencapturekit framework, I want to perform some modifications on the audio being played and then play the modified audio(say apply pitch effect). On stop recording, the audio process must also stop so that the audio must be heard with original sound.
func stream(_ stream: SCStream, didOutputSampleBuffer sampleBuffer: CMSampleBuffer, of outputType: SCStreamOutputType) {
guard sampleBuffer.isValid else { return }
switch outputType {
case .screen:
case .audio:
guard let samples = createPCMBuffer(for: sampleBuffer) else { return }
movie?.playerNode?.scheduleBuffer(samples)
}
This is the code I tried with where I get screen contents and audio separately and then pass the audio to AVAudioEngine for processing, but it doesn't work