Hello.
Can anybody explain to me the relation between mp3 frames and packets? The ASBD description that I have found for mp3 is this:
desc.mSampleRate = 44100.00; desc.mFormatID = kAudioFormatMPEGLayer3; desc.mFramesPerPacket = 1152; desc.mChannelsPerFrame = 2;
Assume all other fields are set to zero.
Now, if I have mp3 data that is 44100.00Hz and 128kbps, I have found online that a frame length can be calculated as:
frameLength = ((144 * (bitRate * 1000)) / sampleRate) + padding
For 128kbps and 44100.00hz this equals 417 or 418 bytes depending on wether or not padding is required. So, it seems that an audio converter that needs 1 packet of mp3 audio data needs approximately: 1 packet * (1152 frames / packet) * (417 bytes / frame) = 480384 bytes (469k).
Is this correct? It sure seems like an awful lot of data to read in one pass. What if there is only 32k available? How can I return less than 1 packet of data that isn't at the end of the stream?
Dominic Feira / Code Monkey / Ambrosia Software, Inc |