Forums > MaxMSP

detect when number is moving

April 17, 2006 | 12:45 am

trying to create a patch that will detect when a number is moving, which in turn will detect when it is not moveing (i.e, when it has remained still for a number of millisecond)

this is what i have, but it doesnt work

#P button 973 623 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 970 569 184 196617 if ($f1*$f1)- ($f2*$f2) < 0 then bang;
#P button 805 344 15 0;
#P newex 826 373 52 196617 metro 10;
#P number 1018 509 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 957 508 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 957 415 39 196617 set $1;
#P newex 1020 454 40 196617 accum;
#P message 1020 415 39 196617 set $1;
#P newex 957 454 40 196617 accum;
#P newex 905 402 50 196617 del 1000;
#P flonum 1022 373 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 8 0 1 0;
#P connect 8 0 2 0;
#P connect 1 0 4 0;
#P connect 10 0 11 0;
#P connect 7 0 10 1;
#P connect 6 0 10 0;
#P connect 9 0 8 0;
#P connect 4 0 7 0;
#P connect 2 0 6 0;
#P connect 5 0 2 0;
#P connect 0 0 5 0;
#P connect 0 0 3 0;
#P connect 3 0 4 0;
#P window clipboard copycount 12;


April 17, 2006 | 2:53 am

to clarify, this is simply to detect when a controller is NOT in use


April 17, 2006 | 5:08 am

[change] is your friend , it detects changing numbers as its name might suggest it …
this might help :

#P user hslider 531 49 18 128 128 1 0 0;
#P toggle 500 51 15 0;
#P window setfont "Sans Serif" 9.;
#P number 509 232 53 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 509 208 53 196617 timer;
#P button 513 168 15 0;
#P number 513 146 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 513 89 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 513 124 40 196617 change;
#P window linecount 2;
#P comment 566 240 100 196617 ellapsed time between the changes;
#P connect 8 0 2 0;
#P connect 7 0 2 0;
#P connect 4 0 5 0;
#P connect 4 0 5 1;
#P connect 5 0 6 0;
#P connect 2 0 1 0;
#P connect 1 0 3 0;
#P connect 3 0 4 0;
#P window clipboard copycount 9;


April 17, 2006 | 12:36 pm

Is this what you want? It sends out 1s as long as the values it gets
in change faster than the argument in the delay object.

M

max v2;
#N vpatcher 238 248 838 648;
#P window setfont "Sans Serif" 9.;
#P number 239 129 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 171 97 40 196617 change;
#P outlet 171 247 15 0;
#P inlet 171 61 15 0;
#P newex 171 133 26 196617 t b;
#P newex 171 181 27 196617 1;
#P newex 207 181 27 196617 0;
#P newex 207 157 42 196617 del $1;
#P newex 171 206 40 196617 change;
#P window linecount 8;
#P comment 302 120 100 196617 sends out a 1 as long as values are
changing , sends out 0 when it sits on the same value for a period
longer than the value sent into delay;
#P connect 6 0 8 0;
#P connect 8 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 1 0;
#P connect 3 0 1 0;
#P connect 1 0 7 0;
#P connect 5 0 2 0;
#P connect 2 0 3 0;
#P connect 9 0 2 1;
#P pop;


April 18, 2006 | 2:39 pm

John wrote:
> this is what i have, but it doesnt work

Hint: too many objects, you need one object to detect the moving and one
to detect if its not moving…

> i want to apologise if i am asking obvious questions, I have a
> deadline, and have biten off way more than i can chew.

Wrong assumption, its really easy IF you go though the tutorials, which
is obvious you didn’t.

Doesn’t it drive the red colour of shame into you face, knowing that
your teacher will read this? (True I am just guessing that the deadline
has to do with a task for a course, but if there would be a serious
deadline, this kind of question is very unlikely, and its very likely
your teacher does read the list, even if she doesn’t show up with her
real name…)

Sorry, couldn’t resist.

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


April 18, 2006 | 3:54 pm

no, i am not ashamed to ask simple questions, those who dont ask questions will not learn

i used that as my signature because people on this site made me feel i should appologise, but the truth is I think that message forums like this have a purpose, and that is one of shared knowledge. and a medium like max/msp thrives when its experts dont mind helping its newbies.

no i havent read the tutorials in their entirety, but i do use them for reference. i dont have time to read them all, i must learn on the job, which is why i use this forum. and when i consider myself learned, i will share my knowledge with others freely and gladly.

and if my lecturer is reading this, i hope he see’s it as a resourcful action, and not one that undermines my intelligence.

so thank you for your advice, my system is now working fine


April 19, 2006 | 7:05 am

John wrote:
> no, i am not ashamed to ask simple questions, those who dont ask
> questions will not learn

If you first try to answer your questions yourself, you learn muuuuch
more. (Just something I learnd and love to share with you)

> i used that as my signature because people on this site made me feel
> i should appologise, but the truth is I think that message forums
> like this have a purpose, and that is one of shared knowledge. and a
> medium like max/msp thrives when its experts dont mind helping its
> newbies.

I never mind helping newbies, but I definitely prefer to help after they
tried themself (eventually hard).

> no i havent read the tutorials in their entirety, but i do use them
> for reference. i dont have time to read them all, i must learn on the
> job, which is why i use this forum.

Thats one important point. Nobody has time, especially those you ask for
help. You’ll get more help if you respect other peoples time. And it is
not true, that the forum is faster for learning. Going through the
tutorials will take you very little time and teach you more, they’ll
answer your questions of tomorrow.

Your kind of questions would be appropriate for a chat channel, maybe
thats something to consider for Wallace…

And don’t forget, you’re welcome… (but try a little bit harder ;-)

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


April 19, 2006 | 12:13 pm

> If you first try to answer your questions yourself, you learn muuuuch
> more. (Just something I learnd and love to share with you)

> I never mind helping newbies, but I definitely prefer to help after they
> tried themself (eventually hard).

are you implying i dont help myself? do you think i am relying on this forum for answers, and i am sitting here twiddling my thumbs waiting for a responce?

You are mistaken


Viewing 8 posts - 1 through 8 (of 8 total)