keyPress Plays keyRelease Stop

Hello

So I made this patch that plays a video the instant any key from a group of keys is pressed. When the key is released it stops. This works well as long as the key press repeats continuously. However i want the play’s toggle to switch on at the first instance of the key press then ignore the repeats that follows and then on key release to switch off making the video to stop.

Here goes my patch:

keyPress_keyRelease.v4p (13.4 kB)

hey ventolinmono,
what do you mean by repeats?

Key repeats when you press any key on your keyboard and you don’t release the key it keeps sending that key ‘vvvvvvvvvvvvvvvvvvvvvvvvvvvv…’ I just want to receive the first and ignore the rest and wait for the release. The key release stops the video.

keymatch(string)

Yes I’m using KeyMatch. The problem comes after that. My patch has TogEdge and FlipFlop but they don’t behave as i need to.

hm, then you probably have to be more precise in your description. looking at your patch it seems to do exactly what you want:

  • i press one of the keys down, play turns on, stop turns off
  • key still pressed down, play still turned on, stop still turned off
  • i release the key, play turns off, stop turns on

in other words: as long as i press one of the keys play is on and stop is off.

?!

May I suggest you to create a Counter node and to link it before and after TogEdge? I mean, down Togedge, you get just the first keyboard input (as the TogEdge cuts out all the others); cause in any case I think that the keyboard should keep on sending signals (vvvvvvvvvvvvvvvvvvvvv…) to make possible to “Stop” on key releasing, no?

I want the play toggle to go on only for the first press down (no repeats) and stay that way until release.
This is because i have a hardware input that acts like a keyboard. This sensor only repeats about 30 times then stops. If i want to continue playing the video after those 30 repeats i need the toggle to continue on waiting for the release.
Sorry if i was not clear before.

ah, so there is the missing info: your special hardware. to me it sounds like your hardware sends a key-up after 30 seconds.

please check:

  • start vvvv with an empty patch
  • create only Keyboard (System Global)
  • view its Keyboard Output
  • press down the A key for more than 30 seconds

what happens after your hardware stops sending the repeats? does Keyboard Output still return ‘A’ or not?

joreg:I don’t have the sensors with me right now. Will check that later.
An easy answer is to disable repeat keys on Windows 7 but prefer to fix it on my patch.
Thanks for all of your replies. I’ll be back when i figure this out.

You could also use a monoflop set to a time a little higher than the interval of the keystrokes of your device.

then very rapid keystrokes would be interpreted as one stroke, unless they are a bit further apart in time

Disabling key repeats on Windows 7 didn’t worked.
I’ve got it partially working with a MonoFlop.

Hi ventolimono, which signals that hw sends into vvvv, or better, how vvvv reads these signals?
For example, after the 30th repetition, vvvv receives what? Presumably a Down Edge (seen from a TogEdge POV)…

Yes the TogEdge receives a Down Edge.