Forums > MaxMSP

### MIDI to DMX light show simulation in MAX?

Apr 01 2010 | 4:45 pm

hey guys! i have been scowering the internet for some sort of program to simulate simple on and off lights from midi messages.

Alright, so maybe i can be a little more specific so that you can understand my situation a little better. I program lights (through the Piano Roll in Logic Pro) for my own band to run lights completely automated live. I use a MIDI to DMX converter called a Lanbox to convert these midi notes to the lighting DMX data language which is quite similar to midi. MIDI note 1 = DMX channel 1. MIDI note 2 = DMX channel 2. The velocity of the note also determines the intensity of the light, so for example if you were playing a midi keyboard hooked up to my lighting rig, a soft note would make a dimmer light, but if you slam on the keys that light will be as bright as it can be at a value of 127.

The problem is, I have been starting to program other band’s lights and things are getting pretty friggen complicated. My current band i’m working on actually wants 18 guitar cabinets stacked up in 3×3 grids (a 36 light matrix) on both sides of the stage full of lights, and finding the right midi channel in the Piano Roll in logic for the 49th or whatever light might be a little tedious. So i would like to have something that simulates the light show without having to be in front of a wall-o-lights.

So take for example the very first light (the very top left "LED" in my .maxpat file). To simulate the midi -> lights, it needs to only turn on when a pitch of 1 is received along with it’s accompanying velocity value. when velocity value goes to zero for that note, it needs to turn off. It should react much like just hooking up the LED directly to the velocity outlet of notein, but it needs to only react to a velocity value of pitches of it’s channel number. The same thing needs to happen to light #2 (to the right of the first one) but it needs to be separate from the 1st channel in that it only reacts to pitch values of 2…. and so on up to 72 times.

I apologize for asking for help for this, as I guess you get many inquiries about how to do things. Let me know if you can maybe show me an example of how to get this working either by text or by moving stuff around in my .maxpat file. I’m stoked on this program, i’m just unsure how to go about this.

Thank you so much!

Lee Duck
Sky Eats Airplane

###### Attachments:
1. wtf.maxpat
Apr 01 2010 | 5:11 pm

So, if I got that right, you just want something to visualize the whole thing right?

I suggest using a jit.matrix to do so, I might be wrong but to me it looks like the easier solution.

Like this :

``````
-- Pasted Max  Patch, click to expand. --

```
```
Apr 01 2010 | 11:30 pm

thats a pretty good idea, i really appreciate it, but i don’t mind extra repetitive programming if it gives me the ability to really visualize the scene. i would like the ability to move around the lights to simulate it as close to the real thing as possible, and i feel that a pixelly matrix grid might not do it justice, although that would be sweet if i found a way for the matrix object to organize the items better. I am trying to work with "pack"ing the note and velocity values together and maybe do some sort of "if __ then __" as a filter to only let in the assigned light value to the certain light… and then just repeat it with respective values for the rest of the lights, although I’m not a very savvy programmer at all. any tips on how to possibly get this working?

Apr 02 2010 | 12:14 am

Okay… for repetetive tasks, two things are your friends: bpatcher and coll. Using bpatcher means you can write code for a piece of the problem and then reuse the code several times for the whole task. Using coll, you can store data which will allow you to tweak behaviour for similar (but not identical) things.

Most of the work is done in "MIDI_lightblock.maxpat" this is a 3×3 block of panels which accepts: MIDI note on/off messages prepended by "note"; messages of the form "on i r. g. b." to set light i to have r. g. b. as the "on" color; "all " to send the message to all the panels in the 3×3 grid; sending a "base i" message will set the top-left light to respond to MIDI note i. The colours of the panels are set based on the "note" messages and the "on" colours, giving half brightness at velocity 64. NB: This will come up in presentation mode when it’s opened.

"MIDI_lights.maxpat" has 4 of these blocks configured to respond to notes 1-9, 10-18, 19-27, 28-36.

###### Attachments:
1. MIDI_lights.maxpat
Apr 02 2010 | 12:45 am

If I may, I think this might be a bit simpler?

Using thispatcher with a script message to address each led object. Each led are named light1 through light36, corresponding to 36 channels.

``````
-- Pasted Max  Patch, click to expand. --

```
```
Apr 05 2010 | 7:42 pm

7inches that RULES! is there any way to do it with the thispatcher and have the notes respond to noteoffs? the lights should stay "lit" when the note is held and then turn off when the keyboard is released (velocity of 0). ive looked up flush and other values and it doesnt seem like it simulates a true midi keyboard with noteoffs.

You are my hero man!

lee

Apr 06 2010 | 11:19 pm

Using a polyphonic kslider does that, like this:

— Pasted Max Patch, click to expand. —
Apr 08 2010 | 5:44 pm

this is absolutely fantastic. i am SO stoked on this. i tried messing with the values a little to yield a black-to-yellow LED instead of black-to-white LED (to simulate lights even more) but couldnt figure it out. this is totally just icing on the cake, but where would this option possibly be changed?

i really appreciate you guys helping me with this. i’m going to be using this program much more now!

Lee

Apr 09 2010 | 9:09 pm

You could just replace the

`script sendbox \$1 offcolor \$2 \$2 \$2 1.`

with

`script sendbox \$1 offcolor \$2 \$2 0. 1.`

Apr 17 2013 | 1:07 pm
``````
-- Pasted Max  Patch, click to expand. --

```
```
Viewing 10 posts - 1 through 10 (of 10 total)

Forums > MaxMSP