IOS audio development-'audiostreambasicdescription'
This class provides descriptions of audio files
An audio stream is a continuous series of data that represents a sound, such as a song.
A channel is a discrete track of monophonic audio. A monophonic stream has one channel; a stereo stream has two channels.
A sample is single numerical value for a single audio channel in an audio stream.
A frame is a collection of time-coincident samples. For instance, a linear PCM stereo sound file has two samples per frame, one for the left channel and one for the right channel.
A packet is a collection of one or more contiguous frames. A packet defines the smallest meaningful set of frames for a given audio data format, and is the smallest data unit for which time can be measured. In linear PCM audio, a packet holds a single frame. In compressed formats, it typically holds more; in some formats, the number of frames per packet varies.
The sample rate for a stream is the number of frames per second of uncompressed (or, for compressed formats, the equivalent in decompressed) audio.
First, audio files are generated by analog signals-> digital signals after PCM-> compressed and encoded audio files.
The sampling frequency of PCM is called sample rate.
Several sampling data can be obtained for each sampling, corresponding to multiple channels.
Several sampling data obtained from each sampling point are combined and called a frame.
The combination of several frames is called a packet.
mSampleRate
That is, the frequency of use
mBitsPerChannel
That is, the number of digits of each sampled data
mChannelsPerFrame
It can be understood as the number of channels, that is, several sampling data are generated at a sampling time.
mFramesPerPacket
The number of frames in each packet is equal to the number of sampling intervals in this packet.
mBytesPerPacket
The number of bytes of data in each packet.
mBytesPerFrame
, The number of bytes of data in each frame
Calculation Formula