Create two-way control surface (OSC/MIDI with feedback guard)
create_two_way_surfaceBidirectionally map a hardware controller (OSC/MIDI) to TouchDesigner parameters and echo changes back, using epsilon-delay and rate-limiting to prevent feedback loops.
Instructions
Build a bidirectional OSC or MIDI control surface that drives TouchDesigner params from a controller AND echoes outgoing changes back to it (motor faders, RGB pads), with an oscillation guard so the device's own echo doesn't ping-pong. Each mapping pairs a device address with a TD parameter; a Script CHOP gates outbound sends by epsilon delta, rate limit, and a last_in cache. Exposes Bypass, Globaleps, Ratehz, Reseccache custom pars on the container.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Container name. | two_way_surface |
| parent | No | Parent COMP path. | / |
| protocol | No | Transport: 'osc' uses OSC In/Out CHOPs; 'midi' uses MIDI In/Out CHOPs. | osc |
| host | No | OSC remote host (device IP) for outgoing messages. Ignored for MIDI. | 127.0.0.1 |
| port | No | OSC remote port for outgoing messages. Ignored for MIDI. | |
| listenPort | No | OSC local port for incoming messages. Ignored for MIDI. | |
| midiDevice | No | MIDI device name (required when protocol='midi'). | |
| mappings | Yes | Per-control routing + guard config. | |
| rateLimitHz | No | Outgoing send-rate cap (Hz). Outbound channels are throttled below this rate. |