ArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2015-11-02T03:17:24+02:00 https://brainmodular.org/forums/app.php/feed/topic/5159 2015-11-02T03:17:24+02:00 2015-11-02T03:17:24+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34015#p34015 <![CDATA[Really noob scripting question]]>
You could do something like this pseudo code

i:=i+1
if i=5 then
inc(c)
setvalue(outp,c)
i:=0
end


Just a rough explanation, so that your output doesn't get modified the first 4 iterations of the process block, but will output on the 5th iteration and reset the internal counter.

Hope makes sense....getting a little too dopey tonight to script... lol :)

-s

Statistics: Posted by sephult — 02 Nov 2015, 02:17


]]>
2015-11-02T01:15:38+02:00 2015-11-02T01:15:38+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34014#p34014 <![CDATA[Really noob scripting question]]>
I was wondering if everything was executing within a single bloc. I assumed that the setvalue() would regulate the speed of the script. So sephult, you are suggesting I use the process block, rather than the fast callback section and add the if statement to slow things down?

Statistics: Posted by ahonoe — 02 Nov 2015, 00:15


]]>
2015-11-02T01:03:44+02:00 2015-11-02T01:03:44+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34013#p34013 <![CDATA[Really noob scripting question]]> n blocks....etc...

I guess long story short there are many ways you could code it up:)

If you need help let me know and I'll try to come up with some ideas to help get you going.

-s

Statistics: Posted by sephult — 02 Nov 2015, 00:03


]]>
2015-11-02T01:00:08+02:00 2015-11-02T01:00:08+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34012#p34012 <![CDATA[Really noob scripting question]]>
So the processing in that for loop happens faster than the output. That's why you always just end up with 31.
You need to have some sort of tick or timer to divide up the incremental numbers.

I took and made a test using the processing loop and a switch, by incrementing each processing block (which the process procedure does).
Now you can see it zooming through and actually changing, but at the speed of the processing block.

//////////////////////////
//
/////////////////////////
// parameters declaration
var inp : Tparameter;
var outp : tparameter;
var reset : TParameter;
// initialisation : create parameters
procedure init;
begin
inp :=CreateParam('in',ptButton);
outp:= CreateParam('out',ptDataFader);
setmax(outp,32);

reset:=CreateParam('reset',ptButton);

end;

var CountOn :single;
var i :integer;
procedure process;
begin

//get value of the switch
CountOn:=round(getvalue(inp));

if countON = 1 then begin
if i < 32 then begin
inc(i);
setvalue(outp,i)
end
else begin
i:=0;
setvalue(outp,i);
end;
end;

end;

Statistics: Posted by sephult — 02 Nov 2015, 00:00


]]>
2015-11-02T00:57:41+02:00 2015-11-02T00:57:41+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34011#p34011 <![CDATA[Really noob scripting question]]>
With HH (and PureData, and Max, and similar) you must think about processing as blocks of work, intended to fit within the time it takes to work on one (blocksize) of audio.

Read up on the blocksize parameter, that may help tie it all together.

Statistics: Posted by shawnb — 01 Nov 2015, 23:57


]]>
2015-11-02T00:01:21+02:00 2015-11-02T00:01:21+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34010#p34010 <![CDATA[Really noob scripting question]]>
I've done some scripting before so you can imagine my surprise when I can't get a basic counter to work. If I connect a trace module to the 'out' of the following script, I expect to see 0 through 31 in the trace window. Instead I only see 31. What am I missing??

//////////////////////////
//
/////////////////////////
// parameters declaration
var inp : Tparameter;
var outp : tparameter;

// initialisation : create parameters
procedure init;
begin
inp :=CreateParam('in',ptButton);
outp:= CreateParam('out',ptDataFader);
setmax(outp,32);
end;

// Callback procedure
Procedure Callback(N:integer);
var i: integer;
begin
for i :=0 to 31 do begin
setvalue(outp,i);
end;
end;

// no process block

Statistics: Posted by ahonoe — 01 Nov 2015, 23:01


]]>
BrainModular BrainModular Users Forum 2015-11-02T03:17:24+02:00 https://brainmodular.org/forums/app.php/feed/topic/5159 2015-11-02T03:17:24+02:00 2015-11-02T03:17:24+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34015#p34015 <![CDATA[Really noob scripting question]]>
You could do something like this pseudo code

i:=i+1
if i=5 then
inc(c)
setvalue(outp,c)
i:=0
end


Just a rough explanation, so that your output doesn't get modified the first 4 iterations of the process block, but will output on the 5th iteration and reset the internal counter.

Hope makes sense....getting a little too dopey tonight to script... lol :)

-s

Statistics: Posted by sephult — 02 Nov 2015, 02:17


]]>
2015-11-02T01:15:38+02:00 2015-11-02T01:15:38+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34014#p34014 <![CDATA[Really noob scripting question]]>
I was wondering if everything was executing within a single bloc. I assumed that the setvalue() would regulate the speed of the script. So sephult, you are suggesting I use the process block, rather than the fast callback section and add the if statement to slow things down?

Statistics: Posted by ahonoe — 02 Nov 2015, 00:15


]]>
2015-11-02T01:03:44+02:00 2015-11-02T01:03:44+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34013#p34013 <![CDATA[Really noob scripting question]]> n blocks....etc...

I guess long story short there are many ways you could code it up:)

If you need help let me know and I'll try to come up with some ideas to help get you going.

-s

Statistics: Posted by sephult — 02 Nov 2015, 00:03


]]>
2015-11-02T01:00:08+02:00 2015-11-02T01:00:08+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34012#p34012 <![CDATA[Really noob scripting question]]>
So the processing in that for loop happens faster than the output. That's why you always just end up with 31.
You need to have some sort of tick or timer to divide up the incremental numbers.

I took and made a test using the processing loop and a switch, by incrementing each processing block (which the process procedure does).
Now you can see it zooming through and actually changing, but at the speed of the processing block.

//////////////////////////
//
/////////////////////////
// parameters declaration
var inp : Tparameter;
var outp : tparameter;
var reset : TParameter;
// initialisation : create parameters
procedure init;
begin
inp :=CreateParam('in',ptButton);
outp:= CreateParam('out',ptDataFader);
setmax(outp,32);

reset:=CreateParam('reset',ptButton);

end;

var CountOn :single;
var i :integer;
procedure process;
begin

//get value of the switch
CountOn:=round(getvalue(inp));

if countON = 1 then begin
if i < 32 then begin
inc(i);
setvalue(outp,i)
end
else begin
i:=0;
setvalue(outp,i);
end;
end;

end;

Statistics: Posted by sephult — 02 Nov 2015, 00:00


]]>
2015-11-02T00:57:41+02:00 2015-11-02T00:57:41+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34011#p34011 <![CDATA[Really noob scripting question]]>
With HH (and PureData, and Max, and similar) you must think about processing as blocks of work, intended to fit within the time it takes to work on one (blocksize) of audio.

Read up on the blocksize parameter, that may help tie it all together.

Statistics: Posted by shawnb — 01 Nov 2015, 23:57


]]>
2015-11-02T00:01:21+02:00 2015-11-02T00:01:21+02:00 https://brainmodular.org/forums/viewtopic.php?t=5159&p=34010#p34010 <![CDATA[Really noob scripting question]]>
I've done some scripting before so you can imagine my surprise when I can't get a basic counter to work. If I connect a trace module to the 'out' of the following script, I expect to see 0 through 31 in the trace window. Instead I only see 31. What am I missing??

//////////////////////////
//
/////////////////////////
// parameters declaration
var inp : Tparameter;
var outp : tparameter;

// initialisation : create parameters
procedure init;
begin
inp :=CreateParam('in',ptButton);
outp:= CreateParam('out',ptDataFader);
setmax(outp,32);
end;

// Callback procedure
Procedure Callback(N:integer);
var i: integer;
begin
for i :=0 to 31 do begin
setvalue(outp,i);
end;
end;

// no process block

Statistics: Posted by ahonoe — 01 Nov 2015, 23:01


]]>