0

I'm trying to implement a pitch shifting algorithm in Simulink that uses a ring/circular buffer but I don't know how this is done. Im streaming an audio signal using a microphone and i want store the data in a circular buffer in order to change the pitch of the audio and i would like to know how to implement such a buffer.

1 Answers1

0

The simplest way is to increment the index of an array in such a way that it loops around.

bufSize = 10;
circBuffer = zeros(bufSize,1);

for i = 1:15
  ind = mod(i-1,bufSize) + 1;
  circBuffer(ind) = i;
end

Do you need something more complicated than that?

Chris Taylor
  • 46,912
  • 15
  • 110
  • 154