Kistan 2.0 Doc
  • Furniture
  • Sound cables
  • Roof LED
  • Pipes
  • Inputs/Outputs
  • Mixer
  • Amplifiers
  • DALI
  • DMX
  • Roof LED
  • LMixer
  • Sound mixer defaults
  • Bar computer to Kitchen speakers
  • Server: IN-SMN
  • Server: IN-ITK
  • SSO / Login
  • Grafana
IT-Sektionen
  • Furniture
  • Sound cables
  • Roof LED
  • Pipes
  • Inputs/Outputs
  • Mixer
  • Amplifiers
  • DALI
  • DMX
  • Roof LED
  • LMixer
  • Sound mixer defaults
  • Bar computer to Kitchen speakers
  • Server: IN-SMN
  • Server: IN-ITK
  • SSO / Login
  • Grafana
IT-Sektionen
  • LMixer

    • LMixer
    • LMixer scripting
    • Mixing technique
    • LMixer examples
    • Layers in kistan

LMixer scripting

Layer keywords

Create layer

A layer hold information for outputting data to a UDP listener. The layer have a length and can be combined with another layer using different mathematical operations.

NameOptionalDescription
ParentNoLayer to do operation on, nil if this is the base layer
OperationNoSee operations below
SizeNoHow many bytes is this layer
Default valueYesDefault value for all bytes in a layer

Operations:

OperationDescription
mulMultiply layers together
addAdd this to the other layer
subSubtract this from other layer
divDivide the other layer by this

Example: Create a new layer that multiplies master with this. Default value is 1.

dimmer = layer(master, mul, 512, 1)

Kistan's LMixer exclusive

This content only applies to kistan's instance of LMixer. It is likely the case that the code is contained in setup scripts.

Create layerExt

Creation of a LayerExt is done through a single table argument:

Table type:

keynameOptionalDescription
nameNameNoThe name of the layer, should be the same as the variable the layer is saved to
parentParentYesLayer to do operation on, nil if this is the base layer
opOperationNoSee operations below
sizeSizeNoHow many bytes is this layer
defaultdefaultYesDefault value for all bytes in a layer

Example: Create a new layer that multiplies master with this. Default value is 1.

dimmer = layerExt({ name = "dimmer", parent = master, op = mul, default = 1 })

Create alpha-data layer

Alpha-data layers are layers with alpha support. The alpha blends between the layers below this one and it self. An alpha of 0 means keep the layers below, an alpha of 1 means "replace" the layers below with this layer.

Alpha-data layers inheirt from layerExt, thus the information about layerExt also applies here.

keynameOptionalDescription
nameNameNoThe name of the layer, should be the same as the variable the layer is saved to. The alpha layer is the name + _alpha
parentParentNoLayer to do operation on, nil if this is the base layer
sizeSizeNoHow many bytes is this layer

Note

size and default value are not applicable since theses are set by alpha_data_layer

Example: Create a new alpha-data layer on master

jingle = alpha_data_layer({ name="jingle", parent = master, size = 512})

Alpha-data start with an alpha of 0, this needs to be changed for the layer to be visible, see alpha-data-layer.alpha.

Warning

Do not add child layers to an alpha-data-layer unless their operation is mul. This is because the alpha layer is processed first instead of last, causing the alpha to not apply correctly on the children. This is unintented and usage is highly discouraged, as it is subject to change.

<alpha-data-layer>.alpha

Alpha-data layers are made of two layer, the data layer (the "main" layer"), and the alpha layer which is accessed via .alpha. It is a standard layer, thus the :add works like expected.

Example: Sets the color of the lamp, but this is not visible until the layers alpha is set, specifically the light has it's color components (Red, Green, Blue) set to the new value one by one instead of all at once.

jingle:add(1000, set(lamp1, 255, 128, 255, 0))
jingle.alpha:add(2000, set(lamp1, 1, 0, 0, 0))
jingle.alpha:add(3000, set(lamp1, 1, 1, 0, 0))
jingle.alpha:add(4000, set(lamp1, 1, 1, 1, 0))

Tips

In this case, direct alpha access makes sense, however, in general taking control of the entire fixture is desired, for this take_control_of_fixture and release_control_of_fixture should be used.

output

Output controls what data is sent to each controller. An output can only send one layer.

NameOptionalDescription
HostnameNoHostname for output of the layer
PortNoUDP Port to send data on
LayerNoLayer to send

Example: Send the master layer to specified host on port 1234.

output("192.168.1.10", 1234, master)

artnet_output

Create a new output in the ArtNet1 format.

NameOptionalDescription
HostnameNoHostname for output of the layer
UniverseNoArtNet universe
LayerNoLayer to send

Example: Send the master layer in ArtNet format to specific host with universe set to 123.

artnet_output("192.168.1.10", 123, master)

input

Open a UDP port and bind data messages on that port to an existing layer.

NameOptionalDescription
PortNoUDP Port to listen on
LayerNoWhere to put the data

Example: Listen on port 1234 and put the data into an existing layer.

additional_data = layer(nil, add, 512)
input(1234, additional_data)

Fixture keywords

fix

Create a new fixture with specified parameters. Fixtures can also be added into "groups" by adding them to a table in Lua.

NameOptionalDescription
ChannelNoStart channel for a fixture
LengthNoHow many channels does the fixture consume

Example: Add a new fixture with address 128 and 4 channels.

lamp1 = fix(128, 4)

Add two fixtures and append them to a group called lamps.

lamp1 = fix(128, 4)
lamp2 = fix(132, 4)
lamps = { lamp1, lamp2 }

range

Create several fixtures in a series and add them to a group.

NameOptionalDescription
CountNoHow many fixtures to create
OffsetNoThe offset from dmx channel 1, the first fixture's channel is (Offset - 1) * Size + 1
SizeNoHow many bytes does each fixture have

Example: Create 10 fixtures with 3 channels, with an offset of 1.

pixels = range(10, 1, 3)

Effect keywords

<layer>:add

Add an effect to a layer.

NameOptionalDescription
TimeNoTime after script start in milliseconds
EffectNoFunction call to execute at time

Example: Add a new effect on 1 second to set lamp1 to values.

master:add(1000, set(lamp1, 255, 255, 0, 0))

dim

Fade a fixture from previous values to new values over a period of time.

NameOptionalDescription
TimeNoHow long the dimming effect is executing in milliseconds
Fixture/GroupNoWhat to set the values on
... ValuesNoValues to dim to

Example: Dim lamp1 to specified values for 100ms.

dim(100, lamp1, 255, 0, 0, 0)

set

Set a fixture to the specified values.

NameOptionalDescription
Fixture/GroupNoWhat to set the values on
... ValuesNoValues to set

Example: Set lamp1 to specified values.

set(lamp1, 255, 0, 0, 0)

cycle

Add an effect for each fixture in a group with a delay between each.

NameOptionalDescription
GroupNoGroup to iterate over
TimeNoTime to wait between each fixture
Function nameNoFunction to execute for each fixture
... ValuesNoArguments to the function

Example: Set each fixture in lamps to values with a delay of 100ms between each fixture.

cycle(lamps, 100, set, 255, 0, 0, 0)

rev

Reverse a group of fixtures to use them in backwards order. Is usually used inline with cycle command to do effects in reverse order.

NameOptionalDescription
GroupNoGroup to reverse

Example: Reverse a group of fixtures called lamps.

rev(lamps)

even

Get a subset of fixtures in a group based on their index value. Usually used inline when specifying groups for an effect.

NameOptionalDescription
GroupNoGroup to get fixtures from

Example: Set all even index lights in lamps to values.

set(even(lamps), 255, 0, 0, 0)

odd

Get a subset of fixtures in a group based on their index value. Usually used inline when specifying groups for an effect.

NameOptionalDescription
GroupNoGroup to get fixtures from

Example: Set all odd index lights in lamps to values.

set(odd(lamps), 255, 0, 0, 0)

execute

NameOptionalDescription
CommandNoCommand to execute on the server, must be quoted (")

Example: Run the dalicmd command on the server.

execute("dalicmd -g 255 -c 16")

run

Start a script by name. Normally this is used to repeat the current script by starting it again after some time. Can also be used to split common effects into separate script and then combining them.

Note

When running a script from another script and it has been previously stopped, add the flag script_name*._stop = false. Otherwise, it will not be placed on the timeline.

NameOptionalDescription
NameNoName of the script to run, must be quoted (")

Example: Execute the script called "rainbow".

run("rainbow")

Caution

If not careful one might cause stacking of script if the run command is issued before the last effect of the previous run. This causes an infinite loop of scripts starting on top of each other until something crashes.

play

NameOptionalDescription
FilepathNoPlay an existing sound file, must be quoted (")

Example: Play a sound file with the path blotet/dans_mitt.mp3.

play("blotet/dans_mitt.mp3")

stop_play

Stop playback of all sound files. No parameters.

Example: Stop all playback.

stop_play()

Kistan's LMixer exclusive

This content only applies to kistan's instance of LMixer. It is likely the case that the code is contained in setup scripts.

take_control_of_fixture

Sets the alpha of a fixture group to 1 over a transition time

NameOptionalDescription
GroupNoGroup to iterate over
Fade TimeNoFade time until alpha is 1

Example: Take control of the washes and lamps

jingle:add(0, take_control_of_fixture(lamps, 1000))

Important

Remember to release the control of the fixture, otherwise, when another script is ran, the fixture will still be controlled, by the layer.

(This can sometimes be desired however, see Alpha-data layer scripting for an example of multi-script layer control)

release_control_of_fixture

Sets the alpha of a fixture group to 0 over a transition time

NameOptionalDescription
GroupNoGroup to iterate over
Fade TimeNoFade time until alpha is 0

Example: Releases control of the lamps

jingle:add(3000, release_control_of_fixture(lamps, 1000))

Note

The "take control" and "release control" terminology can be slightly confusing when it comes to priority. The priority is always whatever is latest in the layer order (the order that layers are added as children).

Other keywords

Kistan's LMixer exclusive

This content only applies to kistan's instance of LMixer. It is likely the case that the code is contained in setup scripts.

LMixerError

Prints a error message to mqtt, which thus gets displayed on the LMixer UI. Useful for debugging.

NameOptionalDescription
Error messageNoThe error message

Example: Prints Error: This is a test message to mqtt.

LMixerError("This is a test message");

Note

Only one error message can be displayed on the UI at once, if multiple Error are made, only the latest is displayed.

LMixerPrint

Prints a message to mqtt, which thus gets displayed on the LMixer UI. Useful for debugging.

NameOptionalDescription
Print messageNoThe message to print

Example: Prints Info: Testing to mqtt.

LMixerPrint("Testing");

Note

Only one message can be displayed on the UI at once, if multiple messages are made, only the latest is displayed.

Details

This is actually just adds a error message to the mqtt, however, using the appropriate function is recommended since if it is later updated, it will be correct.

Edit this page
Prev
LMixer
Next
Mixing technique