• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Resources to learn more about the difference between packed and unpacked (high/low aligned) samples?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resources to learn more about the difference between packed and unpacked (high/low aligned) samples?


  • Subject: Re: Resources to learn more about the difference between packed and unpacked (high/low aligned) samples?
  • From: Kevin Dixon <email@hidden>
  • Date: Thu, 15 May 2014 19:48:54 -0700

All of the fields in ASBD are used to describe these things. Packing, as far as I know, is always aligned either high or low regardless of data type

For PCM consider the following. The equations hold regardless of the "container data type" and the audio bit depth.

mFramesPerPacket = 1;
mBytesPerPacket = number_of_channels * sizeof(ContainerDataType);
mBytesPerFrame = mBytesPerPacket;
mChannelsPerFrame = number_of_channels;
mBitsPerChannel = audio_bit_depth;

the packing is specified in mFormatFlags

Hope that helps

Kevin


On Thu, May 15, 2014 at 4:55 AM, Reed Weichler <email@hidden> wrote:
Thank you for the detailed explanation!

So when it's packed, the audio date takes up the full 32 bits, correct?

And what would be the case for a 16-bit integer, or an 8-bit one?


On Mon, May 12, 2014 at 4:47 AM, Paul Davis <email@hidden> wrote:
This is 32 bits:

     11111111111111111111111111111111

This is 32 bits with 8 bits set to zero


    00000000111111111111111111111111

This is 32 bits with a different 8 bits set to zero


    11111111111111111111111100000000

In the last two examples, there are 24 bits set to 1. You could consider that as a 24 bit audio sample packed into a 32 bit integer. But the two cases are very different. One of them is "low aligned" and one of them is "high aligned".

Audio interfaces don't produce more than 24 bits of data (even the ones that say they produce 24 typically don't actually get that close. If they really did generate 32 bits, the least significant bits would fluctuate with brownian noise (atomic motion). But computers like 32 bit chunks of data. So the interface will typically pack the 24 bit sample into a 32 bit chunk, which means that it has to leave 8 bits unset (or maybe not .... but that is another story).

Which 8 bits it leaves unset defines whether the format is "high aligned" or "low aligned". Note that this intersects just a little with the endianness of the processors in use. In general you don't have to think about it, except for the occasional wierd case where your interface's processor(s) and the CPU have different endianess. This has always been exceedingly rare and almost never happens these days.



On Mon, May 12, 2014 at 6:08 AM, Reed Weichler <email@hidden> wrote:
I'm looking at the documentation for AudioStreamBasicDescription's possible values for mFormatFlags here: https://developer.apple.com/library/mac/documentation/musicaudio/reference/CoreAudioDataTypesRef/Reference/reference.html#//apple_ref/doc/constant_group/Audio_Data_Format_Identifiers

I understand what most of the flags mean, namely float vs sint vs. uint, interleaved vs noninterleaved, and big endian vs little endian. But the one that's stumping me completely is what packed, high-aligned and low-aligned samples are. Could someone be kind enough to explain this to me, or provide a link to some sort of documentation on this? I have no idea what they are or could possibly mean. The documentation doesn't elaborate on it and I can't find anything on Google.

Thanks much.

Reed Weichler

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Resources to learn more about the difference between packed and unpacked (high/low aligned) samples? (From: Reed Weichler <email@hidden>)
 >Re: Resources to learn more about the difference between packed and unpacked (high/low aligned) samples? (From: Paul Davis <email@hidden>)
 >Re: Resources to learn more about the difference between packed and unpacked (high/low aligned) samples? (From: Reed Weichler <email@hidden>)

  • Prev by Date: Re: Resources to learn more about the difference between packed and unpacked (high/low aligned) samples?
  • Next by Date: AudioComponentRegister host AU in Graph
  • Previous by thread: Re: Resources to learn more about the difference between packed and unpacked (high/low aligned) samples?
  • Next by thread: Converting to the canonical audio unit format
  • Index(es):
    • Date
    • Thread