ExtAudioFile : changing underlying converter bitrate ; mp3 encoding
ExtAudioFile : changing underlying converter bitrate ; mp3 encoding
- Subject: ExtAudioFile : changing underlying converter bitrate ; mp3 encoding
- From: Olivier Gillet <email@hidden>
- Date: Fri, 18 Nov 2005 04:29:21 +0100
Hi,
I have two questions regarding the use of ExtAudioFile to save raw
PCM data into encoded formats.
Question 1 :
I am saving raw PCM data into a AAC file by using ExtAudioFile:
err = ExtAudioFileCreateNew(&f,(CFStringRef)
file,formatID,&destinationFormat,NULL,&fileRef);
...
err = ExtAudioFileSetProperty
(fileRef,kExtAudioFileProperty_ClientDataFormat,sizeof
(sourceFormat),&sourceFormat);
...
This works and the file is saved with the default birate (128 kbps).
But if I try to use :
size = sizeof(AudioConverterRef);
err = ExtAudioFileGetProperty(fileRef,
kExtAudioFileProperty_AudioConverter, &size, &converterRef);
...
err = AudioConverterSetProperty
(converterRef,kAudioConverterEncodeBitRate,sizeof(UInt32),&bitRate);
To modify the bitrate of the underlying AudioConverter, I get an '!
stt' error.
Is there a solution?
Question 2 :
I would also like to write mp3. Here is what I am trying to do:
destinationFormat.mFormatID = kAudioFormatMPEGLayer3;
destinationFormat.mBitsPerChannel = 0;
destinationFormat.mBytesPerFrame = 0;
destinationFormat.mBytesPerPacket = 0;
destinationFormat.mFramesPerPacket = 1152;
destinationFormat.mChannelsPerFrame = 2;
destinationFormat.mFormatFlags = 0;
formatID = kAudioFileMP3Type;
err = ExtAudioFileCreateNew(&f,(CFStringRef)
file,formatID,&destinationFormat,NULL,&fileRef);
...
err = ExtAudioFileSetProperty
(fileRef,kExtAudioFileProperty_ClientDataFormat,sizeof
(sourceFormat),&sourceFormat);
^ This call fails and returns a "fmt?" error.
Thanks in advance !
Olivier.
_______________________________________________
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