Welcome to %s forums

BrainModular Users Forum

Login Register

Array?

I need help on a Patch
Post Reply
gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 06 May 2009, 20:10

I get the feeling I am missing something really important by not understanding how arrays work. I have already built enough patches and sub patches to cover an entire wall without using an array even once..!
Can somebody show me some simple examples or perhaps a little tutorial to the wiki that might help me understand?

Clearscreen
Member
Posts: 482
Location: Australia
Contact:

Unread post by Clearscreen » 07 May 2009, 01:54

arrays are *REALLY* useful once you get your head around them. a simple way to look at an array is that it's just an indexed list of numbers that you can manipulate any way you can think of - re-sort it; get max/min values; rearrange and modulate it in realtime; shift it linearly or randomly; multiply/add/subtract/join it with an/other array/s etc.

essentially arrays allow you to do some basic programming style stuff without having to be able to script or code your own modules. it's not as powerful as doing they are, but on the other hand it's also not as difficult to learn.

a quick example is one your probably already familiar with - the stepmidi module. basically stepmidi is just an array (lists of midi note values) that gets stepped through at a rate you specify. the steps data module is exactly the same thing as stepmidi but it can also output values not related to midi values.

a good starting place is to place a steps data module in a track and connect an array (display or set) module to it's output. then have a play around putting the other array modules in between the steps and the display modules and see what effects they have on your list of numbers.

off the top of my head i've so far used arrays to build complex sequencers (using the steps, lines and switches data modules), touch screen interfaces (using a 'combo box' module and a 'get array element value' module), weird arps and forcing sequencers to a key.
i've done some more complicated stuff playing around with the array outputs of the fft modules as well, but i find that much more difficult as my understanding of fft stuff is tenuous at best...

another thing to remember is that a lot of the general math, data and audio modules may sometimes work on arrays, so it can be useful sometimes to see what happens when you use these modules on an arrays output. the result may not be what you expect but it may lead you in an interesting direction you wouldn't have thought of.

hopefully this helps you a little bit, and when i get a chance i'll see if i can find some useful examples to post online for you.

gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 07 May 2009, 02:03

Awesome, thanks for taking the time to explain this. I think it makes some sense now, and I'll try practicing with your examples...
Hopefully I don't get addicted! ;)

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 07 May 2009, 02:08

hehe strange I was also very afraid or arrays, don't know why. I just tried one day and discover it wasn't so complicate, and very powerful.

arrays mean just multiples values at same time, kind of "group of values", that can be all send in one only wire, stored in one only module. they can be useful to store various data (automation lines,curves,audio, captions...) for example a word can be store at an array (each caracter is a value, so a 5 word letter is a 5 lengh array. from help: For example, the text ‘hello’ is converted into the following array of singles [104,101,108,108,111]. (those values represent ascii nbs). try to put a display array of a 5 lengh and enter those values, if you link to any caption input it should display the text hello. this is one example,another:

suppose you have several inputs on wich you apply the same operation, let's say X2. you can add a X2 module to each input,
but you can also link each input to an array inputs (16 values max) and if you put a X2 to the output array all values will be X2, then add another array module and check each value, all are X2.

in other words array is just a "group" of values. the great thing is that the arrays sections modules let you do lot of operations and lots of math modules works and will apply modifications to the whole group.
Ie you can draw a sawtooth ramp and if you swap the array it will be inverted, you can use "get elemt value" to search a value in an array, so the same sawtooh you draw can be an lfo if you get successively elt 1,2,3,4 ect..

I first went to it when dealing RGB values, instead of having to wire 3 wires all the time in my patch, sub pach, subsub...the array let me "transport" the 3 values in a same wire, then only at the end level I put an array module to demultiplex the 3 values.
there are tons of applications. the best is to try, don't worry you ll catch the idea in a very short time and sure youll be addict from what you usually deal with i think.!

edit : clearscreen post befofe i submit, sorry for repears :)

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 07 May 2009, 07:34

nice explanations/example guys !
thanks !

ethnix73
Member
Posts: 604
Location: France, Caen
Contact:

Unread post by ethnix73 » 07 May 2009, 11:10

Thanks for this explanation!
Seb.Dub

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 07 May 2009, 11:58

23fx23 wrote:you can add a X2 module to each input,
but you can also link each input to an array inputs (16 values max)...
Nice explanations guys, but to avoid misunderstandings: You can set the value of more than the 16 first array elements using the Set Array Element Value module. The index input refers to where in the array the value should be put; remember that array indexes starts at 0 - not 1 - so the next index after the separat inputs is 16, not 17.

You can also use one of the Concat Array modules to concatenate, that is string together one after another, two, three or four arrays into one. Just remember that the resulting array can't be longer than 512. I haven't tried, but I suppose any elements above the limit are just ignored.

I'd also like to add that you should keep an eye on the array sizes, there's no need to have larger than neccessary arrays. Especially if you're doing for instance arithmetic operations, CPU is wasted on calculating unneeded values.

Remember also to check the min/max values. Several times I've hunted like an idiot to find out why I don't get the right values. OT I know, but..: This applies even more to the ptArray type of in-/out parameters in scripts. I don't remember whether the defaults are 0/100 or -100/100, but it's easy to override using the SetMin and SetMax procedures.
Bjørn S

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 07 May 2009, 12:46

yup true clarification , just as an earlier of your suggest bsork , 512 limit might be extended in futur?

Post Reply

Who is online

Users browsing this forum: No registered users and 67 guests