gamepad
gamepad · utility · schema v1Connected USB / Bluetooth game controller as CV (stick axes + triggers) and gate (face / bumper / dpad / menu buttons). Reads navigator.getGamepads() at requestAnimationFrame rate. Browser security requires the user to press a button on the gamepad once before the browser exposes it. Outputs: lx / ly / rx / ry (cv ±1, Y inverted so +1 = up, 0.08 deadzone), lt / rt (cv 0..1), lb / rb / a / b / x / y / du / dd / dl / dr / start / back (gate). Standard mapping = Xbox layout; PlayStation + generic HID controllers that report 'standard' mapping also work. Slot param picks which of up to 4 simultaneous controllers to read. LEFT-STICK CALIBRATION: "calibrate left stick" arms a calibration mode — sweep the stick through its full range several times (the card records the observed per-axis min/max live), then "complete calibration" locks the swept range in so observed-min→full-min and observed-max→full-max per axis, with the calibrated centre mapped to 0 and a radial deadzone around it (no snap-back drift). Calibration is persisted once to the patch (rides collab + undo) and applied to lx / ly; "clear" reverts to the fixed-deadzone path. This makes worn pads and non-Xbox-layout sticks (e.g. VKB Gladiator NXT flight sticks, which report a non-standard mapping with a reduced raw range) reach the full ±1 output range.
the faceplate
outputs
| id | cable | what it does |
|---|---|---|
lx | cv | Left stick X as bipolar CV, −1 (left) through 0 (center) to +1 (right), after a small deadzone and re-normalization (and the left-stick calibration if you've run it). control voltage (CV) |
ly | cv | Left stick Y as bipolar CV, −1 (down) through 0 to +1 (up) — the axis is flipped so pushing up reads positive — with the same deadzone/calibration treatment as LX. control voltage (CV) |
rx | cv | Right stick X as bipolar CV, −1 (left) to +1 (right), with the stick deadzone applied. control voltage (CV) |
ry | cv | Right stick Y as bipolar CV, −1 (down) to +1 (up), Y flipped, with the stick deadzone applied. control voltage (CV) |
lt | cv | Left trigger as unipolar CV, 0 fully released to +1 fully pressed — its analog travel, useful as a swell or VCA ride. control voltage (CV) |
rt | cv | Right trigger as unipolar CV, 0 released to +1 pressed. control voltage (CV) |
lb | gate | Left bumper as a gate: 1 while the button is held, 0 when released. gate / trigger |
rb | gate | Right bumper as a gate: 1 while held, 0 when released. gate / trigger |
a | gate | The A face button as a gate: 1 while held, 0 when released — patch it into a strike or scene trigger. gate / trigger |
b | gate | The B face button as a gate: 1 while held, 0 when released. gate / trigger |
x | gate | The X face button as a gate: 1 while held, 0 when released. gate / trigger |
y | gate | The Y face button as a gate: 1 while held, 0 when released. gate / trigger |
du | gate | D-pad up as a gate: 1 while held, 0 when released. gate / trigger |
dd | gate | D-pad down as a gate: 1 while held, 0 when released. gate / trigger |
dl | gate | D-pad left as a gate: 1 while held, 0 when released. gate / trigger |
dr | gate | D-pad right as a gate: 1 while held, 0 when released. gate / trigger |
start | gate | The Start button as a gate: 1 while held, 0 when released. gate / trigger |
back | gate | The Back / Select button as a gate: 1 while held, 0 when released. gate / trigger |
params
| id | label | range | default | curve |
|---|---|---|---|---|
padIndex | Slot | 0..3 | 0 | discrete |
controls
| control | what it does |
|---|---|
| Slot | Which controller slot to read, 0 to 3 (the Web Gamepad spec allows up to four pads at once). 0 is the first connected controller; raise it to read a second or third pad in a multi-controller setup. |
source
gamepad.ts on GitHub.