what is the best strategy to use a array of array in max.
Let’s say I have 3000 chord of 4 note in midinote and I want to do a select random. Is there a way using something like "zl lookup" but for the whole chord.
This must be something easy to do but I ignore the way to do it and can find the answer using google…
i doubt you need 3000, and i doubt that randomness is interesting.
but the object you are looking for is definetly [coll]
http://cycling74.com/forums/topic.php?id=26565 ; have a look on [charlie] and [yankee] if you want to "compress" your 3000 chord in 50 ;-)
Thanks Roman for the answer. Actually I will have 16 list of 3000 to 5000 chord. This is a resarch project of Sandeep Bhagwati at the Matralab for a interactive real-time score for string quartet and percussion quartet. And it is definitely conceptual!
I’ve always thought that a "fast and simple to use" multi-dimensional array object was missing in max, through one can also use :
- [fmat] (installing ftm/gabor free ircam package)
- or maybe even the new [polybuffer~] object perhaps, if it can be used with [peek~], i don’t know..
( http://cycling74.com/forums/topic.php?id=26356 )
Here are some storing/reading arrays examples that i made 5 years ago: "Efficiency-test-on-arrays.maxpat" in attachment.
[coll] is not really an array but a ‘collection’, and it can get really badly unefficient when using lots of datas (for example gestures datas), through, for musical chords, it could be fine, but hmm…
…on my 2,4Ghz macbookpro, if using a list of 5000* 4-notes-chords, i can only read 5 chords in a [coll] in one millisecond** : 1 millisecond, that’s still 2400000 cycles… i’m REALLY wondering what is [coll] doing during 2400000 cycles instead of looking for my 4*5=20 notes… this is 120000 computer cycles to recover one single value! Is [coll] playing cards with itself ??
*using a list of 2000 4-notes-chords is 4 times less slow… [coll] slowness is exponential to its size, as all ‘collection-type’ datas, i guess…
** using [fmat], [jit.matrix] or [buffer~] to store/read arrays is about X20-X100 more efficient than a [coll] of 5000 lines. (while using arrays inside Java or C routines is around X15000-X30000 more efficient compared to a [coll] ] of 5000 lines. (!) )