Hi list,
I am encountering a problem that I had some time before under Max and I have the same now that I switched to Pd (actually it's more a logical one than a soft one) Here it is : I am trying to retrieve the n last numbers of a float stream in order to sum them, and I want the n numbers to be refreshed every time a new value is coming (Like a hardware register does with bits) I tried several methods with spigot, glue, lists ... but nothing works. Either I get all the values refreshed all at the same time (n times the current value) or I lost values on the way. I also looked at data structures, it seems there is something to dig there but I am not familiar with data structures and I didn't succeed either. If anyone has an idea, a tip or a clue, it would be very helpful.
To be more descriptive here is what I would like to see :
At time n :
inlet (float at t(n))
|
Logical function
| | |
f(t(n)) f(t(n-1)) f(t(n-2)) ...
At time n+1 :
inlet (float at t(n+1))
|
Logical function
| | |
f(t(n+1)) f(t(n)) f(t(n-1)) ...
n.b. : f is for float and not the function !!!! ;) Of course, at initialisation only f(t(n)) would be non zero, but don't matter for now on.
Thx in advance
Sylvain
Hallo, Sylvain hat gesagt: // Sylvain wrote:
Here it is : I am trying to retrieve the n last numbers of a float stream in order to sum them, and I want the n numbers to be refreshed every time a new value is coming (Like a hardware register does with bits)
Ah, this is another job for the mighty power that has come to pd-0.39 with the [list] object family.
It only taketh two (2!) objects to solve this fine riddle.
I also added a dynamic setter for the register's size, however summing is left as an exercise for the reader.
Frank Barknecht _ ______footils.org_ __goto10.org__