Does AVAudioPCMBuffer have a "partial copy" method?

I have this long kludgy bit of code that works. I've outlined it below so as not to be confusing as I have no error within my code.

I just need to know if there's a method that already exists to copy a specific part of an AVAudioPCMBuffer to a new AVAudioPCMBuffer?

So if I have an AVAudioPCMBuffer of 10,000 frames, and I just want frames 500 through 3,000 copied into a new buffer (formatting and all) without altering the old buffer...is there a method to do this?

My code detects silent moments in an audio recording

  1. I currently read an audio file into an AVAudioPCMBuffer (audBuffOne)
  2. I loop through the buffer and detect the starts and ends of silence
  3. I record their positions in an array
    • This array holds what frame position I detect voice starting (A) and which frame position the voice ends (B), with some padding of course

... new loop ...

  1. I loop through my array to go through each A and B framePositions
  2. Using the sample size from the audio file's formatting info, I create a new AVAudioPCMBuffer (audBuffTwo) large enough to hold from A to B and having the same formatting as audBuffOne
  3. I go back to audBuffOne
  4. Set framePosition to on the audio file to A
  5. Read into audBuffTwo for there proper length to reach frame B
  6. Save audBuffTwo to a new file
  7. ...keep looping

Did you end up figuring this out? Doing exactly the same thing, but for different purposes. I want to copy segments of various buffers into an output buffer meant for playback.

I'm working through it still, I'm using memcpy on the float data.

Does AVAudioPCMBuffer have a "partial copy" method?
 
 
Q