I'm working on an object which copies a chunk of data from a buffer~. The object is used inside poly~ and the copy action happens on each new voice trigger.
Depending on the voice parameters it copies small to medium sized chunks, the biggest ones being a few seconds. I currently copy the samples straight from the perform routine.
I noticed that with smaller i/o sizes (128) and larger sample chunks (>1 sec stereo) I get zipper noise in Ableton Live. I'm guessing this is the result of CPU spikes from the copy routine taking too many cycles. So I'm looking for a way to optimize and prevent this.
The data read from the buffer won't ever change or resize while its being copied afaict. Would it help if I don't call buffer_perform_begin() and buffer_perform_end(), so that I won't block access to the buffer for the other voices? Or is buffer_perform_* only preventing data changes and not read operation?
Would it help if I copied the audio in a separate worker thread? I'm guessing this will only work when not blocking the buffer access for other threads. Then I will have to handle the delay that occurs from copying inside my algorithm, since the voice can't start playing immediately, but that is still a lot more feasible than zipper noise of course.
Maybe there are other ways...Hope someone can shed some light on this.