pressing mutiple keys using [key]

Jun 16, 2007 at 12:10pm

pressing mutiple keys using [key]

I am using a keyboard encoder and dance mat to create an interactive video.

I have coded it to play different movies depending on what key is pressed on the mat. However i need to trigger videos to play not only if one key is pressed but if two keys are pressed together on the mat.(or at least pressed in close proximity 20-80ms)

I am having difficulties figuring out the coding for this, i figure i have to find a way to time lenght between presses if they are within a certain amount append the key codes received to each other then send the new information on or if no second key is pressed send the single key code on.

any help, advice, info would be extremely extremely appreciated!!!

thank you..

#32494
Jun 16, 2007 at 12:41pm

Is this what you want?
The important object is thresh (gathers data into a list within a
specified time period).

max v2;
#N vpatcher 10 59 610 459;
#P window setfont “Sans Serif” 9.;
#P comment 91 255 100 196617 one key was pressed or;
#P button 55 253 15 0;
#P button 43 218 15 0;
#P window linecount 1;
#P newex 43 191 41 196617 sel 1 0;
#P newex 43 158 30 196617 >= 2;
#P newex 43 134 34 196617 zl len;
#P newex 43 99 54 196617 thresh 50;
#P newex 43 56 40 196617 key;
#P window linecount 2;
#P comment 92 216 100 196617 < two keys were pressed within 50ms;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P fasten 5 1 7 0 59 208;
#P pop;

Cheers
Martin~

On 16 Jun 2007, at 14:10, antoinette wrote:

>
> I am using a keyboard encoder and dance mat to create an
> interactive video.
>
> I have coded it to play different movies depending on what key is
> pressed on the mat. However i need to trigger videos to play not
> only if one key is pressed but if two keys are pressed together on
> the mat.(or at least pressed in close proximity 20-80ms)
>
> I am having difficulties figuring out the coding for this, i figure
> i have to find a way to time lenght between presses if they are
> within a certain amount append the key codes received to each other
> then send the new information on or if no second key is pressed
> send the single key code on.
>
> any help, advice, info would be extremely extremely appreciated!!!
>
> thank you..

#106996
Jun 16, 2007 at 1:00pm

Check out [thresh] and [quickthresh] in the docs. It will be easy to do what you’re after with either object – quickthresh just has some extra parameters for fine-tuning the timing conditions.

J.

#106997
Jun 17, 2007 at 3:58am

thank you.. that is exactly what i was after.. much simpler than i thought it would be.

cheers.

#106998

You must be logged in to reply to this topic.