User Tools

Site Tools


This is an old revision of the document!

Numeric arrays are simply sequences of numbers stored in memory in Pd. [table] is an object that can be used to add an array in a patch; the array is stored as a subpatch, which means it will not be visible in the main patch unless you select “graph-on-parent” in the subpatch properties. To create an array that is visualized in the patch you need a graph.

Create an array

There are three ways to create an array:

  • Select “Array” from the Put menu. This will automatically create a new graph to place on the patch canvas.
  • Select “Graph” from the Put menu to place a graph, then select “Array” and choose “in last graph” to associate it with the graph you just placed.
  • Select “Object” from the Put menu and call the object table. This will create the subpatch with a graph and array. See the help on table for creation arguments.

Initializing Properties

You can initialize array properties using dialog boxes.

  • At creation time, give the array a name and size (and several miscellaneous choices)
  • Use the Properties menu to select the X and Y ranges for the array. For example, an array of 100 elements will have an X range of 0..99. By default, the Y range is -1..1 for audio values. For control values, change the range to whatever is appropriate for the control. For example, 0..127 for MIDI pitch numbers.

Storing Values in an Array

  • To initialize a small number of elements of an array, open Properties and in the array dialog, choose View List. For a newly created array, all values in the array slots will be zero. You can then double-click on each slot you wish to change and type in whatever number you want. Remember that these are stored as floating point values.
  • To initialize an array all at once, you will usually use [tabwrite] (or [tabwrite~] for audio values). See Help on this object for more information.
  • More to come

Reading Values from an Array

  • To simply view the values in an array numerically (rather than graphically) use the View List mentioned above.
  • To read values from an array for use by subsequent portions of a patch, you will ususally use [tabread] or [tabread~]
  • Reading from an array repeatedly, as in wavetable lookup or a sampler, can be accomplished using the [phasor] object. I'll post a screenshot here soon.
  • More to come

It is very common when working with audio to store values in arrays that exceed the range. This won't (necessarily) cause problems in the patch, but the values will be drawn outside the bounds of the graph. This can be disturbing!

See also numeric arrays from the Pd Documentation website.

tasc/tables_and_arrays.1216242510.txt.gz · Last modified: 2008/07/16 16:08 by scarl