Lightning is an interactive signal processing application. It is a freeware program with the purpose of controlling disco lighting equipment on a PC. Currently Lightning is in beta stage and does a decent job so far. Some features are not completed yet, such as DMX support. The Elektroda website has good add-ons for that (use Google Translate). Older desktop files can be loaded with any new version of Lightning.

This program is mainly suitable for controlling conventional lights, such as PAR spots, strobo lights and on/off switchable effects. Intelligent (DMX) lighting could be controlled too. Easier to use software exists for that purpose (see Links page).

This 32 channel DLOP runs a network server. The Lightning program can connect to it. This way Lightning can retrieve the light status from DiscoLitez.

At first launch the DLOP will ask for the network port number, which will then be stored in a .ini file. Leaving the default setting is recommended. Make sure to tune each light that should be forwarded in DiscoLitez, by enabling
hardware output and selecting the "Lightning Network Server" DLOP.

The DLOP runs as a server. In Lightning information can be retrieved from it by adding an inNetworkClient module. Set the correct hostname ("localhost" if DiscoLitez and Lightning run on the same PC) and port in the module's settings and check the "Binary mode" checkbox (non-binary mode won't work). Finally press "Update".

Now the inNetworkClient module's outputs reflect the light status from DiscoLitez. Up to 100 times per second the status of all lights will be updated, using a 4 byte packet.

Paul Abbott made this 8 channel DLOP that outputs to an USB light rig. This is especially useful for laptops that don't have a parallel port. The DLOP can communicate with a single 8 bit FT245 chip. To use it in Lightning, place the DLOP file in the Lightning directory, so that it appears in the "DLOP" menu. To use multiple instances, create copies such as DLO_ft245usb_2.dll, DLO_ft245usb_3.dll etc.

Basics

Modules can be moved by dragging using an empty area on the module. Usually using the topmost area of a component works best.

A context-menu will appear after right-clicking on an empty area of the module, such as the topmost area. The context-menu can be used to delete the module, set a custom color for the module's (normally invisible) title bar and more.

Modules can be interconnected by dragging from an output to an input. That way the spectrum data from the output is passed on to the input.

A spectrum signal transfers multiple (512) values of 0.0..511.9 each.

A level signal transfers a single value of 0.0..511.9.

A status transfers a single value of either 0.0 or 511.9.

A pulse transfers a single value of 0.0 followed by a single value of 511.9.

Any signal can be connected to any signal and will automatically be converted as needed.

Going from spectrum->level->status averages the information.

Going from status->level->spectrum spreads the information.

Connections can be deleted by right-clicking on an input or output.

Only a single connection can exist per input or output. This can be gotten around by using Split (or Double) and OR components.

Circular loops are prohibited and will automatically be broken apart.

To see the meaning of an input or output, you can hover over it so that the status bar will change and tooltip may appear.

A details window will appear after clicking on the ellips (...) that exists on some modules.

This version of Lightning contains support for programs and scenes. Please check the Elektroda website and use Google Translate or see the example setups contained in the Lightning package.

Lightning comes with a DLL for each module. With built-in runtime libraries, each DLL's size would be about 300 kB, adding up to many megabytes. With separate runtime libraries, the size of each DLL is only about 20 kB, saving much disk space.

Where does Lightning store its settings?

Lightning stores its settings in the registry key HKEY_CURRENT_USER\Software\Lightning.

Why does the program use so much CPU power?

Using the default settings, Lightning evaluates every path starting from each input module once after every 10 milliseconds. Because each signal consists of a full audio spectrum, this takes a considerable amount of processing power, growing every time the signal is split. The 10 milliseconds interval could be increased so that the program uses less CPU power, but then fades will become less accurate and time sensitive modules, like Keep, Extend and Require will suffer. Still intervals like 20 or 30 milliseconds give nice results while they greatly reduce CPU usage. On the contrary, if you have a really fast CPU (in the quad-core range), the interval could be reduced up to 1 milliseconds for smoother results.

Why do the inParallelPort, outParallelPort and outParallelPortMux modules show "Please install SmallPort driver"?

The following module caption will appear if the SmallPort driver could not be found:

Because Windows NT does not permit direct access to hardware, the SmallPort driver (smport.sys) is required in order to access parallel ports. The SmallPort driver can be installed using the Tools->Configuration dialog. Clicking any of the buttons will require elevation to administrator rights. The recommended choice is "Install (auto start)". Choosing "Install (manual start)" will disable non-administrator users from utilizing the driver. Repairing or Removing the SmallPort driver sometimes requires a system reboot.

What are the inAvsBeat module and BDetect application for?

Lightning allows for extremely customizable beat detection using modules such as StereoAudio, Select and Comparator. Sometimes this complexity is not wanted however and basic beat detection is sufficient. In such cases the BDetect tool can be handy. It will attempt to autodetect audio beats without any configuration necessary. Detection can be optimized by slightly adjusting parameters, but making big changes to parameters is not recommended. At each beat the tool will send a window message to the inAvsBeat module. The inAvsBeat module will output a pulse every time a window message is received. If there's no external source, the inAvsBeat module will never output pulses.

What are the inDMX module, outDMX module and DMXLink application for?

Rather than implementing the details of each of the hundreds available different DMX interfaces in Lightning itself, this job is left to a separate tool: DMXLink. This way Lightning can talk to the DMX interface without having to worry about implementation details. In this sense the DMXLink tool is a driver.

Lightning's dmx_out module communicates with DMXLink using window messages to set DMX channel values. DMXLink communicates with the actual hardware using proprietary protocols. An advantage of the DMXLink program being separate from Lightning is that multiple running instances of Lightning can output values to or gather values from the same DMX interface. In the future, applications other than Lightning could use DMXLink too, for example a DMX DLOP for DiscoLitez could be made.

Currently DMXLink only supports the Elektor LPT-DMX interface. In the future support will be added for additional DMX interfaces, making the tool much more useful. DMXLink will be improved with support for multiple DMX interfaces. It manages several "virtual" DMX universes. Various interfaces (DMX, MIDI, parallel, serial, ethernet) could be laid out in the virtual universes. This is the same principle as DMX fixtures that are laid out in a DMX universe using their addresses.

In the ideal world all DMX software could then use the DMXLink program, so that all programs would be compatible with eachother and with each interface. This is like porting the DMX4Linux idea to Windows.

What is LUA?

LUA is a scripting language. It can be used to create simple modules for Lightning. Scripts that comply to the Lightning format will be autodetected if placed in the same folder as Lightning. LUA modules will look and feel like normal Lightning modules, but consume more CPU power. The input to the LUA script will automatically be converted from a spectrum (1024 values in the range 0..511,9) to an average value (1 value in the range 0..511,9). The output from a LUA script module will be converted back from a value to a spectrum. Using values instead of spectrums reduces the CPU time used by LUA modules. For example scripts, see the *.lua files in the Lightning folder.

Some people requested access to Lightning's source code. Not all of its source code is ready to give away yet. New pieces of source code will be added to this page over time. All source code is for use with Borland Delphi 7.

All published source code is available under the terms of the Mozilla Public License.

As a result, any source code file can be used in any application, even proprietary closed source applications.

In all cases the source code of original files and modifications to them must be published.

The source code to neighbouring files not needs to be published.

It is intentionally prohibited to use the source code inside GPL and LGPL applications.

Creating new modules
Each Lightning module contains an "$IMAGEBASE" directive, for example:
{$IMAGEBASE $41380000}
This ensures that the modules are being layed out in memory in an non-overlapping way and optimizes start-up time. Please remove this directive in new modules, or use a non-overlapping address.