[PD] Array that scrolls from right to left

Frank Barknecht fbar at footils.org
Mon Feb 23 17:45:19 CET 2009

Sebastien Lelong hat gesagt: // Sebastien Lelong wrote:

> I've recently discovered Pure Data as versatile platform I could use to
> build a robotic GUI. The idea is to collect data from a robot, send it to an
> OSC (open source control) server, get the data in pd~ and deal with it. One
> important aspect would be to plot data, in real-time, so the graph scrolls
> from right to left, and data is appended to the end of array (right) (well,
> I hope what I write is understandable...).
> So far so good, I've been able to build all the OSC part, and even plot
> things in a array in pd~, but I can only find a way to plot data from left
> to right, and when array's end is reached, clear it and start from beginning
> again. In other words, I can't make it scroll...

One simple way to make it scroll would be to use [list-lastx
<TABLESIZE>] from the [list]-abs collection. Just prepend a 0 to the
outgoing list and send it to a receiver named after the table like this: 

 [table DATA 16]

 [r ROBOT]
 [list-lastx 16]
 [list prepend 0]
 [s DATA]

Alternatively do it manuall. The basic algorithm is this: 

If a new ROBOT-float comes in store it. Then start a loop over the table
where you

1) read out the current element with [tabread]
2) store it in the right inlet of a [float]
3) write the new value into the table with [tabwrite]
4) increment your counter
5) repeat using the float stored in 2) as the new value.

This is a good excercise to get familiar with the [trigger] object and
Pd's execution order.


More information about the Pd-list mailing list