Welcome to %s forums

BrainModular Users Forum

Login Register

Arrays

General Discussion about whatever fits..
Post Reply
waolelaid
Member
Posts: 339
Location: Ecouen 95
Contact:

Unread post by waolelaid » 19 Jul 2010, 04:35

hi All , i have a problem since the beginning of Usine
i don't understand how to do with arrays i don't understand their utilities,their use and the concept
and when i go to Module's Reference » Array Modules there is a link to array manipulation
when i press the link i fall on a very beautiful white page
so how can i do to understand their use does it exist examples to explain what happen in them
in fact i'm completely lost
example with shift array :
Shift elements of an Array, and complete with 0
array in
input array to sort.
array out
Shifted array.
shift
N=0 : do nothing.
N<0 : shift elements to the left and complete by 0 at the end of the array.
N>0 : shift elements to the right and complete by 0 at the beginning of the array.

What's it for ? how to wire it what does it allow to do
and it's the same for all
i'm sorry for this stupid question but i'm always blocked with those modules
wish you a good day
hope i don't annoy too much
thank you
Avant l'effet on croit à d'autres causes qu'après
Friedrich Nietzsche

Clearscreen
Member
Posts: 482
Location: Australia
Contact:

Unread post by Clearscreen » 19 Jul 2010, 07:03

Arrays are, simpy put a list of information - for example and array could be a list of numbers [5, 8, 13, 24] where positions 0=5, position 1=8, 2=13, 3 =24. They're used a lot in computer programming to store lists of numbers or words for reference or manipulation - basically it's just a way of keeping information in order so you can do other things with it. So if you take a step midi module each of the steps can be output as an array (list) or numbers representing the midi note number triggered by each step. To use your example, if you put a shift array module connected between the array in and array out of two step midi's you can shift the midi output of the two arrays relative to each other, effectively creating a midi delay. Another simple example is you could also reorder the array using the sort modules to change the play order of the notes.

It's definitely a difficult subject to get your head around but if you play around with inserting the various array modules between two step modules it should be easier to visualise what they're doing - that's pretty much how I figured it out :)

More extreme examples of an array would be things like the matrix add-on, which is effectively a 2D array, meaning it stores information in both the X and Y directions as opposed to only X (ie a vertical list) or Y (a horizontal list).

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 19 Jul 2010, 07:25

Hi,
About shift array module:
The 'N' refers to the value of the 'shift' parameter.

For example

N=0 means there's no shift already applied. The array won't change.

N=-1 means a negative value for shift. Each element of the array 'jumps' to the left position, in a chained way. The original first element gets out of the array and the original second one takes their place. So at the position of the last element there's one empty space left that is filled with a value of 0.

N=1 means a positive value for shift. The same of the negative values, but this time the movement goes to the right, effectively leaving the last original element out of the array.

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

Unread post by nay-seven » 19 Jul 2010, 10:19

here a patch with exercises about array , maybe could help you, will be an addon one day i suppose when i complete it..
sorry for others but comments inside are French ...
download here


Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 19 Jul 2010, 12:55

Good one nay!

waolelaid
Member
Posts: 339
Location: Ecouen 95
Contact:

Unread post by waolelaid » 19 Jul 2010, 23:06

Hi all thank you for your fast and clear answers reading you begin to help me
to understand some functionality of them as explained by Clearscreen
and especially the one i dared not hope taken from the inexhaustible reserve of Nay
and in french it's incredible tonight i shall not fight with the dictionary
don't forget you Floego
thank you all once again
and have a nice night
Avant l'effet on croit à d'autres causes qu'après
Friedrich Nietzsche

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 19 Jul 2010, 23:13

well done nay!

I had started a patch as well with all classic uses: shift, swap/reverse, roll. but can't find it back..arf
one advice as mentioned by clearscreen for ya waleloid, is to start with an array (ie midiStepModule or array display or set),
draw some values then explore the array manipulations modules. ie

MidiStepArray Out -------> arrayIn of shift Array. arrayOut----------> array in of a new array "display or set",

that way you can visualize graphically what happen when you use/tweak the modules in between, that can help a
lot to understand.
also array works with math modules, including logical modules, as an exemple if you have 16 samplers runing with various
pitchs, and you want to transpose them all, there are various ways to do that, but you can collect all the pitchs to an array, then transpose them all of +1 or +12 or anynb by adding that nb to the array, using A+B, so that all individual values will be set once,
instead of setting each individual values.
one particularity of usine is also that Captions/text are arrays, the numbers correspond to letters. ie
if a word 'USINE' is a 5lengh array. if you use setArraySize and set a size of 3, it become 'USI'..

some basic exemples:

[1,2,3,4,5] original array length = 5
[3,4,5,6,7] if using A+B where B = 2
[1,2,3] if using setArray length with size = 3.
[3,4,5,0,0] if using shift array with a -2 shift
[3,4,5,1,2] if using rollArray with a -2 value
[5,4,3,2,1] if using swapArray
[1,2,8,4,5] if using SetArrayElmtValue : val=8, index = 2.
[1,2,3,3,3] if using ClipArray, max=3.

Min array will return the lowest value wich is 1
Min arrayPos will return the position of lowest value wich is index0
Max array will return the highest value wich is 5
Max arrayPos will return the position of highest value wich is index4 (remember index start from 0)
Mean array computes the median value, clipArray forces higher an lower limits, sumArray add all elements of the
array, ie here 1+2+3+4+5=15.

also Arrays works will logical modules, ie
[1,2,3,4,5]
[0,0,0,1,1] if using A>2.

so when you notice you are about to put Xtimes the same A+B, A<B, or any kind of transforms on lot of values,
often worth consider manipulate them as array, or if you play around with datamodules such as steps,lines,curves and
wanna make operations on all steps, ie divide them all by 2, ad a percent, swap ect...

waolelaid
Member
Posts: 339
Location: Ecouen 95
Contact:

Unread post by waolelaid » 21 Jul 2010, 21:19

good evening all , excuse me for my late answer but what a surprise when i opened
Nay's patch the first question which came in my head was how can i wire all those
arrays so i came back to the post and i printed the advices and method of clearscreen
and the one of the enthusiastic 23fx23 who became now a script programmer at first sight a little bit complicated
but also very instructive which completes the first i'm going to quietly study all those and hope i'll understand
thank you one more
wish you a good evening and night too (mine will be long ) ;)
regards
Avant l'effet on croit à d'autres causes qu'après
Friedrich Nietzsche

Clearscreen
Member
Posts: 482
Location: Australia
Contact:

Unread post by Clearscreen » 22 Jul 2010, 02:39

Good luck mate! Hope you make sense of it all! Arrays can be a pretty powerful tool once you work them out - should there be sticky with this kind of stuff collected in it? Or maybe Nays patch should be in the wiki?

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 120 guests