An instance of the
AVAudio class, called an audio recorder, provides audio recording capability in your application.
- iOS 3.0+
- macOS 10.7+
- watchOS 4.0+Beta
Using an audio recorder you can:
Record until the user stops the recording
Record for a specified duration
Pause and resume a recording
Obtain input audio-level data that you can use to provide level metering
In iOS, the audio being recorded comes from the device connected by the user—built-in microphone or headset microphone, for example. In macOS, the audio comes from the system’s default audio input device as set by a user in System Preferences.
You can implement a delegate object for an audio recorder to respond to audio interruptions and audio decoding errors, and to the completion of a recording.
To configure a recording, including options such as bit depth, bit rate, and sample rate conversion quality, configure the audio recorder’s
settings dictionary. Use the settings keys described in AV Foundation Audio Settings Constants.
AVAudio class is intended to allow you to make audio recordings with very little programming overhead. Other classes that can be used for recording audio in iOS and macOS include
AVCapture and the Audio Queue services described in the Audio Queue Services Programming Guide.
In macOS, you can also use the
AVCapture class to record audio.