• 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: Changing bit depth when writing to ALAC format
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing bit depth when writing to ALAC format


  • Subject: Re: Changing bit depth when writing to ALAC format
  • From: Eric Allamanche <email@hidden>
  • Date: Mon, 23 Dec 2013 09:54:22 -0800


On Dec 21, 2013, at 5:00 PM, iain <email@hidden> wrote:

(Apologies for the cross posting with devforums)
I'm storing my audio data in memory as non-interleaved float, and I'm using ExtAudioFile to encode it to both AIFF and ALAC. The resulting files are both playable and contain the correct data when decoded, but the ALAC file is almost twice the size of the AIFF file. (AIFF - 43.5MB, ALAC - 73.9MB). When I convert the AIFF file to ALAC using iTunes the file is only about 24MB.

Looking at the Finder Info window for each file the ALAC file I created does not have an entry for 'Bits per sample'. The AIFF file and the iTunes generated ALAC both say 'Bits per sample: 16'.

From this, I'm guessing that the ALAC file I'm generating is using a higher bitrate than 16.

The code I'm using is:

_outputFormat.mSampleRate = 44100;
_outputFormat.mFormatID = kAudioFormatAppleLossless;
_outputFormat.mChannelsPerFrame = 2;
AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, sizeof(_outputFormat), &_outputFormat);

ExtAudioFileCreateWithURL(urlRef, kAudioFileM4AType, &_outputFormat, ...);

I've tried setting the mBitsPerChannel for my output ASBD after I call AudioFormatGetProperty, but it doesn't change anything.

For ALAC you need to set the mFormatFlags field to kAppleLosslessFormatFlag_16BitSourceData. You should check this constant and other related constants in CoreAudioType.h


Does anyone know how I can set the bitrate to 16, or if I've made some other mistake as to why the ALAC file is larger than the AIFF?

thanks,
iain

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
  • Follow-Ups:
    • Re: Changing bit depth when writing to ALAC format
      • From: iain <email@hidden>
References: 
 >Changing bit depth when writing to ALAC format (From: iain <email@hidden>)

  • Prev by Date: Re: AUSampler portamento
  • Next by Date: Re: AUSampler portamento
  • Previous by thread: Changing bit depth when writing to ALAC format
  • Next by thread: Re: Changing bit depth when writing to ALAC format
  • Index(es):
    • Date
    • Thread