ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2012-07-02T10:58:22+02:00 https://brainmodular.com/forums/app.php/feed/topic/3509 2012-07-02T10:58:22+02:00 2012-07-02T10:58:22+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23792#p23792 <![CDATA[muddling up an array]]> GetDataArrayValue and a variable to get the min & max then set them back
or a GetMin equivalent to the GetLength we have yet

definitively need a parallel life...;)

Statistics: Posted by nay-seven — 02 Jul 2012, 10:58


]]>
2012-07-02T09:28:51+02:00 2012-07-02T09:28:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23791#p23791 <![CDATA[muddling up an array]]>
Made minor change so that Array Out is now saved in patch as was not being restored before.

CODE:

//////////////////////////////////////////////// Randomly reorders data in array // Version 1.01// 2 July 2012// By Caco//////////////////////////////////////////////var ArrayIn, ButtonIn, ArrayOut &#58; tparameter;///////////////////////////////////////////////procedure init;begin   ArrayIn&#58;= CreateParam&#40;'Array in',ptarray&#41;; SetisOutput&#40;ArrayIn,false&#41;; ButtonIn&#58;= CreateParam&#40;'Shuffle',ptbutton&#41;; SetisOutput&#40;ButtonIn,false&#41;; Arrayout&#58;= CreateParam&#40;'Array out',ptarray&#41;; Setisinput&#40;ArrayOut,false&#41;;  SetMin       &#40;ArrayIn, 1.4e-45&#41;;     // set min parameter value SetMax       &#40;ArrayIn, 3.4e38&#41;;     // set max parameter value SetMin       &#40;ArrayOut, 1.4e-45&#41;;     // set min parameter value SetMax       &#40;ArrayOut, 3.4e38&#41;;     // set max parameter value SetDontSave  &#40;ArrayOut, FALSE&#41;;end;//////////////////////////////////////Procedure Callback&#40;N&#58;integer&#41;; Var i, j &#58; Integer;Var temp &#58; real;begin    if &#40;N=ButtonIn&#41;  then begin        for i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do begin            SetDataArrayValue&#40;ArrayOut, i, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;;        end;            SetLength&#40;ArrayOut,  GetLength&#40;ArrayIn&#41;&#41;;        for i&#58;= GetLength&#40;ArrayOut&#41;-1 downto 0 do begin            j &#58;= random&#40;i&#41;;            temp &#58;= GetDataArrayValue&#40;ArrayOut, j&#41;;            SetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayOut, i&#41;&#41;;            SetDataArrayValue&#40;ArrayOut, i, temp&#41;;        end;       end;end;

Statistics: Posted by caco — 02 Jul 2012, 09:28


]]>
2012-07-01T16:24:53+02:00 2012-07-01T16:24:53+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23788#p23788 <![CDATA[muddling up an array]]> i suppose we need here 2 variable , min and max and get their value from the first array..?

but it's not a big deal , so don't waste time for this if you don't have..

Statistics: Posted by nay-seven — 01 Jul 2012, 16:24


]]>
2012-07-01T13:19:09+02:00 2012-07-01T13:19:09+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23787#p23787 <![CDATA[muddling up an array]]>

CODE:

var ArrayIn, ButtonIn, ArrayOut &#58; tparameter;///////////////////////////////////////////////procedure init;begin   ArrayIn&#58;= CreateParam&#40;'Array in',ptarray&#41;; SetisOutput&#40;ArrayIn,false&#41;; ButtonIn&#58;= CreateParam&#40;'Shuffle',ptbutton&#41;; SetisOutput&#40;ButtonIn,false&#41;; Arrayout&#58;= CreateParam&#40;'Arrayout',ptarray&#41;; Setisinput&#40;ArrayOut,false&#41;;  SetMin   &#40;ArrayIn, 1.4e-45&#41;;     // set min parameter value SetMax   &#40;ArrayIn, 3.4e38&#41;;     // set max parameter value SetMin   &#40;ArrayOut, 1.4e-45&#41;;     // set min parameter value SetMax   &#40;ArrayOut, 3.4e38&#41;;     // set max parameter valueend;//////////////////////////////////////Procedure Callback&#40;N&#58;integer&#41;; Var i, j &#58; Integer;Var temp &#58; real;begin    if &#40;N=ButtonIn&#41;  then begin        for i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do begin            SetDataArrayValue&#40;ArrayOut, i, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;;        end;            SetLength&#40;ArrayOut,  GetLength&#40;ArrayIn&#41;&#41;;        for i&#58;= GetLength&#40;ArrayOut&#41;-1 downto 0 do begin            j &#58;= random&#40;i&#41;;            temp &#58;= GetDataArrayValue&#40;ArrayOut, j&#41;;            SetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayOut, i&#41;&#41;;            SetDataArrayValue&#40;ArrayOut, i, temp&#41;;        end;       end;end;

Statistics: Posted by caco — 01 Jul 2012, 13:19


]]>
2012-06-29T21:45:28+02:00 2012-06-29T21:45:28+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23786#p23786 <![CDATA[muddling up an array]]>
yes, but i just realize that modules like swap or shift array don't get (and set) those values automatically , so maybe it's normal ..?
In that case I suspect array in and out ranges have default of 0-100 and just need modifying.

Statistics: Posted by caco — 29 Jun 2012, 21:45


]]>
2012-06-29T21:32:26+02:00 2012-06-29T21:32:26+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23785#p23785 <![CDATA[muddling up an array]]> Statistics: Posted by nay-seven — 29 Jun 2012, 21:32


]]>
2012-06-29T21:21:59+02:00 2012-06-29T21:21:59+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23784#p23784 <![CDATA[muddling up an array]]>
works fine Caco, but only for array with min=0, max=100
if not you have to set those values manually
How strange, just to check you mean min and max value in array between 0-100? Will try and work out where I went wrong!

Statistics: Posted by caco — 29 Jun 2012, 21:21


]]>
2012-06-29T16:54:25+02:00 2012-06-29T16:54:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23782#p23782 <![CDATA[muddling up an array]]> Leaving for the weekend, so i will test it more on monday,
now able to share a 'midi stochastic seq' in my midi harmonizing tools patch.
Thank you caco.

Statistics: Posted by Fléau — 29 Jun 2012, 16:54


]]>
2012-06-29T16:48:38+02:00 2012-06-29T16:48:38+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23781#p23781 <![CDATA[muddling up an array]]> if not you have to set those values manually

Statistics: Posted by nay-seven — 29 Jun 2012, 16:48


]]>
2012-06-29T16:34:44+02:00 2012-06-29T16:34:44+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23780#p23780 <![CDATA[muddling up an array]]>

CODE:

var ArrayIn, ButtonIn, ArrayOut &#58; tparameter;///////////////////////////////////////////////procedure init;begin   ArrayIn&#58;= CreateParam&#40;'Array in',ptarray&#41;; SetisOutput&#40;ArrayIn,false&#41;; ButtonIn&#58;= CreateParam&#40;'Shuffle',ptbutton&#41;; SetisOutput&#40;ButtonIn,false&#41;; Arrayout&#58;= CreateParam&#40;'Arrayout',ptarray&#41;; Setisinput&#40;ArrayOut,false&#41;; end;//////////////////////////////////////Procedure Callback&#40;N&#58;integer&#41;; Var i, j &#58; Integer;Var temp &#58; real;begin    if &#40;N=ButtonIn&#41;  then begin        for i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do begin            SetDataArrayValue&#40;ArrayOut, i, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;;        end;            SetLength&#40;ArrayOut,  GetLength&#40;ArrayIn&#41;&#41;;        for i&#58;= GetLength&#40;ArrayOut&#41;-1 downto 0 do begin            j &#58;= random&#40;i&#41;;            temp &#58;= GetDataArrayValue&#40;ArrayOut, j&#41;;            SetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayOut, i&#41;&#41;;            SetDataArrayValue&#40;ArrayOut, i, temp&#41;;        end;       end;end;

Statistics: Posted by caco — 29 Jun 2012, 16:34


]]>
2012-06-29T16:15:02+02:00 2012-06-29T16:15:02+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23779#p23779 <![CDATA[muddling up an array]]> Statistics: Posted by nay-seven — 29 Jun 2012, 16:15


]]>
2012-06-29T12:48:23+02:00 2012-06-29T12:48:23+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23777#p23777 <![CDATA[muddling up an array]]> like 1/2/3/4/5/6/7/8 to 6/4/5/2/3/1/8/7 (inverse of the 'sort array' module)?

Statistics: Posted by Fléau — 29 Jun 2012, 12:48


]]>
BrainModular BrainModular Users Forum 2012-07-02T10:58:22+02:00 https://brainmodular.com/forums/app.php/feed/topic/3509 2012-07-02T10:58:22+02:00 2012-07-02T10:58:22+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23792#p23792 <![CDATA[muddling up an array]]> GetDataArrayValue and a variable to get the min & max then set them back
or a GetMin equivalent to the GetLength we have yet

definitively need a parallel life...;)

Statistics: Posted by nay-seven — 02 Jul 2012, 10:58


]]>
2012-07-02T09:28:51+02:00 2012-07-02T09:28:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23791#p23791 <![CDATA[muddling up an array]]>
Made minor change so that Array Out is now saved in patch as was not being restored before.

CODE:

//////////////////////////////////////////////// Randomly reorders data in array // Version 1.01// 2 July 2012// By Caco//////////////////////////////////////////////var ArrayIn, ButtonIn, ArrayOut &#58; tparameter;///////////////////////////////////////////////procedure init;begin   ArrayIn&#58;= CreateParam&#40;'Array in',ptarray&#41;; SetisOutput&#40;ArrayIn,false&#41;; ButtonIn&#58;= CreateParam&#40;'Shuffle',ptbutton&#41;; SetisOutput&#40;ButtonIn,false&#41;; Arrayout&#58;= CreateParam&#40;'Array out',ptarray&#41;; Setisinput&#40;ArrayOut,false&#41;;  SetMin       &#40;ArrayIn, 1.4e-45&#41;;     // set min parameter value SetMax       &#40;ArrayIn, 3.4e38&#41;;     // set max parameter value SetMin       &#40;ArrayOut, 1.4e-45&#41;;     // set min parameter value SetMax       &#40;ArrayOut, 3.4e38&#41;;     // set max parameter value SetDontSave  &#40;ArrayOut, FALSE&#41;;end;//////////////////////////////////////Procedure Callback&#40;N&#58;integer&#41;; Var i, j &#58; Integer;Var temp &#58; real;begin    if &#40;N=ButtonIn&#41;  then begin        for i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do begin            SetDataArrayValue&#40;ArrayOut, i, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;;        end;            SetLength&#40;ArrayOut,  GetLength&#40;ArrayIn&#41;&#41;;        for i&#58;= GetLength&#40;ArrayOut&#41;-1 downto 0 do begin            j &#58;= random&#40;i&#41;;            temp &#58;= GetDataArrayValue&#40;ArrayOut, j&#41;;            SetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayOut, i&#41;&#41;;            SetDataArrayValue&#40;ArrayOut, i, temp&#41;;        end;       end;end;

Statistics: Posted by caco — 02 Jul 2012, 09:28


]]>
2012-07-01T16:24:53+02:00 2012-07-01T16:24:53+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23788#p23788 <![CDATA[muddling up an array]]> i suppose we need here 2 variable , min and max and get their value from the first array..?

but it's not a big deal , so don't waste time for this if you don't have..

Statistics: Posted by nay-seven — 01 Jul 2012, 16:24


]]>
2012-07-01T13:19:09+02:00 2012-07-01T13:19:09+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23787#p23787 <![CDATA[muddling up an array]]>

CODE:

var ArrayIn, ButtonIn, ArrayOut &#58; tparameter;///////////////////////////////////////////////procedure init;begin   ArrayIn&#58;= CreateParam&#40;'Array in',ptarray&#41;; SetisOutput&#40;ArrayIn,false&#41;; ButtonIn&#58;= CreateParam&#40;'Shuffle',ptbutton&#41;; SetisOutput&#40;ButtonIn,false&#41;; Arrayout&#58;= CreateParam&#40;'Arrayout',ptarray&#41;; Setisinput&#40;ArrayOut,false&#41;;  SetMin   &#40;ArrayIn, 1.4e-45&#41;;     // set min parameter value SetMax   &#40;ArrayIn, 3.4e38&#41;;     // set max parameter value SetMin   &#40;ArrayOut, 1.4e-45&#41;;     // set min parameter value SetMax   &#40;ArrayOut, 3.4e38&#41;;     // set max parameter valueend;//////////////////////////////////////Procedure Callback&#40;N&#58;integer&#41;; Var i, j &#58; Integer;Var temp &#58; real;begin    if &#40;N=ButtonIn&#41;  then begin        for i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do begin            SetDataArrayValue&#40;ArrayOut, i, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;;        end;            SetLength&#40;ArrayOut,  GetLength&#40;ArrayIn&#41;&#41;;        for i&#58;= GetLength&#40;ArrayOut&#41;-1 downto 0 do begin            j &#58;= random&#40;i&#41;;            temp &#58;= GetDataArrayValue&#40;ArrayOut, j&#41;;            SetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayOut, i&#41;&#41;;            SetDataArrayValue&#40;ArrayOut, i, temp&#41;;        end;       end;end;

Statistics: Posted by caco — 01 Jul 2012, 13:19


]]>
2012-06-29T21:45:28+02:00 2012-06-29T21:45:28+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23786#p23786 <![CDATA[muddling up an array]]>
yes, but i just realize that modules like swap or shift array don't get (and set) those values automatically , so maybe it's normal ..?
In that case I suspect array in and out ranges have default of 0-100 and just need modifying.

Statistics: Posted by caco — 29 Jun 2012, 21:45


]]>
2012-06-29T21:32:26+02:00 2012-06-29T21:32:26+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23785#p23785 <![CDATA[muddling up an array]]> Statistics: Posted by nay-seven — 29 Jun 2012, 21:32


]]>
2012-06-29T21:21:59+02:00 2012-06-29T21:21:59+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23784#p23784 <![CDATA[muddling up an array]]>
works fine Caco, but only for array with min=0, max=100
if not you have to set those values manually
How strange, just to check you mean min and max value in array between 0-100? Will try and work out where I went wrong!

Statistics: Posted by caco — 29 Jun 2012, 21:21


]]>
2012-06-29T16:54:25+02:00 2012-06-29T16:54:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23782#p23782 <![CDATA[muddling up an array]]> Leaving for the weekend, so i will test it more on monday,
now able to share a 'midi stochastic seq' in my midi harmonizing tools patch.
Thank you caco.

Statistics: Posted by Fléau — 29 Jun 2012, 16:54


]]>
2012-06-29T16:48:38+02:00 2012-06-29T16:48:38+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23781#p23781 <![CDATA[muddling up an array]]> if not you have to set those values manually

Statistics: Posted by nay-seven — 29 Jun 2012, 16:48


]]>
2012-06-29T16:34:44+02:00 2012-06-29T16:34:44+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23780#p23780 <![CDATA[muddling up an array]]>

CODE:

var ArrayIn, ButtonIn, ArrayOut &#58; tparameter;///////////////////////////////////////////////procedure init;begin   ArrayIn&#58;= CreateParam&#40;'Array in',ptarray&#41;; SetisOutput&#40;ArrayIn,false&#41;; ButtonIn&#58;= CreateParam&#40;'Shuffle',ptbutton&#41;; SetisOutput&#40;ButtonIn,false&#41;; Arrayout&#58;= CreateParam&#40;'Arrayout',ptarray&#41;; Setisinput&#40;ArrayOut,false&#41;; end;//////////////////////////////////////Procedure Callback&#40;N&#58;integer&#41;; Var i, j &#58; Integer;Var temp &#58; real;begin    if &#40;N=ButtonIn&#41;  then begin        for i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do begin            SetDataArrayValue&#40;ArrayOut, i, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;;        end;            SetLength&#40;ArrayOut,  GetLength&#40;ArrayIn&#41;&#41;;        for i&#58;= GetLength&#40;ArrayOut&#41;-1 downto 0 do begin            j &#58;= random&#40;i&#41;;            temp &#58;= GetDataArrayValue&#40;ArrayOut, j&#41;;            SetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayOut, i&#41;&#41;;            SetDataArrayValue&#40;ArrayOut, i, temp&#41;;        end;       end;end;

Statistics: Posted by caco — 29 Jun 2012, 16:34


]]>
2012-06-29T16:15:02+02:00 2012-06-29T16:15:02+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23779#p23779 <![CDATA[muddling up an array]]> Statistics: Posted by nay-seven — 29 Jun 2012, 16:15


]]>
2012-06-29T12:48:23+02:00 2012-06-29T12:48:23+02:00 https://brainmodular.com/forums/viewtopic.php?t=3509&p=23777#p23777 <![CDATA[muddling up an array]]> like 1/2/3/4/5/6/7/8 to 6/4/5/2/3/1/8/7 (inverse of the 'sort array' module)?

Statistics: Posted by Fléau — 29 Jun 2012, 12:48


]]>