macOS Audio Recorder
This article applies to macOS only.
See also: Multiplatform Programming Guide
Overview
The Apple AVFoundation framework combines four major technology areas that together encompass a wide range of tasks for capturing, processing, synthesising, controlling, importing and exporting audiovisual media on Apple platforms. It is available from macOS 10.7 (Lion). The framework provides essential services for working with time-based audiovisual media.
- To play sound files, you can use AVAudioPlayer.
- To record audio, you can use AVAudioRecorder.
AVAudioRecorder
The AVAudioRecorder class is intended to allow you to make audio recordings straight to a file with very little programming overhead. Using 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 macOS, the audio comes from the system’s default audio input device as set by a user in System Preferences. To configure a recording, including options such as bit depth, bit rate, and sample rate conversion quality, configure the audio recorder’s settings dictionary.
Example Code
t/c