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.
Asked
Active
Viewed 1,309 times
1 Answers
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
-
Ah okej thanks i think i get the idea. The problem remaining is how can i stream data into the buffer. – user3585110 May 02 '14 at 15:23