Search code examples
iosobjective-cavaudioengineavaudioplayernodeavaudiofile

Read an AVAudioFile into a buffer starting at a certain time


Let's say I have an AVAudioFile with a duration of 10 seconds. I want to load that file into an AVAudioPCMBuffer but I only want to load the audio frames that come after a certain number of seconds/milliseconds or after a certain AVAudioFramePosition.

It doesn't look like AVAudioFile's readIntoBuffer methods give me that kind of precision so I'm assuming I'll have to work at the AVAudioBuffer level or lower?


Solution

  • You just need to set the AVAudioFile's framePosition property before reading.