WongWray WongWray -3 years ago 126
iOS Question

Read an AVAudioFile into a buffer starting at a certain time

Lets 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? Any help is appreciated

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download