Keyboard In CHOP

From TouchDesigner 099 Wiki


The Keyboard In CHOP receives ASCII input from the keyboard, and outputs channels for the number of keys specified. It creates a single-frame channel representing the current state of each key.

The channels for keys are created by specifying the first key, the number of keys to follow, and the order with which they are selected. Key channel names are either determined by the name of the key, or the channel number.

NOTE: The Keyboard In CHOP does not handle rapid repeats of characters and does not output channels or all keys. A better way is as follows: Create a Panel Execute DAT, and set the 'From Component' to the panel in which keyboard keys need to be monitored. Set the Panel Value to: key. In this DAT, if you enter echo $args, you will see a line printed for every keystroke.

See also the keystate() and mouse() expressions.

PythonIcon.png keyboardinCHOP_Class

Parameters - Keys Page

Active - While On, the keyboard inputs will be monitored and the CHOP will cook every frame. When set to Off it will not cook and the current keyboard values will not be output. While Playing will capture keyboard events only when the Timeline is playing forward.

First Key - Specifies the key to start generating channels from. Valid keys are the numbers 0-9, letters A-Z, and keypad 0-9.

Modifier Keys - If it is set to Ctrl, the keys will only go On if you are also pressing the Ctrl key. If it set to Ignore, it doesn't matter if the Ctrl key is down or not. The Keyboard In CHOP does not use the Alt key, which has been reserved for shortcuts.

Number of Keys /number - Specifies the number of keys to generate including the first key.

Key Order - If you ask for 5 keys, they are sequential on the keyboard by three methods:

  • Alphabetical - Where E is followed by F, G, H and I
  • QWERTY - Where it follows the keyboard rows, and E is followed by R, T, Y and U
  • 1QAZ - Where it follows the keyboard columns, and E is followed by F, V, 4 and R

The keypad keys are ordered: keypad 0, keypad period, keypad 1, keypad 2, etc.

Channel Names - Channel names are generated automatically using one of these criteria.

  • By Key Name - Keys Q W R will be called kq kw ke, based on the key name (key pad channels are named kp0, kp1...)
  • By Channel Number - Channels are named k1 k2 k3 k4 based on the order of the channels.

Parameters - Channel Page

This sets the Sample Rate and the Extend Conditions.

Standard Options and Local Variables