# Mixing Technique
URL: /docs/locale/software/lmixer/mixing
Source: https://raw.githubusercontent.com/itsektionen/docs/refs/heads/main/content/docs/locale/software/lmixer/mixing.mdx



## Basics [#basics]

Color mixing of lights are a bit different from normal color mixing. Since we
can't add black as a color, black is just no light on. Some colors are hard to
represent, this is in part dependent on what type of LED is used but also some
other factors. Most of our lamps only have RGB, and can not produce
"yellow" or "white" light very well.

### Color fades [#color-fades]

The `dim` function can be used to fade fixtures with RGB values between colors.
Note that the colors will mix between colors during the fade resulting in a
timeline like the picture below.

![A fade between blue and red](</_next/static/media/fade_normal.146yc2v_o7lq8.png>)

It is also possible to change color and lower the intensity at the same time.
In this case the red color is only set to 20% of the blue colors intensity.
It is also possible to accomplish this using the multi-layer technic below.

![A fade between blue and red with intensity going down](</_next/static/media/fade_dim.2pq4u_f_lx8js.png>)

## Multi-layer scripting [#multi-layer-scripting]

Layers can be used to create effects stacked on top of each other. The most
common use is to run a script on the `master` layer and multiply that with a
`dimmer` layer. One of the already existing scripts can run normally on the
master layer and the dimmer layer can add in some randomness by flickering
lights off and on. Great use for a spooky theme.

![A fade between blue and red with another layer creating on/off pattern](</_next/static/media/fade_on_off.1g1r8q20zs7wl.png>)

The dimmer layer can also be used to "turn off" some lights in a specified area.
An example that have been used is to turn of the roof pixels above the dance
floor when the DJ lightning is running. And then on top of that have a third
layer added to the data so that the DJ area can run roof patters even tho the
rest is running another script.

<ExclusiveTo exclusiveTo="LMixerAddonSuiteExtensions">

### Alpha-data layer scripting [#alpha-data-layer-scripting]

If you have a base script loop, but want to a temporary jingle or similar, then
placing the jingle on a seperate layer (`jingle` in the example) allows for the
jingle to return the base script afterwards.

**_Example:_** take control of the washes, lamps, the microwaves, and box lights.
After 30 seconds release the control.

```lua
local ownedFixtures = {washes, lamps, micro1, box};

-- Set the "starting state" of the fixtures
jingle:add(0, set(box, 255, 0, 255))
-- ETC. for the rest of the fixtures

jingle:add(100, take_control_of_fixture(ownedFixtures, 1000))

-- BUNCH OF CODE

jingle:add(30000, release_control_of_fixture(ownedFixtures, 1000))
```

`take_control_of_fixture` and `release_control_of_fixture` do not have to be in the
same script. For instance, to make the DJ floor situation described in
[Multi-layer scripting](#multi-layer-scripting), having a `dj` layer, taking
control of the fixtures is done in a start script and releasing control in an end script.

**_Example:_** Multi-script layer control:

```lua
-- DJ_Start
dj:add(0, take_control_of_fixture(djFixtures, 1000))
```

```lua
-- DJ_Stop
dj:add(0, release_control_of_fixture(djFixtures, 1000))
```

</ExclusiveTo>
