Reputation: 181
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
Reputation: 8991
You can use AVCaptureSession:
AVCaptureDeviceInput
;AVCaptureAudioDataOutput
, setting the sample buffer delegateOnce 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