I'm trying to read a .caf file as an array of fl开发者_如何转开发oat values in order to perform an FFT and retrieve some pitch data. The .caf file is saved as LinearPCM using the AVRecorder class. How in the world do I go about doing this? Reading up on the structure of the .caf files I understand that their is a file header which will need to be ignored, as well as many headers for individual 'chunks' of audio data. Is there any way to determine where the headers are? The recorded audio files are only going to be a few seconds long so their shouldn't be more than one chunk, but I can't seem to find a reference for .caf structure which goes into more details than the Apple Reference Library.
You want to use the Extended Audio File API
http://developer.apple.com/iphone/library/documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html#//apple_ref/c/func/ExtAudioFileRead
This will do it really easily. There is no reason to try to parse the file manually.
精彩评论