Grainy time stretching & pitch shifting with Rubberband

Hi, i’m trying to implement Rubberband in my project, but the output of the audio file is pretty grainy. Here’s my simple implementation:

Appreciate any help. Thanks.

Grainy in what way? Does it sound like the issue is with Rubberband?

@evanberard no, it’s like im processing the buffer in an inappropriate way which make the buffer being filled inconsistently

you call stretcher->process for every sample, this looks wrong because stretcher->process takes the whole buffer for input.
call stretcher->process() once, and then you can pick the results up with ->available in a loop. I might be wrong, but that is my quick guess :wink:

@PaulDriessen When i lift the stretcher->process out of the loop, the output audio is no longer stretch regardless of the input time scale