ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray
BrainModularBrainModular Users Forum2015-03-04T16:33:25+02:00https://brainmodular.com/forums/app.php/feed/topic/46932015-03-04T16:33:25+02:002015-03-04T16:33:25+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31463#p31463 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 (n:integer);Begin Case n of //Go to Pad_Change pad:begin j:=1; pad_array_values[0] := round(getvalue(pad)); PAD_CHANGE; end; end; End;
CODE:
procedure PAD_CHANGE;Begin for i:=0 to 15 do begin if pad_Array_Values[i] = 127 then begin pad_Array_B[i]:=127; lngthMidi:=lngthMidi+1; end else begin pad_Array_B[i]:=0; lngthMidi:=lngthMidi+1; end; end; End;
CODE:
procedure process;Begin if j=2 then begin j:=0; lngthMidi:=0; end else begin if j=1 then inc(j); end; x:=20; if lngthMidi > 0 then begin for i := 0 to lngthMidi-1 do begin ReceivedMidi.msg := 176; ReceivedMidi.data1 := x; ReceivedMidi.data2 := pad_Array_B[i]; ReceivedMidi.channel := 3; SetMidiArrayValue(MidiOut,i,ReceivedMidi); x:=x+1; end; SetLength(MidiOut,lngthMidi); end else SetLength(MidiOut,0); End;
Statistics: Posted by sephult — 04 Mar 2015, 15:33
]]>2015-03-04T16:17:03+02:002015-03-04T16:17:03+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31462#p31462 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:002015-03-04T16:07:35+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31461#p31461 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.
]]>2015-03-04T15:23:40+02:002015-03-04T15:23:40+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31460#p31460The 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:002015-03-04T15:07:55+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31459#p31459 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:002015-03-04T15:01:40+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31458#p31458 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
]]>2015-03-04T14:52:30+02:002015-03-04T14:52:30+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31457#p31457Logically 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(MidiOut,lngthMidi); for i := 0 to lngthMidi-1 do begin ReceivedMidi.msg := 176; ReceivedMidi.data1 := x; ReceivedMidi.data2 := pad_Array_B[i]; ReceivedMidi.channel := 3; SetMidiArrayValue(MidiOut,i,ReceivedMidi); x:=x+1; end; end else SetLength(MidiOut,0); SetLength(MidiOut,0);
Statistics: Posted by sephult — 04 Mar 2015, 13:52
]]>2015-03-04T14:44:15+02:002015-03-04T14:44:15+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31455#p31455 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:002015-03-04T09:18:20+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31448#p31448Statistics: Posted by bsork — 04 Mar 2015, 08:18
]]>
2015-03-04T03:17:56+02:002015-03-04T03:17:56+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31447#p31447I 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
Statistics: Posted by sm_jamieson — 03 Mar 2015, 14:32
]]>2015-02-14T14:07:50+02:002015-02-14T14:07:50+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31288#p31288But it's normally very easy to avoid?
for example
CODE:
Procedure Process;begin if MyCondition then setValue(param,1) else SetLength(param,-1);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+++
]]>2015-02-13T11:50:45+02:002015-02-13T11:50:45+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31273#p31273Statistics: Posted by sm_jamieson — 13 Feb 2015, 10:50
]]>2015-02-10T21:41:17+02:002015-02-10T21:41:17+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31243#p31243 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:002015-02-10T19:14:02+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31241#p31241You 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
]]>BrainModularBrainModular Users Forum2015-03-04T16:33:25+02:00https://brainmodular.com/forums/app.php/feed/topic/46932015-03-04T16:33:25+02:002015-03-04T16:33:25+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31463#p31463 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 (n:integer);Begin Case n of //Go to Pad_Change pad:begin j:=1; pad_array_values[0] := round(getvalue(pad)); PAD_CHANGE; end; end; End;
CODE:
procedure PAD_CHANGE;Begin for i:=0 to 15 do begin if pad_Array_Values[i] = 127 then begin pad_Array_B[i]:=127; lngthMidi:=lngthMidi+1; end else begin pad_Array_B[i]:=0; lngthMidi:=lngthMidi+1; end; end; End;
CODE:
procedure process;Begin if j=2 then begin j:=0; lngthMidi:=0; end else begin if j=1 then inc(j); end; x:=20; if lngthMidi > 0 then begin for i := 0 to lngthMidi-1 do begin ReceivedMidi.msg := 176; ReceivedMidi.data1 := x; ReceivedMidi.data2 := pad_Array_B[i]; ReceivedMidi.channel := 3; SetMidiArrayValue(MidiOut,i,ReceivedMidi); x:=x+1; end; SetLength(MidiOut,lngthMidi); end else SetLength(MidiOut,0); End;
Statistics: Posted by sephult — 04 Mar 2015, 15:33
]]>2015-03-04T16:17:03+02:002015-03-04T16:17:03+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31462#p31462 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:002015-03-04T16:07:35+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31461#p31461 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.
]]>2015-03-04T15:23:40+02:002015-03-04T15:23:40+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31460#p31460The 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:002015-03-04T15:07:55+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31459#p31459 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:002015-03-04T15:01:40+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31458#p31458 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
]]>2015-03-04T14:52:30+02:002015-03-04T14:52:30+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31457#p31457Logically 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(MidiOut,lngthMidi); for i := 0 to lngthMidi-1 do begin ReceivedMidi.msg := 176; ReceivedMidi.data1 := x; ReceivedMidi.data2 := pad_Array_B[i]; ReceivedMidi.channel := 3; SetMidiArrayValue(MidiOut,i,ReceivedMidi); x:=x+1; end; end else SetLength(MidiOut,0); SetLength(MidiOut,0);
Statistics: Posted by sephult — 04 Mar 2015, 13:52
]]>2015-03-04T14:44:15+02:002015-03-04T14:44:15+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31455#p31455 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:002015-03-04T09:18:20+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31448#p31448Statistics: Posted by bsork — 04 Mar 2015, 08:18
]]>2015-03-04T03:17:56+02:002015-03-04T03:17:56+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31447#p31447I 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
Statistics: Posted by sm_jamieson — 03 Mar 2015, 14:32
]]>2015-02-14T14:07:50+02:002015-02-14T14:07:50+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31288#p31288But it's normally very easy to avoid?
for example
CODE:
Procedure Process;begin if MyCondition then setValue(param,1) else SetLength(param,-1);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+++
]]>2015-02-13T11:50:45+02:002015-02-13T11:50:45+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31273#p31273Statistics: Posted by sm_jamieson — 13 Feb 2015, 10:50
]]>2015-02-10T21:41:17+02:002015-02-10T21:41:17+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31243#p31243 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:002015-02-10T19:14:02+02:00https://brainmodular.com/forums/viewtopic.php?t=4693&p=31241#p31241You 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