user3117351
user3117351

Reputation: 181

Monitoring Audio Input on iPhone Without Recording it?

I am trying to write an app in Apple Swift that monitors audio from the microphone and displays the volume level on a VU meter style graph. I know how to do it using AVAudioRecorder, but I don't want to record and save the audio, I just want to monitor and observe the volume levels, as I will be monitoring the audio for multiple hours and saving this to the phone would take up tons of space.

Can anybody lead me in the right direction as to how I can do this? Thanks!

I do not have any code to show, as I a just looking for the right direction to go not debugging.

Upvotes: 3

Views: 2552

Answers (1)

Alex
Alex

Reputation: 8991

You can use AVCaptureSession:

  • add an input device (the microphone) using AVCaptureDeviceInput;
  • add an output AVCaptureAudioDataOutput, setting the sample buffer delegate

Once you start the session, the delegate will receive audio samples that you can process however you wish.

Don't forget to ask permission before using the AVCaptureDevice!

Upvotes: 2

Related Questions