I record audio in .caf format and later need to convert it to .wav in order to send the file as a email attachment. How can I convert the file to wav format in iOS 3.1.x?
The format of the audio:
[NSNumber numberWithInt:kAudioFormatLinearPCM], AVFormatIDKey,
[NSNumber numberWithFloat:11025.0f], AVSampleRateKey,
[NSNumber numberWithInt:1], AVNumberOfChannelsKey,
[NSNumber numberWithInt:16], AVLinearPCMBitDepthKey,
[NSNumber numberWithBool:YES], AVLinearPCMIsBigEndianKey,
[NSNumber numberWithBool:NO], AVLinearPCMIsFloatKey,
I am not tied to this format, I just need to be able to record and playback on the device and email a wav version file.
The answer is simple, just init with a .wav extension.
The answer was provided by Paul Bruneau on the Apple Developer forum:
From the class reference docs, the recorder infers the file type from the extension that you choose. So try .aiff or .aif or .wav
initWithURL:settings:error:
Initializes and returns an audio recorder.
Parameters: url
The file system location to record to. The file type to record to is inferred from the file extension included in this parameter’s value.