Re: Encoding Mono IMA4
Re: Encoding Mono IMA4
- Subject: Re: Encoding Mono IMA4
- From: Lee Falin <email@hidden>
- Date: Tue, 1 Aug 2006 10:57:32 -0400
I suppose ideally it should be, however I am always recording to
mono, so my number of channels is always 1. If you had an application
where you had a dynamic number of channels, then you should probably
do that.
For those that are wondering how I got the other values, I used the
IMA4 information in the CAF spec:
http://tuvix.apple.com/documentation/MusicAudio/Reference/CAFSpec/
CAFSpec.pdf
As for the AudioFormatGetProperty function, that is good to know.
Unless I'm missing something, there really doesn't seem to be
anything in the docs that would indicate you can give it a half-
correct ASBD and receive the entire description back. However this
may just be a lack of understanding on my part. I again appreciate
everyone's help.
Lee
On Jul 31, 2006, at 9:24 PM, William Stewart wrote:
Shouldn't bytes per packet be a value dependent on your number of
channels - I like your other example better :-)
outputFormat.mBytesPerPacket = outputFormat.mChannelsPerFrame * 34;
BTW - We're really encouraging developers NOT to hard code values
like the below - so we provide a set of services from the
AudioFormat API that will fill out ASBD's for you. So, in this case
you would set:
ima
numChannels
sampleRate
and set everything else to zero.
Then call the AudioFormatGetProperty call (the header lists the
full range) and have it fill out the rest of the fields for you (It
would also have saved you from this mistake too).
@constant kAudioFormatProperty_FormatInfo
Retrieves general information about a format. The specifier is a
magic cookie, or NULL.
On input, the property value is an AudioStreamBasicDescription
which
should have at least the mFormatID filled out. On output it
will be filled out
as much as possible given the information known about the format
and the contents of the magic cookie (if any is given).
Thanks
Bill
On 29/07/2006, at 11:13 AM, Lee Falin wrote:
Doh, found the problem.
The output format that I was passing to ExtAudioFileCreateNew was
correct, but the format that I was setting for
ExtAudioFileSetProperty for kExtAudioFileProperty_ClientDataFormat
had two channels instead of one. Apparently the converter can
convert between bitrates and encoding format, but not between mono
and stereo. (For example I write to file with a sampling rate of
11000, but my client format is 44100)
Here are the final settings I used for IMA4 mono:
AudioStreamBasicDescription outputFormat;
outputFormat.mChannelsPerFrame = 1;
outputFormat.mSampleRate = 11000;
outputFormat.mFormatID = kAudioFormatAppleIMA4;
outputFormat.mFormatFlags = 0;
outputFormat.mBitsPerChannel = 0;
outputFormat.mBytesPerFrame = 0;
outputFormat.mFramesPerPacket = 64;
outputFormat.mBytesPerPacket = 68;
Thanks for everyone's help,
Lee
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
--
mailto:email@hidden
tel: +1 408 974 4056
______________________________________________________________________
____
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
______________________________________________________________________
____
_______________________________________________
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