[PD] Deleting arrays

Frank Barknecht fbar at footils.org
Tue Feb 16 17:54:17 CET 2010


Hallo,
Dan Ellis hat gesagt: // Dan Ellis wrote:

> I'm trying to read in a file containing a sinusoidal analysis, to
> provide control for additive synthesis.  My patch creates a set of
> arrays (tables) for the frequency and magnitude values for as many
> partials as are described in the analysis file (which is generated by
> a separate program) via messages like [; pd-graph1 array $1-freqArray
> 100 float 0( .  $1 comes from a counter which is reset when I read in
> a new file.
> 
> But once I create an array, it never goes away, and I end up with an
> ever increasing number of tables named 0-freqArray etc.

If you only need one array, why not just create that statically (personally I
prefer the [table] object for data, I don't need to see), then load its content
with "read"/"write" messages?

Example: 

 [table MyArray 100]

 [read /tmp/data1.txt(
 | 
 [s MyArray]

 [read /tmp/data2.txt(
 | 
 [s MyArray]

 ... 

The textfiles should just contain the array contents, one number per line. Check out the 
file 15.array.pd and 16.more.arrays.pd in the docs for more on table manipulation.

Ciao
-- 
Frank




More information about the Pd-list mailing list