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
- I currently read an audio file into an AVAudioPCMBuffer (audBuffOne)
- I loop through the buffer and detect the starts and ends of silence
- 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 ...
- I loop through my array to go through each A and B framePositions
- 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
- I go back to audBuffOne
- Set framePosition to on the audio file to A
- Read into audBuffTwo for there proper length to reach frame B
- Save audBuffTwo to a new file
- ...keep looping