Alphabetical order.
Corresponds to how samples are structured in memory/disk. Examples include FLAC, MP3 and PCM.
Responsible for getting buffers from an Buffer Queue and supplying it to a registered callback.
Includes a segment of memory holding audio data and metadata about this segment.
Literally a queue (FIFO) of Buffers.
Analogous to channel in images (RGB), digital audio can have channels for the left and right speakers, while more advanced 5.1 surround-sound formats might have 6.
Analogous to a pixel in image. It contains the amplitudes of each Channel of a Sample.
Compressed formats might groups several Frames together in a packet. Different packets might have different number of frames.
For uncompressed formats it’s assume the number of frame per packet is 1.
At a high-level, sample corresponds to a discrete snapshot of a signal at a specific point in time. More concretely we can see it as the signal’s amplitude(s) + the timestamp.
Frequency in which Samples are obtained from analog signal (given in Hz).
It helps to be aware of code conventions, especially naming, since they provide hints about the functionality.
k.*
- indicates c(k)onstantsm.*
- indicates a member (e.g. from a struct)AudioStreamBasicDescription
(ASBD) - describes a format (e.g. MP3)Selected Fields:
mSelector: AudioObjectPropertySelector
- enum representing the type of property
kAudioHardwarePropertyDefaultInputDevice
: default input device, e.g. mickAudioDevicePropertyNominalSampleRate
: sample rate of the input deviceSee Audio Queue.
Selected Fields:
mFormatID: AudioFormatID
- enum representing the format
kAudioFormatMPEG4AAC
(aac)kAudioFormatMPEGLayer3
(.mp3)mChannelsPerFrame: int
- see ChannelmSampleRate: float
- see Sample RateExample 1: complete the information about an ASBD when the format is set
Deprecated in 10.5. See AudioObjectGetPropertyData
.
This is a generic getter for some specific property that is related to the hardware. We can think of this as calling the getter of a method from an object.
So if we have value = my_object.get_property()
, then inObjectID = my_object
, inAddress = get_property
, outData = value
.
Note we need to know the size of the property value upfront (ioDataSize
).
Example 1: Get a reference to the default input device object (microphone)
Example 2: Get the sample rate from a device object. deviceID
was populated from the call in Example 1.
We can pass a ASBD and this function will fill the structure with information that can only be known once the queue is created.
Creates a new audio queue for recording audio data. The inFormat
corresponds to the audio format which is going to be used.
The inCallbackProc
is the function which will be invoked when a audio is ready to be processed. inUserData
is a parameter we can send to our callback.
outAQ
is the reference to the queue, which will be initialized.