RE: Almost there with ExtAudioFile
RE: Almost there with ExtAudioFile
- Subject: RE: Almost there with ExtAudioFile
- From: "Edwards, Waverly" <email@hidden>
- Date: Fri, 13 Aug 2010 16:54:42 -0500
- Acceptlanguage: en-US
- Thread-topic: Almost there with ExtAudioFile
Is there a problem when the sample rate of the input file does not match the sample rate of the desired output file?
I've been reading the documentation and looking at examples. In every example the input sample rate is the same as the output.
In the linked example below a comment states
http://developer.apple.com/mac/library/samplecode/ConvertFile/Listings/UseExtAF_cpp.html
>>
// if outputBitRate is specified, this can change the sample rate of the output file
// so we let this "take care of itself"
<<
Is there something extra that needs to be done if the sample rate is changed?
Thank you,
W.
-----Original Message-----
From: coreaudio-api-bounces+waverly.edwards=email@hidden [mailto:coreaudio-api-bounces+waverly.edwards=email@hidden] On Behalf Of William Stewart
Sent: Friday, August 06, 2010 9:03 PM
To: Fernando Valente
Cc: CoreAudio list
Subject: Re: Almost there with ExtAudioFile
The FileDataFormat is set when you create the file, so you don't need to set it explicitly. The purpose of the difference between the file and client data formats is to have ExtAudioFile convert from your client format (which is convenient for you to use) to / from the data format that is contained within the file
Bill
On Aug 3, 2010, at 1:11 PM, Fernando Valente wrote:
> 'm almost there with ExtAudioFile. Recording on my app is almost working. There are 2 things I'm still not able do. First is to set the kExtAudioFileProperty_FileDataFormat. I keep getting the -1 error. The second problem is that I don't know what to enter as values for inNumberFrames and ioData in ExtAudioFileWriteAsync. This is my code:
>
> url = (CFURLRef)[NSURL URLWithString:documents];
>
> CAStreamBasicDescription clientFormat, dstFormat;
> clientFormat.SetCanonical(1, true);
> clientFormat.mSampleRate = 44100.0;
>
> printf("Source file format: ");
> clientFormat.Print();
> OSStatus status;
> destinationFile = NULL;
>
> dstFormat.mFormatID = kAudioFormatAppleIMA4;
> dstFormat.mSampleRate = 44100.0;
> dstFormat.mChannelsPerFrame = 1;
>
> UInt32 size = sizeof(dstFormat);
> status = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, &size, &dstFormat);
> NSLog(@"%d", status);
> printf("Destination file format: ");
> dstFormat.Print();
>
> status = ExtAudioFileCreateWithURL(url, kAudioFileCAFType, &dstFormat, NULL, kAudioFileFlags_EraseFile, &destinationFile);
> NSLog(@"%d", status);
>
> size = sizeof(clientFormat);
> status = ExtAudioFileSetProperty(destinationFile, kExtAudioFileProperty_ClientDataFormat, size, &clientFormat);
> NSLog(@"%d", status);
>
> status = ExtAudioFileSetProperty(destinationFile, kExtAudioFileProperty_FileDataFormat, size, &clientFormat);
> NSLog(@"%d", status);
_______________________________________________
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