Buffers

DSP related issues, mathematics, processing and techniques
Post Reply
Rocko
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Buffers

Post by Rocko »

Hi all,

I'm trying to run a simple buffer, using arrays ('DSP code module'), without success.
It seems like a simple syntax issue... Could you help?
What am I doing wrong?

Code: Select all

monoin in;
monoout out;
 
float buffer[2];


out = buffer[0];

buffer[0] = buffer[1];

buffer[1] = in ;


Thanks
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Buffers

Post by martinvicanek »

That's a limitation of FS's array implementation: you can't use different array elements in one equation. :-(
Your example would work with a termporary - uhm - buffer (temp variable):

Code: Select all

monoin in;
monoout out;

float buffer[2];
float temp;

out = buffer[0];
temp = buffer[1];
buffer[0] = temp;

buffer[1] = in ;

But that's of course kinda pointless. When using arrays, you do not want to move the data like in a fire brigade. Look inside the stock delay, there is a ring buffer.
Rocko
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Re: Buffers

Post by Rocko »

Thanks Martin - appreciated !!
Post Reply