AVAudioRecorderMBS class

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

AVAudioRecorderMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
An instance of the AVAudioRecorder class, called an audio recorder, provides audio recording capability in your application.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.caf")
dim recordSetting as new Dictionary

dim n as Integer = OSTypeFromStringMBS(AVFoundationMBS.kAudioFormatLinearPCM)
recordSetting.Value(AVFoundationMBS.AVFormatIDKey) = n
recordSetting.Value(AVFoundationMBS.AVSampleRateKey) = 44100.0
recordSetting.Value(AVFoundationMBS.AVNumberOfChannelsKey) = 2
recordSetting.Value(AVFoundationMBS.AVLinearPCMBitDepthKey) = 16
recordSetting.Value(AVFoundationMBS.AVLinearPCMIsBigEndianKey) = false
recordSetting.Value(AVFoundationMBS.AVLinearPCMIsFloatKey) = false


dim error as NSErrorMBS
dim recorder as new AVAudioRecorderMBS(f, recordSetting, error)

if error<>Nil then
MsgBox error.LocalizedDescription
Return
end if

if recorder.recordForDuration(10) then
// ok
else
MsgBox "Failed to start recording."
end if

Using an audio recorder you can:


In OS X, the audio comes from the system's default audio input device as set by a user in System Preferences.

You can implement a subclass of AVFoundationMBS 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.

To configure an appropriate audio session for recording, refer to AVAudioSession Class Reference and AVAudioSessionDelegate Protocol Reference.

The AVAudioRecorder 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 OS X include AVCaptureAudioDataOutput and the Audio Queue services described in the Audio Queue Services Programming Guide.

In OS X, you can also use the AVCaptureAudioFileOutput class to record audio.
Available in OS X v10.7 and later.

Calls audioRecorderEncodeErrorDidOccur and audioRecorderDidFinishRecording events on AVFoundationMBS class.

This class has no sub classes.

Some events using this class:

Some examples using this class:


The items on this page are in the following plugins: MBS AVFoundation Plugin.


AVAudioPlayerNodeMBS   -   AVAudioTimeMBS


💬 Ask a question or report a problem