Changing bit depth when writing to ALAC format
Changing bit depth when writing to ALAC format
- Subject: Changing bit depth when writing to ALAC format
- From: iain <email@hidden>
- Date: Sun, 22 Dec 2013 01:00:26 +0000
(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.
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