# Expression DMX Patching

Expression DMX Patching allows you to create new DMX mappings in-place for simpler light fixtures.

Using constants (eg. 255) and variables (eg. R, G, B) delimeted by a comma you are able to express a DMX mapping in a single line.

{% embed url="<https://youtu.be/fAMdns8xrKQ>" %}

## How To Use

Use the expression, in the format below, as the Model name when setting an output/changing model.

```
NAME:EXPRESSION
```

Expression is made up of descriptions for individual DMX channels separated by a colon (,)

```
CH1,CH2,CH3,...
```

Each channel can be a full mathematical expression but you'll likely be just either entering a fixed DMX value (0-255) or referencing one of the available variables (see below for a list).

## Caveats

All variables reference only the first pixel of a fixture. Currently there is no way to expand the DMX mapping to all available pixels.

You can still map multipixel fixtures by creating two fixtures - one using this Expression mapping and the other using one of the standard RGB mappings which do expand to cover all available pixels.

## Example - RGBW Fixture

An RGBW fixture is available from the standard fixtures so this is only provided as an explanatory example.

```
RGBW:R,G,B,W
```

## Example - Claypaky HY B-EYE

Given the following DMX chart:

![](/files/-M8KNv74jRoCmgo1ObzK)

We can write the following expression as the Model name:

```
Claypaky.HY B-EYE:R,r,G,g,B,b,W,w,O,0,S,255,255,P,p,T,t,0,0,Z,0,0
```

## Available Variables

Uppercase variables yield standard value, lowercase give you the fine part for 16-bit mapping and variable with `1` suffix gives a normalized 0-1 value.

For example, Red at full value 1.0:

* `R`: 255
* `r`: 0 (no fine part)
* `R1`: 1

<table data-header-hidden><thead><tr><th width="114">Variable</th><th>Meaning</th></tr></thead><tbody><tr><td>Variable</td><td>Meaning</td></tr><tr><td><code>L</code></td><td>Dimmer, the <strong>L</strong>uminance of first pixel</td></tr><tr><td><code>R</code></td><td><strong>R</strong>ed content of first pixel</td></tr><tr><td><code>G</code></td><td><strong>G</strong>reen content of first pixel</td></tr><tr><td><code>B</code></td><td><strong>B</strong>lue content of first pixel</td></tr><tr><td><code>C</code></td><td><strong>C</strong>yan content of first pixel</td></tr><tr><td><code>M</code></td><td><strong>M</strong>agenta content of first pixel</td></tr><tr><td><code>Y</code></td><td><strong>Y</strong>ellow content of first pixel</td></tr><tr><td><code>O</code></td><td>CT<strong>O</strong> (Temperature)</td></tr><tr><td><code>P</code></td><td><strong>P</strong>an</td></tr><tr><td><code>T</code></td><td><strong>T</strong>ilt</td></tr><tr><td>W</td><td>Ya<strong>w</strong> (Not Implemented)</td></tr><tr><td><code>Z</code></td><td><strong>Z</strong>oom</td></tr><tr><td><code>F</code></td><td><strong>F</strong>ocus</td></tr><tr><td><code>I</code></td><td><strong>I</strong>ris</td></tr><tr><td><code>S</code></td><td><strong>S</strong>peed, use as Frequency for strobes for instance</td></tr><tr><td><code>D</code></td><td><strong>D</strong>uration</td></tr></tbody></table>

##

## Further Work

### Functions

The expressions are evaluated using ncalc and thus should support all standard math functions, but on top there should certainly be:

|                  |                                                     |
| ---------------- | --------------------------------------------------- |
| map(X, from, to) | Remap the normalized input value to the given range |

### Others

More variables could be added to cover more scenarios - **Suggest more!**

Colorwheels, gobo selections and similar are not supported under this proposal. However this could be covered by adding special mapping functions.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scenic.tools/plugins/artnet/expression-dmx-patching.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
