Logic node

Demux

The inverse of Switch: one value in, Index picks which of the Outputs carries it. The outputs take the type of the Value cable. Unselected outputs Hold their last routed value, show the Default, or carry Nothing (the Mode); an Index outside the range routes nowhere. Cable a Counter, a beat or a Compare into Index and one signal drives many branches.

Inputs

PortTypeDefault
ValueWhat gets routed. Any type — the [i] outputs and Default take this cable's type (arrays too).any—
IndexWhich output carries the Value this frame, counting from 0. Negative counts from the end (-1 = last). Outside the range nothing is routed and every output holds.int0
OutputsHow many [i] outputs the node has, 1…32. Existing outputs keep their cables when you grow the count; a removed output takes its cables with it.int2
ModeWhat the unselected outputs carry. Hold — each keeps the last value routed to it. Default — they show the Default input. Nothing — they carry no value, so a consumer falls back to its own port value.int0
DefaultThe value the unselected outputs show in Default mode, and what an output that never received anything shows in Hold mode.any—

Outputs

PortType
IndexWhich output carries the Value this frame, counting from 0. Negative counts from the end (-1 = last). Outside the range nothing is routed and every output holds.int
Countint

How It Works

Demux is Switch read backwards. Switch takes many cables and lets one through; Demux takes one cable and decides which of several branches receives it.

The outputs are made by the node. Outputs sets how many exist — from 1 to 32 — and they are named [0], [1], [2] and so on. They adopt the type of whatever is cabled into Value, arrays included, and the Default input follows the same type, so the cable colours in the graph tell you what is travelling through the node. The count and the type are adopted the moment a cable is connected, pasted or a project is loaded — not a frame later.

What the unselected outputs carry is the Mode:

ModeUnselected outputs carryGood for
Hold last valueWhatever was last routed to that outputLights, positions, anything that should stay where it was put (the default)
Default valueThe Default inputBlacking out, resetting, a neutral pose
NothingNo value at allLetting each consumer fall back to its own port value

Index resolution follows Switch's convention: 0 is the first output, a negative index counts from the end (-1 is the last), and an index outside the range after that routes nowhere — every output keeps whatever the Mode says it should, and the Index output reports -1.

Only the selected output changes value, so only that branch's consumers are woken. A Demux in front of four heavy chains does not make all four recompute every frame.

Parameters in Depth

Value (any) — the single source being routed. Its port type is what the whole node locks to; connect the cable you actually mean first.

Index (int, default 0) — which numbered output receives the Value this frame. Negative counts from the end; anything out of range routes nowhere. This is the port to drive from a Counter, a beat detector, a Compare or a MIDI note.

Outputs (int, default 2) — how many [i] outputs exist, clamped to 1…32. Existing ports keep their identity when the number grows, so cables and saved projects survive; shrinking removes the trailing ports and their cables with them.

Mode (int, default Hold last value) — see the table above.

Default (any) — the value the unselected outputs show in Default value mode, and the fallback in Hold last value mode for an output that has never been selected yet.

The two fixed outputs report the routing rather than the data: Index is the output that actually received the value (-1 for nowhere), and Count is how many numbered outputs currently exist, so downstream logic can adapt when you add or remove them.

Typical Patches

  • Event router: a bool pulse into Value and a Counter into Index sends one trigger to a different branch each time — step a sequence of Do Once nodes, or arm one of several recorders.
  • One signal, many stages: an audio envelope into Value, Demux into four DMX Channel Map inputs, Mode Hold last value — each lamp keeps its last level while the beat moves on to the next one.
  • Round-robin spawning: Audio Beat Detection (Kick) → Counter (Loop) → Demux Index, with each output enabling a different generator, so successive kicks hit different visuals.
  • A/B send: a Compare result into Index picks which of two processing chains a colour or a texture goes down, with Nothing mode leaving the idle chain on its own defaults.

Related nodes: Switch (the mirror image — many in, one out), Counter (the natural Index driver), Hold Value (freeze one stream rather than choose between branches).

Open Demux in the interactive catalog →

Demux 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