editing the buffer window using a list: best way?

I want to control the buffer window (for controlling envelopes) using a list. What is the best way of doing this. I get semi-random values and need obviously 512 values to send to the editor. What is the best way to do this. using coll does not seem to work.

I think this should work however:
when the highest value (512) is reached, I want it to start writing from the beginning, so the old point1 gets replaced by a new point1 and so on but in the meantime the old points have to stay there. So I need to clear only 1 element at a time. How should I tackle that?

-- Pasted Max Patch, click to expand. --

Copy all of the following text. Then, in Max, select New From Clipboard.