4

I'm loading in a .caf file with AVAudioPlayer, and I'd like to get at a pointer to the audio samples. Is there any way to go about doing this? I know AVAudioPlayer has an NSData property which I assume is the bytes read in from the .caf file. Could I just strip the .caf header? I don't think the samples are stored as LPCM in .caf files, so I feel like I'd have to convert.

Is there an easier method than using AVAudioPlayer to load up a .caf file and have access to the samples?

Artelis
  • 159
  • 1
  • 11
  • 1
    I would recommend using CoreAudio for this. I find you have more control/options with CoreAudio then you do with AVFoundation. You would also have access to AudioToolbox for all your conversion needs. There is an excellent book out titled CoreAudio by Mike Lee, Kevin Avila and Chris Adamson. Very well written and excellent examples. – Steve McFarlin Nov 14 '11 at 01:04
  • Is this still the same even now? – adev Aug 09 '17 at 06:02
  • I'm looking for an answer to this too. Here's the documentation but it doesn't list all the properties https://developer.apple.com/documentation/avfaudio/avaudioplayer – 1.21 gigawatts May 16 '21 at 08:06

0 Answers0