Audio frame sample type in PCM?

291 Views Asked by At

So I'm taking CMSampleBufferRef buffers with audio content.

AudioStreamBasicDescription is as follows

 {
        mSampleRate: 44100.000000 
        mFormatID: 'lpcm' 
        mFormatFlags: 0xe 
        mBytesPerPacket: 4 
        mFramesPerPacket: 1 
        mBytesPerFrame: 4 
        mChannelsPerFrame: 2 
        mBitsPerChannel: 16     
 } 

Apparently a it's an interleaved video with 2 bytes per channel = sample size. What is the encoding of this sample size? Is that a (short) int? Is a frame consisting of 2 shorts? Or one int? or one float? How do I know this?

I guess it's 32bpp interleaved audio, correct?

1

There are 1 best solutions below

0
sbooth On BEST ANSWER

A value of 0xe for mFormatFlags is 0b1110 which equates to:

kAudioFormatFlagIsBigEndian                 = (1U << 1),     // 0x2
kAudioFormatFlagIsSignedInteger             = (1U << 2),     // 0x4
kAudioFormatFlagIsPacked                    = (1U << 3),     // 0x8

So a frame consists of two interleaved big-endian int16_t samples.