loop action problem

Apr 11, 2006 at 10:57pm

loop action problem

hello!

i really don’t know how exactly to call my problem,,,
but so here is the goal…

i have one subpatch and there should be modification of a number called
“ampli” depending on another number called “average sck” which is
changing through time..,
it should work like this: if “average sck” is < = than 3.5 then decrease
ampli by “nepb” * 5 ( untill “average skc” changes to be > 3.5 ).. else
increase it by “nepb” * 10 ( untill “average skc” changes to be < = 3.5
).. i made this subpatch and there is no Stack Overflow… {sure i read
whole tutorial about loops}..,. but the calculation as it is made is
not calculating “ampli” – specified number when the if part is ok,, and
it seems that it calculates just 0 – specified number… . i don’t know
where it should be,, i rebuilded whole subpatch twice already and so i
need a little help.., because it seems my way is too difficult anyway
and i belive it can be done better way..,., {i placed comment inside
the patch to documentate what is the plan with it}.,.

thanks a lot for anything!!!!

pash*

here is the patch moduAmp:

max v2;
#N vpatcher 770 189 1479 1167;
#P origin 33 0;
#P window setfont “Sans Serif” 9.;
#P newex 145 393 62 196617 prepend set;
#P newex 127 656 70 196617 speedlim 200;
#P flonum 78 610 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 127 615 123 196617 if $f1 > 5 then $i1 else 5;
#P message 281 545 14 196617 2;
#P message 27 539 14 196617 1;
#P newex 127 584 49 196617 switch 2;
#P inlet 145 312 15 0;
#P flonum 77 191 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 221 462 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 68 470 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 205 432 77 196617 expr $i1 + $f2;
#P newex 50 438 76 196617 expr $i1 – $f2;
#P button 205 282 15 0;
#P button 50 283 15 0;
#P newex 1 115 70 196617 speedlim 200;
#P newex 1 163 214 196617 if $f1 < = 3.5 then bang else out2 bang;
#P number 145 368 35 9 0 0 0 3 0 0 0 74 156 97 222 222 222 0 0 0;
#P flonum 17 82 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 272 250 35 196617 * 10.;
#P newex 116 246 29 196617 * 5.;
#N comlet modulated amplifier;
#P outlet 127 765 15 0;
#P newex 116 188 38 196617 r nepb;
#N comlet average sck;
#P inlet 1 54 15 0;
#P comment 0 37 64 196617 average sck;
#P comment 164 312 35 196617 ampli;
#P window linecount 2;
#P comment 70 38 246 196617 this value is changing time by time and
it’s <1 ; 7>;
#P window linecount 4;
#P comment 150 765 152 196617 this output should be modified ampli by
the “average sck” and it effects other calculations in main patch;
#P comment 106 84 291 196617 what i need is: if “average sck” is < =
than 3.5 then decrease ampli by “nepb” * 5 ( untill “average skc”
changes to be > 3.5 ).. else increase it by “nepb” * 10 ( untill
“average skc” changes to be < = 3.5 )..;
#P window linecount 3;
#P comment 287 312 173 196617 “ampli” is received by inlet only when
user changes it manually in main patch;
#P window linecount 2;
#P comment 214 638 100 196617 “ampli” musn’t be smaller than 5;
#P window linecount 4;
#P comment 291 151 100 196617 i’m not sure of using speedlim as method
to avoid Stack Overflow;
#P connect 8 0 16 0;
#P connect 16 0 15 0;
#P fasten 8 0 13 0 6 76 22 76;
#P connect 17 0 26 0;
#P connect 15 0 17 0;
#P connect 31 0 19 0;
#P connect 17 0 19 0;
#P connect 19 0 21 0;
#P fasten 9 0 23 0 121 216 68 216 68 186 82 186;
#P connect 25 0 29 0;
#P connect 9 0 11 0;
#P connect 11 0 19 1;
#P fasten 27 0 25 0 286 566 132 566;
#P fasten 26 0 25 0 32 561 132 561;
#P connect 25 0 28 0;
#P connect 28 0 30 0;
#P connect 30 0 10 0;
#P connect 24 0 14 0;
#P fasten 30 0 14 0 132 705 329 705 329 356 150 356;
#P connect 14 0 31 0;
#P fasten 19 0 25 1 55 516 151 516;
#P fasten 20 0 25 2 210 514 170 514;
#P connect 15 1 18 0;
#P connect 18 0 20 0;
#P connect 31 0 20 0;
#P connect 20 0 22 0;
#P fasten 9 0 12 0 121 211 277 211;
#P connect 12 0 20 1;
#P fasten 18 0 27 0 210 383 286 383;
#P pop;

#25374
Apr 12, 2006 at 12:29pm

pash* wrote:
> it should work like this: if “average sck” is < = than 3.5 then decrease
> ampli by “nepb” * 5 ( untill “average skc” changes to be > 3.5 ).. else
> increase it by “nepb” * 10 ( untill “average skc” changes to be < = 3.5
> )..

With a brief look at your patch, I don’t know what you want in terms of
timing. Out of your description you want to do steps, but if these steps
all happen at the same time, you could as well jump directly to the
target value. It seems you need to define some timing structure…

Stefan

[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—-
–_____———–|———–
–(_|_ —-|—–|—–()—-
– _|_)—-|—–()———–
———-()————x—–

14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09

#74651
Apr 12, 2006 at 1:24pm

hello,
the time cause seems to be ok in this subpatch,,, but the problem is is
math,, the calculation as it is made is not calculating “ampli” -
specified number when the if part is ok,, and it seems that it calculates
just 0 – specified number…
i know that this is really newbie problem,, but i spend two days trying to
do something with it without resuls.,.,
thanks for any help a lot!!

#74652
Apr 13, 2006 at 8:51am

pash* wrote:
> the time cause seems to be ok in this subpatch

But I haven’t seen any… which caused the question, still unanswered,
which does not drive interest to look deeper into it…

Stefan

[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—-
–_____———–|———–
–(_|_ —-|—–|—–()—-
– _|_)—-|—–()———–
———-()————x—–

14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09

#74653
Apr 13, 2006 at 10:31am

Thanks a lot for your will to help at the first place…, ! i’m still
newbie.,.,
sorry,, but i didn’t underestand one thing before,,, i will place metro
into it and than see if it works.., so thanks again.. i’ll try it tonight

pash*

#74654
Apr 13, 2006 at 1:51pm

pash* wrote:
> sorry,, but i didn’t underestand one thing before,,, i will place metro
> into it and than see if it works.., so thanks again.. i’ll try it tonight

Maybe delay or pipe is easier…

Stefan

[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—-
–_____———–|———–
–(_|_ —-|—–|—–()—-
– _|_)—-|—–()———–
———-()————x—–

14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09

#74655

You must be logged in to reply to this topic.