• 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: Encoding Mono IMA4
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Encoding Mono IMA4


  • Subject: Re: Encoding Mono IMA4
  • From: "tahome izwah" <email@hidden>
  • Date: Tue, 1 Aug 2006 07:44:05 +0200

Hi Bill,

yes that was the exact reason why I asked him how he got these values.

I'm still wondering how to fill out an ASBD correctly (I will try
AudioFormatGetProperty with kAudioFormatProperty_FormatInfo in a
moment, thanks for the info!). For instance, in Configure() the ASBD
is filled in like

	// Twiddle the format to our liking
	fOutputFormat.mChannelsPerFrame		= fAudioChannels;
	fOutputFormat.mSampleRate			= mStreamFormat.mSampleRate;
	fOutputFormat.mFormatID				= kAudioFormatLinearPCM;
	fOutputFormat.mFormatFlags			= kAudioFormatFlagIsFloat |
kAudioFormatFlagIsPacked | kAudioFormatFlagIsNonInterleaved;
	if (fOutputFormat.mFormatID == kAudioFormatLinearPCM && fAudioChannels == 1)
		fOutputFormat.mFormatFlags &= ~kLinearPCMFormatFlagIsNonInterleaved;
#if __BIG_ENDIAN__
	fOutputFormat.mFormatFlags |= kAudioFormatFlagIsBigEndian;
#endif
	fOutputFormat.mBitsPerChannel		= sizeof(Float32) * 8;
	fOutputFormat.mBytesPerFrame		= fOutputFormat.mBitsPerChannel / 8;
	fOutputFormat.mFramesPerPacket		= 1;
	fOutputFormat.mBytesPerPacket		= fOutputFormat.mBytesPerFrame;	

What I don't understand here is the mBytesPerFrame value - shouldn't
that be fOutputFormat.mChannelsPerFrame *
fOutputFormat.mBitsPerChannel / 8? A frame contains all channels,
right? But when I set it accordingly ExtAudioFileSetProperty fails...

Also, what's the business with the magic cookie thing? As long as I
have an input file I guess I can use the cookie from there, but what
if I create a new audio file from scratch? How do I generate a magic
cookie?

And when I write to an MPEG4 AAC file, how do I set the encoding
quality? And why does AAC work while, for example, CELP gives me an
error for ExtAudioFileSetProperty? Has this something to do with the
magic cookie? Any magic cookie to make MP3 encoding work? I'm willing
to bet that there is one :-)

Thanks,
--th


2006/8/1, William Stewart <email@hidden>:
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

_______________________________________________
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: 
 >Re: Encoding Mono IMA4 (From: Lee Falin <email@hidden>)
 >Re: Encoding Mono IMA4 (From: William Stewart <email@hidden>)

  • Prev by Date: Re: OpenAL Version Confusion
  • Next by Date: Re: OpenAL Version Confusion
  • Previous by thread: Re: Encoding Mono IMA4
  • Next by thread: AIFF to AudioBuffer?
  • Index(es):
    • Date
    • Thread