Logic node

Do Once

A trigger gate that lets an event through exactly once, then closes until a Reset re-arms it. Wire a repeating trigger in, and only its first occurrence reaches the output — the node-graph equivalent of "run this once". With Closed on Start it inverts into an armed latch that waits for permission before its first (and only) firing. Essential for one-shot animations, initialization pulses, and turning noisy repeated events into single actions.

Inputs

PortTypeDefault
TriggerThe signal that tries to pass the gate. Only the moment it turns on counts, and only while the gate is still open; holding it on does nothing more.boolfalse
ResetRe-arms the gate so the next trigger can pass again. Only the moment it turns on counts, and it is applied before the trigger, so both together fire once more.boolfalse
Closed on StartDecides the gate position when the patch starts. Off lets the very first trigger through, on keeps the gate shut until the first reset.boolfalse

Outputs

PortType
Outbool
Is Openbool

How It Works

Do Once is a tiny state machine with one bit of memory: the gate is either open or closed. Everything runs per frame, so levels are not events — the node reacts to edges.

Frame-by-frame behavior:

  1. Reset first. A rising edge (false→true) on Reset opens the gate. Because Reset applies before Trigger, a Reset and a Trigger arriving in the same frame fire the output again immediately.
  2. Trigger. A rising edge on Trigger while the gate is open emits a one-frame pulse on Out and closes the gate. Rising edges while the gate is closed are swallowed.
  3. Is Open always reports the gate state after this frame's processing (level, not pulse).

Edge semantics (deliberately asymmetric):

  • Trigger: an input already true on the very first frame counts as a rising edge — a trigger passes through app startup unless Closed on Start is set.
  • Reset: re-arms on a rising edge only, and an already-true Reset on the first frame is ignored. Otherwise a held-true Reset cable would defeat Closed on Start on frame one. A held-true Reset also does not keep the gate permanently open — it re-arms once per rising edge.
First-frame input stateTriggerReset
Already true at startupFires (counts as edge)Ignored (no re-arm)
Rising edge laterFires (if open)Re-arms
Held true continuouslyFires once at the initial edgeRe-arms once at the initial edge

State lifecycle. The gate state is volatile — never saved with the project. Every project load re-initializes the gate from Closed on Start (which is read only during that first-frame initialization). Deleting the node discards its state.

Inspector. The Reset row provides a "Reset Now" button that re-arms the gate manually — it works alongside a wired Reset cable — plus a live indicator showing the gate as a green Open or red Closed dot.

Parameters in Depth

Trigger (bool, default false) — the event input. Fires the gate on a rising edge while open. Float cables count as true above 0.5, non-zero ints as true, so gate-like float signals (e.g. beat probabilities put through Compare) work directly.

Reset (bool, default false) — re-arms the gate on a rising edge. Applied before Trigger within the same frame, so simultaneous Reset+Trigger produces a fire. Startup-true is ignored by design.

Closed on Start (bool, default false) — the gate's initial position. false: the gate starts open and the first trigger passes ("do the first one, ignore the rest"). true: the gate starts closed and no trigger passes until the first Reset re-arm ("armed only when permitted"). This port is consulted only when the node initializes its state (first processed frame after creation or project load); changing it later has no effect until the next load.

Outputs: Out (bool) — a strict one-frame pulse per accepted trigger; Is Open (bool) — a level exposing the current gate state for downstream logic or UI.

Use Cases

  • Intro animation, once per show: Timer (Running) → Do Once → LFO (Restart, Mode: Once) plays a one-shot sweep the first time the timer starts, and never again until reset.
  • First beat only: Audio Beat Detection (Onset) → Do Once → Counter (Reset) — the very first onset of a track zeroes a counter; later onsets are ignored, so the reset happens exactly once.
  • Every Nth event: Counter (Limit: Loop, Carry) → Do Once → any one-shot action, with the same Carry also wired to Reset via a Delay-free chain in the next lap — the classic "each wrap re-arms the next single fire" cascade.
  • Armed cue button: Do Once (Closed on Start = true) with Keyboard (arm key) → Reset and Audio Beat Detection (Kick) → Trigger — the operator arms the gate, and the next kick fires a Magic Storm lightning burst exactly once.
  • Latched state display: Is Open → Switch (Index) choosing between two Constant (string) nodes → Text as Image → Canvas shows "ARMED"/"SPENT" without any extra logic.
  • One-time capture: Compare (threshold crossed) → Do Once → Hold Value (Update) freezes a measurement the first moment a signal exceeds a limit, keeping it on screen for inspection.

Tips

  • Out is a one-frame pulse, not a latch. To keep something on after the fire, route Out into Hold Value, a Counter, or use the Is Open level (inverted with Logic NOT gives "has fired").
  • Re-triggering only requires a rising edge on Reset — pulsing Reset with an LFO (Trigger output) turns Do Once into a rate limiter that passes at most one trigger per LFO cycle.
  • The startup asymmetry is your friend: an always-true cable into Trigger gives you a clean "once at patch start" init pulse, while the same cable into Reset does nothing on frame one.
  • Closed on Start is read only at state initialization — toggle it, then reload the project (or recreate the node) to see the new starting position.
  • Gate state is volatile: every project load is a fresh start. For persistence across sessions, mirror the state via Set Variable / Get Variable.
  • Related nodes: Counter (count events instead of gating them; its Carry → Do Once is the "every N events" idiom), Hold Value (freeze data rather than gate triggers), Integrator in On Trigger mode (accumulate per event), LFO (a source of clean periodic trigger pulses).

Open Do Once in the interactive catalog →

Do Once is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More Logic nodes