The **Gate Node** (`GateNode`) acts as a dynamic ADSR-style envelope filter and peak trigger. It passes incoming signals only when they exceed a configurable threshold, smoothing transients with Attack and Release timings across scalar or multi-element sequence streams.

![Gate Node](https://unilighter.cc/info/docs/node-graphs/gate/gate_99d14c6a.png)

---

## ⏱️ Dynamic Envelope Parameters

- **Threshold (0.0 – 1.0)**: Minimum input signal level required to open the gate.
- **Attack (ms)**: Time required for the output to reach 100% after the threshold is crossed (e.g. `5ms` for instant flash, `200ms` for smooth swell).
- **Release (ms)**: Decay time for the output to fade back to zero after the input drops below the threshold. Eliminates harsh flicker and creates natural light decays.

---

## 🌊 Sequence Support & Independent Element Envelopes

`GateNode` natively supports sequences on its **Signal In** socket:

- **Polymorphic Signal Processing**: When fed a single number, it operates as a standard scalar envelope follower. When fed a sequence, it automatically processes each element in the array.
- **Independent State Tracking**: Envelope state (current attack/decay ramp position) is tracked independently for each element in the sequence. A peak transient on element 0 will not open or reset the decay curve of element 3.
- **Uniform Temporal Dynamics**: The `Threshold`, `Attack`, and `Release` inputs remain scalar to ensure uniform envelope dynamics across all fixtures in a tag.

---

## 🔌 Sockets Reference

| Socket | Direction | Data Type | Description |
| :--- | :--- | :--- | :--- |
| **Signal In** | Input | `Number` / `Sequence` | Continuous incoming signal (scalar or sequence). |
| **Threshold** | Input | `Number` | Scalar opening threshold (`0.0 – 1.0`). |
| **Attack** | Input | `Number` | Rise time in milliseconds. |
| **Release** | Input | `Number` | Fall decay time in milliseconds. |
| **Gate Out** | Output | `Number` / `Sequence` | Smoothed envelope signal matching input shape. |
| **Trigger** | Output | `Trigger` | Boolean pulse emitted at the moment of gate opening. |

