Re: format problems with ExtAudioFile
Re: format problems with ExtAudioFile
- Subject: Re: format problems with ExtAudioFile
- From: Doug Wyatt <email@hidden>
- Date: Mon, 30 Jan 2006 12:51:18 -0800
On Jan 29, 2006, at 18:19, thomas rettich wrote:
hi,
I am using the extaudiofile api for reading and writing files to
disk. I've experienced some problems when doing so that I have been
able to solve yet... so any help would really be appreciated:
as far as writing is concerned... I am calling
ExtAudioFileWriteAsync on a post render notification and write the
iodata buffer to disk (compressed) . this works fine as long as I
specify 'caff' as the filetype. when I specify any other format
such as aiff or aac I get a format error.
this is the ABSD I filled out:
outputFormat.mSampleRate = 44100.;
outputFormat.mFormatID= kAudioFormatAppleIMA4;
outputFormat.mFormatFlags = 0;
outputFormat.mChannelsPerFrame = 2;
outputFormat.mBitsPerChannel = 0;
outputFormat.mFramesPerPacket= 64;
outputFormat.mBytesPerPacket = 68;
outputFormat.mBytesPerFrame = 0;
if I specify aiff or aac respectively, as the filetype (in
extaudiofilecreatenew), what fields of outputformat would I have to
change ?
One of the great things about CAF is that it can contain any data
format (that we've thought of, anyhow).
An AAC (ADTS) file can't contain IMA4. Nor can AIFF, but AIFC can ...
double-checking ... yes, from afconvert's help (invoke with no
arguments):
'AIFC' = AIFC (.aif, .aiff, .aifc)
data_formats: BEI8 BEI16 BEI24 BEI32 BEF32
BEF64 'ulaw' 'alaw' 'MAC3' 'MAC6'
'ima4'
'QDMC' 'QDM2' 'Qclp' 'agsm'
If you know for sure you want to use IMA, then your file format
choices are AIFC and CAF.
Have a look through CAAudioFileFormats in PublicUtility to see how
afconvert gets this information.
as far as reading is concerned I have encountered another
problem... again if I read from a 'caff' file things work fine.
yet, as soon as I try to read from an mp3 file (or any other file
type) I get a format error (exception thrown by AUConverterNew).
I've tried specifying a different client data format (lpcm), but
this wouldn't help:
clientFormat.mSampleRate = 44100.;
clientFormat.mFormatID= 'lpcm';
clientFormat.mFormatFlags = kAudioFormatFlagIsBigEndian |
kAudioFormatFlagIsSignedInteger;
OR in kAudioFormatFlagIsPacked; this bit must be set when appopriate
(and for the vast majority of PCM formats, it is)
clientFormat.mChannelsPerFrame = 2;
clientFormat.mBitsPerChannel = 16;
clientFormat.mFramesPerPacket= 1;
clientFormat.mBytesPerPacket = 4;
clientFormat.mBytesPerFrame = 4;
again, can anyone provide me with hints about what values for what
field exactly have to be specified or what could be the solution to
reading mp3 files from disk with extaudiofile ?
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
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