Controlling video and lighting with Max

Mattijs's icon

I build software to control video and lighting, which I test regularly at techno parties, cooperating with motion graphics designer Jaap Drupsteen and lighting designer Bob Roijen. All video and lighting are controlled with Ableton Live and custom Max applications, replacing any lighting desks or media servers.

Nat's icon

Very nice, I've worked with a lot of persons who only trust their very expensive lighting desks, nice to see Max used to drive large installations !

Basvlk's icon

very nice! but where do we see what it looks like in action?

Stephane Morisse's icon

@ Nat : very expensive, and some still "relying" on floppy disks... :)

Mattijs's icon

Hey all, thanks for the kind words.

Here's some footage of this in action:
https://vimeo.com/89710100
https://vimeo.com/89712864

A more lighting-oriented video from a different set:
http://youtu.be/8F9XU12n9TU

Cheers,
Mattijs

Matthieu Pernaud's icon

Nice !

As I also just started to make custom max/msp patches to drive lightings, I'm really curious about the gear you use to transmit dmx (lanbox ?) to the lighting system. Could you tell a bit more about this ?

hepi's icon

Are you sharing these patches? or parts of them?

Mattijs's icon

@Matthieu: I get a lot of questions about how this works, so here's an attempt at a quick rundown, hopefully it is of some use for those who think about controlling lighting with Max.

First of all it's important to understand what DMX is. In as little jargon as possible:

  • DMX is just a series of 512 values transmitted about 30 times a second, sent over cables with XLR connectors (3-pins, sometimes 5-pins).

  • every lighting fixture (strobe, moving head, LED bar, smoke machine) has a DMX in -and- a DMX out connector, i.e. it mirrors the input to the output, the fixtures are all connected like a daisy chain.

  • every lighting fixture has a certain number of parameters and a DMX address.

  • if a moving head fixture has 15 parameters and is set to address 163, it will look at the 512 DMX values and pick the 163rd for parameter 1, the 164th for parameter 2, 165th for parameter 3, etc, up to the 178th for parameter 15.

  • this means that when setting the address on a fixture, you need to keep in mind how many parameters the previous fixture has to make sure you don't have overlapping values. This is a process people call 'patching' the fixtures. It is done every time there is a new configuration of fixtures. When all addresses are set on the fixtures, these have to be set in the lighting controller as well (in what is called the 'patch list') so it knows what fixtures to control with what values in the series of 512.

  • if your fixture parameters add up to more than 512 values, you need an extra DMX line. A line is known as a 'universe'.

The most basic solution to transmit DMX from Max is this: http://www.enttec.com/?main_menu=Products&pn=70304, people have made max objects for it.

For sending multiple universes I prefer Artnet.

The purpose of Artnet is nothing more than to send DMX values over ethernet, with UDP packets. Every packet contains the 512 values and a universe value. This allows transmitting any amount of universes over ethernet, up to a maximum of 256 universes (split into 16 'subnets', each of which then has 16 universes).

These UDP packets have to be translated to DMX by an Artnet->DMX converter box (known as a 'node'), which can be set to look for a particular universe and output those packets as DMX from its XLR output ('DMX port').

The cheapest node I used (one per universe) is: http://www.enttec.com/index.php?main_menu=Products&pn=70305. It works great, although it has a fixed output frequency of 44 Hz (meaning it serially transmits all 512 DMX values, one 'frame', 44 times a second), which is the maximum allowed frequency for DMX. I had a situation where cheap LED tubes would only work properly with 30 Hz, so for that project I switched back to using Enttec USB Pro boxes, which transmit at 30 Hz, although I could also have used a more advanced (but much more expensive) node.

For more than 1 universe you can simply use a network switch (like http://www.netgear.com/business/products/switches/unmanaged/FS105.aspx#tab-techspecs) and connect multiple Enttec ODE's. They have a software tool, NMU, that allows you to set which universe from the Artnet stream to output as DMX for each box.

I also have good experiences with nodes with multiple ports, for example from ELChttp://www.elclighting.com/products/ethernet-dmx-nodes/16-dmxlan-node6x, this has a nice display that indicates which universes it is actually receiving data on and it allows you to route universes to different DMX outputs. I think it sells for around €2500,- usually we rent it for a few days together with the lighting fixtures.

One thing to note with an ELC node like this is that although it has 6 ports, standard Artnet (as opposed to ELC's own Artnet-like protocol) can only address 4 universes per IP address, so the extra 2 ports won't work as expected. Took me some time to figure out :p

8-port nodes typically have two IP addresses, like this one I used: http://www.acclaimlighting.com/products/product-detail/product/al-net-8.html, which worked fine, although this particular node has the limitation that it does not process packets sent by broadcast (i.e. sending to 255.255.255.255, which means sending to each device on the network), but only by unicast (i.e. sending the packets directly to the IP address of the node).

Something to understand when you are thinking of implementing Artnet in your patch; there are two important components:

A) the protocol that you use to send the values (basically an UDP packet with a header that identifies it as an Artnet packet and contains stuff like how many values it has, followed by the actual values (one byte each, maximum of 512 values).

B) the mechanism for polling existence of and information about the nodes in the network. For quick and dirty work you can usually find a way around this.

Officially for transmitting or receiving Artnet your computer should be set to an IP range of 2.x.x.x or 10.x.x.x, with subnet mask 255.0.0.0. For part B this is necessary (why? see below), but for part A it is not, as long as the UDP packets are sent to the IP(s) where you want them to be used it's all fine.

A is quite easy to put together from the Artnet-specification (http://www.artisticlicence.com/WebSiteMaster/User%20Guides/art-net.pdf, page 20-21), there are some examples patches available for Max. B is more work, I wrapped the artnet4j library (https://code.google.com/p/artnet4j/) in an mxj external for this.

Officially you are supposed to send your Artnet packets to the IP addresses of each available node separately: unicast. For this you need to know the IP addresses, so you officially need part B to auto-detect all IP addresses of systems that can handle Artnet.

Part B is essentially doing the same as when you type 'ping 2.255.255.255' and 'ping 10.255.255.255' in Terminal, look at the IP's in the replies and compose a list of the addresses of devices that you know can receive Artnet. This is why, when working with part B, you need your computer to be in those ranges.

But usually just broadcasting your part A packets (i.e. sending to IP address 255.255.255.255 so they get picked up by each node) works just as well as long as your nodes don't actively skip messages that are sent by broadcast, like the Acclaim one I mentioned above.

I admit that I found all this a bit confusing at start, I guess because you need to learn about DMX and about networking at the same time, and most devices will not show an error message when you make a mistake somewhere in the process, they will just not work and leave it up to you to guess why. But once you get an overview it's all quite straightforward and robust.

The real challenge is to come up with a user interface that allows you to control a lot of lights that each have a lot of parameters in a way that makes sense and allows for creativity. Lighting desks do a horrible job at that in my opinion ;)

Anyway, hope this helps, I guess I should take the time to write a proper tutorial for this..

Mattijs's icon

@Hepi: I would love to share this stuff but the more complex the patches are, the more time it takes to clean them up and make them useful for others.

Some of the stuff I use is available online though, at http://showsync.info. Hopefully in the future, more applications and plugins in this category will become available there.

Basvlk's icon

great examples Mattijs, thanks for sharing!

I'm working on adding visuals to my music but am looking at all kinds of triggers I could use to synchronise visuals to music. Do you do anything like that? I suppose as a minimum, you have time synchronisation with the music -but after that, are visuals generated by independent operators, or do you get some signals from the DJ(s) too to incorporate?

Andro's icon

Mattijs ! I've been busy trying out how to make a DMX controller in Max msp, that huge explanation you gave (especially the hardware aspect) was invaluable ! Thanks a lot !

Mattijs's icon

@Basvlk, thanks!

For festivals we only use the tempo and beat position of the DJs, analyzed by my custom beat tracker. The practical problem with trying to use more inputs in a festival setting is that there is no communication at all between the lighting/video people in the front of house and the performers on stage.

For the Feed Me live tour though, we make a lighting clip and a video clip for every sound clip in his Ableton Live set, which are mixed in real-time, depending on which clips he feels like using at any given time, and there are real-time visual effects linked with his audio effects.

@Andro: thanks, happy it helps!

keepsound's icon

Hi Mattijs,
I have read and download the artnet4j library (https://code.google.com/p/artnet4j/) but I can't wrap the code to implement it an mxj external. (that's only for the Art-Net Poll implementation.
I have problems with an unknown (and chinese) Artnet interface, (and I have two of them...). They receive in broadcast mode from a Madrix app, and the tx gets on 8 different dmx universes, but it seems the two interfaces receives the same information of only the first 4 universes on both. I have tryed to send the data packets on two distint IP addresses, but ther's no way to find out the MAC addresses of them (OEM Code maybe I've find it).
Now I've build a little app to extract the IP address from the OEM and MAC infos, but I have to poll the interfaces... could you be so gently to send me your java class script for the mxj?
This is my little app:

Max Patch
Copy patch and select New From Clipboard in Max.

Thank you in advance
Italo

Basvlk's icon

very cool stuff Mattijs!

Mattijs's icon

@keepsound: As soon as I have time I'll clean up the external, do more testing for scenarios other than how I use it myself and then publish it online. Things are busy at the moment though, I'm afraid I don't know when this will get done.

Best,
Mattijs

keepsound's icon

Hi Mattijs! many thanks for your reply here! At this moment I've abandoned this project, but maybe in the next time I'll consider to work now around it. Now I'm more interested in your other project about the SMPTE writer (I have to build a reader, remember?) . I've tryed to build my obj on XCode with the porject you have put here, but without success...I don't know anything about C++... best regards. And about busy things and works...here in Italy it's the same, if not busier. Best regards! Ciao . Italo

agustin genoud's icon

hi MATTIJS, this is a great intro to dmx!
What do you think about this interface ? http://www.enttec.com/?main_menu=Products&pn=70314
for testing purpuses can i connect it directly to a light and try some to patch some things or should i need something else? (im thinking in an amplifier or something like that -talking in audio terms-)

best!

Marcelo Padovani's icon

For those who are controlling dmx lightning using max or other tools, did any of you ever used something that return euller angles as rotation (such as look at functions in unity) and had to convert them to the pan/tilt system that moving heads for example use? How did you made the conversion between euller angles to pan/tilt rotations?

Thanks!

Luke Woodbury's icon

I don't claim to understand eulers and quaternions so I probably can't answer any follow up questions! But do objects like [jit.euler2quat] and [jit.quat2axis] help you any?

Mattijs Kneppers's icon

Just in case someone comes across this thread when looking for ways to control lighting with Max, here is a more up to date version of my initial DMX overview.

Also, Showsync is introducing a new (paid) package for Max to control lights: Beam for Max.