I’m trying to implement the following difference equation (an antiresonator) as a max external
y(n) = (1/A)*x(n) – (B/A)*x(n-2) – (C/A)*x(n-3)
My question is how do I access the previous samples required for this. I have done this many times in non real-time situations (in Matlab) but I’m a little unsure of how to deal with the input vector.
Is it a matter of simply subtracting 1 from the *in pointer for each previous sample or is it necessary to store the values somewhere?
Thanks for the reply.
I’ll try that out!
That worked out fine.
I made an array of 4 elements to store the values of x(n)…..x(n-3) and shifted them to the right at the beginning of each iteration of the dsp loop. Quite simple in the end. I’m just not so used to processing streams like that.
Thanks for the help.
You should probably look up "ring buffer" in a text book on data structures. It is more efficient than shifting data around at every sample. However, if your buffer is only four elements it won’t make a big difference.
Still, for future reference. If you try to scale your approach to delay lines of several milliseconds (ie hundreds or thousands of samples) it will be imperative to use a more efficient approach.
C74 RSS Feed | © Copyright Cycling '74