Forums > MaxMSP

Ignore fast Logic Test Changes

February 4, 2008 | 8:31 pm

Hi,

I have a situation where I am testing a scenario using if statements – sending out 1 = true, 0 = false.

This all works nicely but…. there is an extremely fast change of state that is so fast it is not actually visible when looking at a number box stuck on the end of my conditional.

I know why this is happening and it does not seem to be something I can change earlier in the chain (I have already ensured that the two items to be tested are sent through at the same instance).

I can’t think of any objects that filter out fast changes like this. Can anybody suggest one or a way to stop this happening?

Thanks

Andy


February 4, 2008 | 9:59 pm

I’m not sure what you want: fast changes to be filtered out or kept and shown in a way you can visualise?

John


February 4, 2008 | 10:28 pm

Do you want fast changes to be ignored? If so, [pipe].

Do you want the most often occurring state? If so, average.

Do you just want to thin data? If so, [speedlim].

b

On Feb 4, 2008, at 12:31 PM, Andy Brennan wrote:

>
> Hi,
>
> I have a situation where I am testing a scenario using if statements
> – sending out 1 = true, 0 = false.
>
> This all works nicely but…. there is an extremely fast change of
> state that is so fast it is not actually visible when looking at a
> number box stuck on the end of my conditional.
>
> I know why this is happening and it does not seem to be something I
> can change earlier in the chain (I have already ensured that the two
> items to be tested are sent through at the same instance).
>
> I can’t think of any objects that filter out fast changes like this.
> Can anybody suggest one or a way to stop this happening?
>
> Thanks
>
> Andy


Barry Threw
Media Art and Technology

San Francisco, CA
Work: 857-544-3967
Email: bthrew (at) gmail (dot) com
IM: captogreadmore (AIM)

http://www.barrythrew.com

"The greatest of the changes that science has brought us is the acuity
of change; the greatest novelty the extent of novelty."
- J. Robert Oppenheimer


February 4, 2008 | 11:03 pm

Scratch that pipe suggestion. It doesn’t work…which CHRIS MUIR SO
KINDLY DISCOVERED UNDER THE GAZE OF HIS UNBLINKING EYE.

I was thinking of del, which resets its clock on each bang.

You could do this instead, but it might not be the behavior you are
looking for.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 192 158 50 196617 del 1000;
#P newex 158 185 27 196617 i;
#P newex 175 137 27 196617 t i b;
#P number 175 119 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 158 206 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 3 0 0 0;
#P connect 1 0 2 0;
#P fasten 4 0 3 0 197 180 163 180;
#P connect 2 1 4 0;
#P connect 2 0 3 1;
#P window clipboard copycount 5;

b

On Feb 4, 2008, at 12:31 PM, Andy Brennan wrote:

>
> Hi,
>
> I have a situation where I am testing a scenario using if statements
> – sending out 1 = true, 0 = false.
>
> This all works nicely but…. there is an extremely fast change of
> state that is so fast it is not actually visible when looking at a
> number box stuck on the end of my conditional.
>
> I know why this is happening and it does not seem to be something I
> can change earlier in the chain (I have already ensured that the two
> items to be tested are sent through at the same instance).
>
> I can’t think of any objects that filter out fast changes like this.
> Can anybody suggest one or a way to stop this happening?
>
> Thanks
>
> Andy


Barry Threw
Media Art and Technology

San Francisco, CA
Work: 857-544-3967
Email: bthrew (at) gmail (dot) com
IM: captogreadmore (AIM)

http://www.barrythrew.com

"The greatest of the changes that science has brought us is the acuity
of change; the greatest novelty the extent of novelty."
- J. Robert Oppenheimer


February 5, 2008 | 12:07 am

Sorry I thought I had been clear. What I mean by ignore, is to completely ignore the fact the event ever occurred.

What I want is for my system to ignore any change from 0 to 1 or 1 to 0 that occurs and then reverses itself within a given time threshold.

for example

change 1 – 0 to 1
change 2 – 1 to 0

Things like pipe and delay don’t stop events, they just postpone them from happening. What I want is total denial that the number ever changed – therefore the conditional result would remain constant – in the above case it should never move away from 0.

The only way I can tell that the change happens is because

a) my patch is not doing what it should
b) a ‘select 1′ box produces a bang even though the number does not change.

Essentially I think I am wanting a reverse ‘threshold’ type object that instead of collating variables received within a given time, rejects them instead.

Thanks

Andy


February 5, 2008 | 12:12 am

Sorry. Actually I may see what you mean with the delay object. You can click it as many times as you like but only the most recent is passed – this may make it disregard the change.

If this is common behavior it may work.

Cheers

Andy


February 5, 2008 | 1:03 am

you could time the events like this, which works quite well for most applications. Timing may fluctuate depending on your max settings.

#P toggle 117 60 26 0;
#P window setfont "Sans Serif" 9.;
#P number 201 219 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 135 329 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 117 278 32 196617 sel 1;
#P newex 117 299 60 196617 i;
#P newex 117 215 61 196617 t b b i;
#P newex 117 257 36 196617 > 100;
#P newex 117 235 35 196617 timer;
#P number 165 76 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 117 329 15 0;
#P newex 117 182 40 196617 change;
#P newex 117 103 58 196617 metro 110;
#P toggle 117 153 15 0;
#P comment 189 205 73 196617 threshhold ms;
#P connect 13 0 2 0;
#P connect 2 0 1 0;
#P connect 8 1 6 1;
#P connect 8 0 6 0;
#P fasten 12 0 7 1 206 253 148 253;
#P connect 6 0 7 0;
#P connect 7 0 10 0;
#P connect 9 0 4 0;
#P connect 9 0 11 0;
#P connect 10 0 9 0;
#P connect 8 2 9 1;
#P connect 3 0 8 0;
#P connect 1 0 3 0;
#P connect 5 0 2 1;
#P window clipboard copycount 14;


February 5, 2008 | 1:30 am

Quote: Andy wrote on Mon, 04 February 2008 16:07
—————————————————-
> Sorry I thought I had been clear. What I mean by ignore, is to completely ignore the fact the event ever occurred.
>
> What I want is for my system to ignore any change from 0 to 1 or 1 to 0 that occurs and then reverses itself within a given time threshold.
>

This request reminded me of the object jb.skeptic: don’t "believe" input until it occurs n-times in a row. http://www.greyfade.com/joe/maxmsp.html

I have not used this personally, but sounds like what you need. And it is an abstraction so you could alter it if needed.

-Adam


February 5, 2008 | 1:53 am

This sort of filters the input. I think it would reject some of your
unwanted changes. I’ve used techniques like this to reduce
"chattering" on MIDI controllers, but not on a string of 0s and 1s.
I’m not sure it would be as effective.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 72 116 100 196617 Changing input;
#P number 90 137 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 95 250 100 196617 windowed output;
#P newex 57 228 27 196617 int;
#P number 35 116 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 57 201 32 196617 sel 1;
#P newex 57 181 27 196617 ==;
#P number 57 250 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 57 155 43 196617 pipe 25;
#P comment 126 140 100 196617 Time constant;
#P fasten 5 0 1 0 40 142 62 142;
#P lcolor 15;
#P fasten 5 0 3 1 40 177 79 177;
#P lcolor 15;
#P fasten 5 0 6 1 40 223 79 223;
#P lcolor 15;
#P connect 8 0 1 1;
#P connect 6 0 2 0;
#P connect 4 0 6 0;
#P connect 1 0 3 0;
#P connect 3 0 4 0;
#P window clipboard copycount 10;


February 5, 2008 | 2:28 am

My solution remains good with a slight modification.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 140 111 50 196617 del 1000;
#P newex 140 150 32 196617 print;
#P newex 140 130 27 196617 i;
#P newex 140 91 27 196617 t b i;
#P newex 140 72 40 196617 change;
#P number 140 55 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 2 0 5 0;
#P connect 5 0 3 0;
#P connect 3 0 4 0;
#P connect 2 1 3 1;
#P connect 1 0 2 0;
#P connect 0 0 1 0;
#P window clipboard copycount 6;

b

On Feb 4, 2008, at 4:07 PM, Andy Brennan wrote:

>
> Sorry I thought I had been clear. What I mean by ignore, is to
> completely ignore the fact the event ever occurred.
>
> What I want is for my system to ignore any change from 0 to 1 or 1
> to 0 that occurs and then reverses itself within a given time
> threshold.
>
> for example
>
> change 1 – 0 to 1
> change 2 – 1 to 0
>
> Things like pipe and delay don’t stop events, they just postpone
> them from happening. What I want is total denial that the number
> ever changed – therefore the conditional result would remain
> constant – in the above case it should never move away from 0.
>
> The only way I can tell that the change happens is because
>
> a) my patch is not doing what it should
> b) a ‘select 1′ box produces a bang even though the number does not
> change.
>
> Essentially I think I am wanting a reverse ‘threshold’ type object
> that instead of collating variables received within a given time,
> rejects them instead.
>
> Thanks
>
> Andy


Barry Threw
Media Art and Technology

San Francisco, CA
Work: 857-544-3967
Email: bthrew (at) gmail (dot) com
IM: captogreadmore (AIM)

http://www.barrythrew.com

"The greatest of the changes that science has brought us is the acuity
of change; the greatest novelty the extent of novelty."
- J. Robert Oppenheimer


February 5, 2008 | 8:40 am

this sort of works. It’s not perfect though.

But does it get you a step closer to the solution?

–Sam

#P window setfont Verdana 12.;
#P number 73 243 35 12 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 35 314 15 0;
#P window linecount 1;
#P newex 35 268 48 472055820 >= 51;
#P number 35 210 35 12 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 35 177 42 472055820 timer;
#P button 35 142 15 0;
#P number 74 52 35 12 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 35 52 15 0;
#P newex 35 78 67 472055820 metro 50;
#P toggle 35 115 15 0;
#P connect 4 0 5 0;
#P connect 4 0 5 1;
#P connect 7 0 8 0;
#P connect 6 0 7 0;
#P connect 9 0 7 1;
#P connect 1 0 0 0;
#P connect 2 0 1 0;
#P connect 3 0 1 1;
#P connect 5 0 6 0;
#P connect 0 0 4 0;
#P window clipboard copycount 10;

On Feb 4, 2008, at 4:07 PM, Andy Brennan wrote:

>
> Sorry I thought I had been clear. What I mean by ignore, is to
> completely ignore the fact the event ever occurred.
>
> What I want is for my system to ignore any change from 0 to 1 or 1
> to 0 that occurs and then reverses itself within a given time
> threshold.
>
> for example
>
> change 1 – 0 to 1
> change 2 – 1 to 0
>
> Things like pipe and delay don’t stop events, they just postpone
> them from happening. What I want is total denial that the number
> ever changed – therefore the conditional result would remain
> constant – in the above case it should never move away from 0.
>
> The only way I can tell that the change happens is because
>
> a) my patch is not doing what it should
> b) a ‘select 1′ box produces a bang even though the number does not
> change.
>
> Essentially I think I am wanting a reverse ‘threshold’ type object
> that instead of collating variables received within a given time,
> rejects them instead.
>
> Thanks
>
> Andy


February 5, 2008 | 2:00 pm

barry threw schrieb:
> My solution remains good with a slight modification.

I would guess he need the last value, not the first, which is even simpler:

(I have for that purpose also a slightly more complex abhaXion called
firstlast in my collection to get both the first, the last and direction
of change independently…)

#P toggle 136 219 15 0;
#P toggle 136 76 15 0;
#P toggle 136 128 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 136 106 50 196617 metro 20;
#P newex 136 150 64 196617 t b i;
#P newex 136 172 54 196617 delay 300;
#P newex 136 195 64 196617 int;
#P connect 4 0 2 0;
#P connect 0 0 6 0;
#P connect 2 1 0 1;
#P connect 1 0 0 0;
#P connect 2 0 1 0;
#P connect 5 0 3 0;
#P connect 3 0 4 0;
#P window clipboard copycount 7;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


February 5, 2008 | 2:04 pm

Thats exactly what I need it to do. Thanks Stefan.

Andy


February 5, 2008 | 2:23 pm

So you technically need to "debounce" ?
Try onebang
If you’re not familiar with the object, it only passes a bang through (from
the left inlet) after first receiving a bang in the right inlet.
I used it with a delay object sending a bang from the output to the right
inlet after a time delay of a few milliseconds. This means that it’ll only
output bangs a certain time space apart.

Just don’t forget that it needs a bang in the right inlet before the left,
so a loadbang may be necessary.

On 05/02/2008, Andy Brennan wrote:
>
>
> Thats exactly what I need it to do. Thanks Stefan.
>
> Andy
>


February 5, 2008 | 2:29 pm

A onebang is not appropriate for the problem as it needs to be reset each time. This may mean it blocks wanted information as well as quick change info. I think Stefan’s solution works best as all the fast changes are ignored and the end result used.

Thanks

Andy


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