ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2015-03-04T16:33:25+02:00 https://brainmodular.com/forums/app.php/feed/topic/4693 2015-03-04T16:33:25+02:00 2015-03-04T16:33:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31463#p31463 <![CDATA["one-shot" script output parameters]]>
For reference to others:
1. Switch triggers callback and records the value of the switch,
2. PAD_CHANGE increments the length of messages and updates my second array,
3. Process provides counter to shut off Midi after sending the messages based on my second array.


I just wish I could send a message as a one-shot without having to execute another block, then you could place anywhere easily without the counter.

CODE:

procedure callback &#40;n&#58;integer&#41;;Begin        Case n of         //Go to Pad_Change          pad&#58;begin               j&#58;=1;             pad_array_values&#91;0&#93; &#58;= round&#40;getvalue&#40;pad&#41;&#41;;              PAD_CHANGE;           end;                                                                                         end;                    End;

CODE:

procedure PAD_CHANGE;Begin   for i&#58;=0 to 15 do begin     if pad_Array_Values&#91;i&#93; = 127 then begin   pad_Array_B&#91;i&#93;&#58;=127;   lngthMidi&#58;=lngthMidi+1;    end  else begin      pad_Array_B&#91;i&#93;&#58;=0;   lngthMidi&#58;=lngthMidi+1;  end;  end;                             End;

CODE:

procedure process;Begin                                                                                             if j=2 then begin       j&#58;=0;       lngthMidi&#58;=0;      end        else begin        if j=1 then inc&#40;j&#41;;       end;                                                       x&#58;=20;              if lngthMidi > 0      then begin                                  for i &#58;= 0 to lngthMidi-1     do begin             ReceivedMidi.msg &#58;= 176;      ReceivedMidi.data1 &#58;= x;      ReceivedMidi.data2 &#58;= pad_Array_B&#91;i&#93;;      ReceivedMidi.channel &#58;= 3;                    SetMidiArrayValue&#40;MidiOut,i,ReceivedMidi&#41;;                    x&#58;=x+1;               end;                         SetLength&#40;MidiOut,lngthMidi&#41;;    end    else SetLength&#40;MidiOut,0&#41;;            End;

Statistics: Posted by sephult — 04 Mar 2015, 15:33


]]>
2015-03-04T16:17:03+02:00 2015-03-04T16:17:03+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31462#p31462 <![CDATA["one-shot" script output parameters]]>
Yes I am triggering from a switch, recording the value in callback, then setting the length as a fixed value (not from midi input) based on updating an external controller.
The midi procedure is within a user-defined procedure.
I will have to revisit and rework, I was thinking the same thing but trying to avoid rewrite.

Regardless I guess my point in regards isn't just a scripting help, but the complexity of sending a one-shot message.
Although I know I will figure it out (with your great help of course, bsork), it just seems overly complicated to perform a simple and basic function that Usine presents.

The scripting engine could use some efficiency and easier methods to do basic functions. I love using it, I just think that it could be simplified.

-S

Statistics: Posted by sephult — 04 Mar 2015, 15:17


]]>
2015-03-04T16:07:35+02:00 2015-03-04T16:07:35+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31461#p31461 <![CDATA["one-shot" script output parameters]]>
Within a block, Process is executed after any callbacks, so you cannot just check the length and set it to 0. The problem can be solved in several ways - one example is to use a global integer value as a counter: When updating the array from Callback, set the counter to 1, and then in Process check the counter. If it is 1, increment to 2, if it is 2, set both array length and the counter to 0.

Statistics: Posted by bsork — 04 Mar 2015, 15:07


]]>
2015-03-04T15:23:40+02:00 2015-03-04T15:23:40+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31460#p31460 <![CDATA["one-shot" script output parameters]]> The confusion almost makes me want to rewrite and just trigger using Create MIDI, because I can get a one-shot message at least.

-S

Statistics: Posted by sephult — 04 Mar 2015, 14:23


]]>
2015-03-04T15:07:55+02:00 2015-03-04T15:07:55+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31459#p31459 <![CDATA["one-shot" script output parameters]]>
So the last SetLength(MidiOut,0), was my intention to get the message flow to stop. (This prevents message from even sending).

Without this the messages do send, but continuously and not one-shot.

-S

Statistics: Posted by sephult — 04 Mar 2015, 14:07


]]>
2015-03-04T15:01:40+02:00 2015-03-04T15:01:40+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31458#p31458 <![CDATA["one-shot" script output parameters]]>
BTW, you don't have to set the length before you fill the array. In this case I suppose you are sending as many messages as you get in, so you have the number anyway, but in other cases the script can create X messages in a block, and you can wait until the array is filled before using SetLength. Very handy :)

Statistics: Posted by bsork — 04 Mar 2015, 14:01


]]>
2015-03-04T14:52:30+02:00 2015-03-04T14:52:30+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31457#p31457 <![CDATA["one-shot" script output parameters]]> Logically this should work, these kind of one-shot messages or parameters are what gives me the most problems.

CODE:

if lngthMidi > 0      then begin                                 SetLength&#40;MidiOut,lngthMidi&#41;;          for i &#58;= 0 to lngthMidi-1     do begin                  ReceivedMidi.msg &#58;= 176;      ReceivedMidi.data1 &#58;= x;      ReceivedMidi.data2 &#58;= pad_Array_B&#91;i&#93;;      ReceivedMidi.channel &#58;= 3;                           SetMidiArrayValue&#40;MidiOut,i,ReceivedMidi&#41;;                    x&#58;=x+1;               end;                    end                   else SetLength&#40;MidiOut,0&#41;;    SetLength&#40;MidiOut,0&#41;;

Statistics: Posted by sephult — 04 Mar 2015, 13:52


]]>
2015-03-04T14:44:15+02:00 2015-03-04T14:44:15+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31455#p31455 <![CDATA["one-shot" script output parameters]]>
It's probably just me at the moment, I am setting the message and then after set to length 0, it seems in the context though I am not setting my loop up right.
So in most cases the midi is read in and sets the length. I am just wanting to generate, so I always seem to fumble around with trying to get the message to stop.

I am taking another shot (no pun intended) at it this morning, if anyone has any examples I would appreciate. I cant seem to find my examples I made before.

-S

Statistics: Posted by sephult — 04 Mar 2015, 13:44


]]>
2015-03-04T09:18:20+02:00 2015-03-04T09:18:20+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31448#p31448 <![CDATA["one-shot" script output parameters]]> Statistics: Posted by bsork — 04 Mar 2015, 08:18


]]>
2015-03-04T03:17:56+02:00 2015-03-04T03:17:56+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31447#p31447 <![CDATA["one-shot" script output parameters]]> I do find myself getting stuck trying to only send the message once, and every time I try to set the length to 0 it wont even send.

I am going to have to second..... some better solution.
I know I've done it before, just seems so cumbersome to do something simple like send a common midi message.

-S

Statistics: Posted by sephult — 04 Mar 2015, 02:17


]]>
2015-03-03T15:32:56+02:00 2015-03-03T15:32:56+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31442#p31442 <![CDATA["one-shot" script output parameters]]> Simon.

Statistics: Posted by sm_jamieson — 03 Mar 2015, 14:32


]]>
2015-02-14T14:07:50+02:00 2015-02-14T14:07:50+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31288#p31288 <![CDATA["one-shot" script output parameters]]> But it's normally very easy to avoid?

for example

CODE:

Procedure Process;begin  if MyCondition  then  setValue&#40;param,1&#41;  else SetLength&#40;param,-1&#41;;end;
Your solution is not so easy to implement and will make heavy the overall script engine for very specific needs.
So I don't know?
senso+++

Statistics: Posted by senso — 14 Feb 2015, 13:07


]]>
2015-02-13T11:50:45+02:00 2015-02-13T11:50:45+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31273#p31273 <![CDATA["one-shot" script output parameters]]> Statistics: Posted by sm_jamieson — 13 Feb 2015, 10:50


]]>
2015-02-10T21:41:17+02:00 2015-02-10T21:41:17+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31243#p31243 <![CDATA["one-shot" script output parameters]]>
I agree with the difficulty in setting values concurrently within a script. Writing an event-driven control such as setting a value from 3 to 4 to 5 to 0 concurrently does not seem very straight-forward, and during the process you find the output only to remain at 0 and have never seen any of the other values.

As far as the types such as setting an output type to a PtButton, I would like to assume that the output would act like a button. Set the value and the output One-Shots like a button similar to how you describe.

Possibly modifying so an output type of PtButton can One-Shot, where the Min/Max values could be assigned. I don't know the difficulty, but possibly a time setting as well for the transition?

Like the following for a one-shot?
Type PtButton
Procedure ButtonRange(min,max)
Procedure ButtonDelay(ms)

-S

Statistics: Posted by sephult — 10 Feb 2015, 20:41


]]>
2015-02-10T19:14:02+02:00 2015-02-10T19:14:02+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31241#p31241 <![CDATA["one-shot" script output parameters]]> You can rig up various modules to the script to just about achieve the same thing, but it is very clumsy.
NOTE: the "Pass If Changed" module lacks in one vital aspect - often you want to send the same value you sent last time !

I suggest new functionality in Usine to make this easier.

The script Parameters should have a new "one-shot" property. When this is set, the output will be set to length zero (parameter OFF) on creation. Then any SetValue() on this output will causes the output to appear on the wire for 1 processing cycle before the output length is set back to zero (OFF). When the output is switched ON by Usine, it should set the output length to 1 if the user has not set it to some other value (this would be needed to output a set of midi messages).

The new "one-shot" property should also be settable independently at various points in a script. e.g. SetParamOneShot(paramnumber, true).

Thanks,
Simon.

Statistics: Posted by sm_jamieson — 10 Feb 2015, 18:14


]]>
BrainModular BrainModular Users Forum 2015-03-04T16:33:25+02:00 https://brainmodular.com/forums/app.php/feed/topic/4693 2015-03-04T16:33:25+02:00 2015-03-04T16:33:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31463#p31463 <![CDATA["one-shot" script output parameters]]>
For reference to others:
1. Switch triggers callback and records the value of the switch,
2. PAD_CHANGE increments the length of messages and updates my second array,
3. Process provides counter to shut off Midi after sending the messages based on my second array.


I just wish I could send a message as a one-shot without having to execute another block, then you could place anywhere easily without the counter.

CODE:

procedure callback &#40;n&#58;integer&#41;;Begin        Case n of         //Go to Pad_Change          pad&#58;begin               j&#58;=1;             pad_array_values&#91;0&#93; &#58;= round&#40;getvalue&#40;pad&#41;&#41;;              PAD_CHANGE;           end;                                                                                         end;                    End;

CODE:

procedure PAD_CHANGE;Begin   for i&#58;=0 to 15 do begin     if pad_Array_Values&#91;i&#93; = 127 then begin   pad_Array_B&#91;i&#93;&#58;=127;   lngthMidi&#58;=lngthMidi+1;    end  else begin      pad_Array_B&#91;i&#93;&#58;=0;   lngthMidi&#58;=lngthMidi+1;  end;  end;                             End;

CODE:

procedure process;Begin                                                                                             if j=2 then begin       j&#58;=0;       lngthMidi&#58;=0;      end        else begin        if j=1 then inc&#40;j&#41;;       end;                                                       x&#58;=20;              if lngthMidi > 0      then begin                                  for i &#58;= 0 to lngthMidi-1     do begin             ReceivedMidi.msg &#58;= 176;      ReceivedMidi.data1 &#58;= x;      ReceivedMidi.data2 &#58;= pad_Array_B&#91;i&#93;;      ReceivedMidi.channel &#58;= 3;                    SetMidiArrayValue&#40;MidiOut,i,ReceivedMidi&#41;;                    x&#58;=x+1;               end;                         SetLength&#40;MidiOut,lngthMidi&#41;;    end    else SetLength&#40;MidiOut,0&#41;;            End;

Statistics: Posted by sephult — 04 Mar 2015, 15:33


]]>
2015-03-04T16:17:03+02:00 2015-03-04T16:17:03+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31462#p31462 <![CDATA["one-shot" script output parameters]]>
Yes I am triggering from a switch, recording the value in callback, then setting the length as a fixed value (not from midi input) based on updating an external controller.
The midi procedure is within a user-defined procedure.
I will have to revisit and rework, I was thinking the same thing but trying to avoid rewrite.

Regardless I guess my point in regards isn't just a scripting help, but the complexity of sending a one-shot message.
Although I know I will figure it out (with your great help of course, bsork), it just seems overly complicated to perform a simple and basic function that Usine presents.

The scripting engine could use some efficiency and easier methods to do basic functions. I love using it, I just think that it could be simplified.

-S

Statistics: Posted by sephult — 04 Mar 2015, 15:17


]]>
2015-03-04T16:07:35+02:00 2015-03-04T16:07:35+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31461#p31461 <![CDATA["one-shot" script output parameters]]>
Within a block, Process is executed after any callbacks, so you cannot just check the length and set it to 0. The problem can be solved in several ways - one example is to use a global integer value as a counter: When updating the array from Callback, set the counter to 1, and then in Process check the counter. If it is 1, increment to 2, if it is 2, set both array length and the counter to 0.

Statistics: Posted by bsork — 04 Mar 2015, 15:07


]]>
2015-03-04T15:23:40+02:00 2015-03-04T15:23:40+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31460#p31460 <![CDATA["one-shot" script output parameters]]> The confusion almost makes me want to rewrite and just trigger using Create MIDI, because I can get a one-shot message at least.

-S

Statistics: Posted by sephult — 04 Mar 2015, 14:23


]]>
2015-03-04T15:07:55+02:00 2015-03-04T15:07:55+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31459#p31459 <![CDATA["one-shot" script output parameters]]>
So the last SetLength(MidiOut,0), was my intention to get the message flow to stop. (This prevents message from even sending).

Without this the messages do send, but continuously and not one-shot.

-S

Statistics: Posted by sephult — 04 Mar 2015, 14:07


]]>
2015-03-04T15:01:40+02:00 2015-03-04T15:01:40+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31458#p31458 <![CDATA["one-shot" script output parameters]]>
BTW, you don't have to set the length before you fill the array. In this case I suppose you are sending as many messages as you get in, so you have the number anyway, but in other cases the script can create X messages in a block, and you can wait until the array is filled before using SetLength. Very handy :)

Statistics: Posted by bsork — 04 Mar 2015, 14:01


]]>
2015-03-04T14:52:30+02:00 2015-03-04T14:52:30+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31457#p31457 <![CDATA["one-shot" script output parameters]]> Logically this should work, these kind of one-shot messages or parameters are what gives me the most problems.

CODE:

if lngthMidi > 0      then begin                                 SetLength&#40;MidiOut,lngthMidi&#41;;          for i &#58;= 0 to lngthMidi-1     do begin                  ReceivedMidi.msg &#58;= 176;      ReceivedMidi.data1 &#58;= x;      ReceivedMidi.data2 &#58;= pad_Array_B&#91;i&#93;;      ReceivedMidi.channel &#58;= 3;                           SetMidiArrayValue&#40;MidiOut,i,ReceivedMidi&#41;;                    x&#58;=x+1;               end;                    end                   else SetLength&#40;MidiOut,0&#41;;    SetLength&#40;MidiOut,0&#41;;

Statistics: Posted by sephult — 04 Mar 2015, 13:52


]]>
2015-03-04T14:44:15+02:00 2015-03-04T14:44:15+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31455#p31455 <![CDATA["one-shot" script output parameters]]>
It's probably just me at the moment, I am setting the message and then after set to length 0, it seems in the context though I am not setting my loop up right.
So in most cases the midi is read in and sets the length. I am just wanting to generate, so I always seem to fumble around with trying to get the message to stop.

I am taking another shot (no pun intended) at it this morning, if anyone has any examples I would appreciate. I cant seem to find my examples I made before.

-S

Statistics: Posted by sephult — 04 Mar 2015, 13:44


]]>
2015-03-04T09:18:20+02:00 2015-03-04T09:18:20+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31448#p31448 <![CDATA["one-shot" script output parameters]]> Statistics: Posted by bsork — 04 Mar 2015, 08:18


]]>
2015-03-04T03:17:56+02:00 2015-03-04T03:17:56+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31447#p31447 <![CDATA["one-shot" script output parameters]]> I do find myself getting stuck trying to only send the message once, and every time I try to set the length to 0 it wont even send.

I am going to have to second..... some better solution.
I know I've done it before, just seems so cumbersome to do something simple like send a common midi message.

-S

Statistics: Posted by sephult — 04 Mar 2015, 02:17


]]>
2015-03-03T15:32:56+02:00 2015-03-03T15:32:56+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31442#p31442 <![CDATA["one-shot" script output parameters]]> Simon.

Statistics: Posted by sm_jamieson — 03 Mar 2015, 14:32


]]>
2015-02-14T14:07:50+02:00 2015-02-14T14:07:50+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31288#p31288 <![CDATA["one-shot" script output parameters]]> But it's normally very easy to avoid?

for example

CODE:

Procedure Process;begin  if MyCondition  then  setValue&#40;param,1&#41;  else SetLength&#40;param,-1&#41;;end;
Your solution is not so easy to implement and will make heavy the overall script engine for very specific needs.
So I don't know?
senso+++

Statistics: Posted by senso — 14 Feb 2015, 13:07


]]>
2015-02-13T11:50:45+02:00 2015-02-13T11:50:45+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31273#p31273 <![CDATA["one-shot" script output parameters]]> Statistics: Posted by sm_jamieson — 13 Feb 2015, 10:50


]]>
2015-02-10T21:41:17+02:00 2015-02-10T21:41:17+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31243#p31243 <![CDATA["one-shot" script output parameters]]>
I agree with the difficulty in setting values concurrently within a script. Writing an event-driven control such as setting a value from 3 to 4 to 5 to 0 concurrently does not seem very straight-forward, and during the process you find the output only to remain at 0 and have never seen any of the other values.

As far as the types such as setting an output type to a PtButton, I would like to assume that the output would act like a button. Set the value and the output One-Shots like a button similar to how you describe.

Possibly modifying so an output type of PtButton can One-Shot, where the Min/Max values could be assigned. I don't know the difficulty, but possibly a time setting as well for the transition?

Like the following for a one-shot?
Type PtButton
Procedure ButtonRange(min,max)
Procedure ButtonDelay(ms)

-S

Statistics: Posted by sephult — 10 Feb 2015, 20:41


]]>
2015-02-10T19:14:02+02:00 2015-02-10T19:14:02+02:00 https://brainmodular.com/forums/viewtopic.php?t=4693&p=31241#p31241 <![CDATA["one-shot" script output parameters]]> You can rig up various modules to the script to just about achieve the same thing, but it is very clumsy.
NOTE: the "Pass If Changed" module lacks in one vital aspect - often you want to send the same value you sent last time !

I suggest new functionality in Usine to make this easier.

The script Parameters should have a new "one-shot" property. When this is set, the output will be set to length zero (parameter OFF) on creation. Then any SetValue() on this output will causes the output to appear on the wire for 1 processing cycle before the output length is set back to zero (OFF). When the output is switched ON by Usine, it should set the output length to 1 if the user has not set it to some other value (this would be needed to output a set of midi messages).

The new "one-shot" property should also be settable independently at various points in a script. e.g. SetParamOneShot(paramnumber, true).

Thanks,
Simon.

Statistics: Posted by sm_jamieson — 10 Feb 2015, 18:14


]]>