Keyboard
Read keyboard key state for interactive control.
What it does
Keyboard reads the live state of one or more keyboard keys. Each monitored key gives four numbers: whether it is currently held down, a one-frame pulse the instant it goes down, a one-frame pulse the instant it comes back up, and how long in seconds it has been held. Number of Keys watches more than one key at once, each with its own picker and its own set of four outputs.
Being a live input, it updates every frame the graph is running rather than only when something upstream changes.
When to use it
A key press triggering something once, from the "just pressed" pulse
A value that ramps up the longer a key is held, from duration
An effect toggled or gated while a key is down, from the pressed state (1 while held, 0 otherwise)
Several keys driving different things at once, for example WASD for movement: raise Number of Keys and pick a different key per slot
| Parameter | Type | Default |
|---|---|---|
key_count | Number | 1 |
Gotchas
Each monitored key is sampled once per frame. Reading the same key in two separate slots is fine, but a slot does not update mid-frame when its key picker changes; the new key's state starts fresh from that point.
Modifier keys (Shift, Ctrl, Alt, the Cmd/Win key) are in the key list and behave like any other key: held state, press and release pulses, and duration all work the same way.
Where live keyboard state cannot be reached, for example in an offline render, every output reads zero instead of erroring. A graph that looks correct in the editor can still produce all-zero signals in that context.
Worked example
Add a Keyboard node.
Leave Number of Keys at 1 and set its key picker to "space".
Wire the key_0 output (pressed state) into an effect's enable input, so the effect only runs while Space is held.
Raise Number of Keys to add more keys: set a second slot to "arrow_up" and wire its just_pressed pulse to trigger a one-shot action.
See also
Gamepad Input · Pointer · MIDI Input · Numbers, signals & audio