Quick Sign In:  

Forum: VirtualDJ 8.1 Technical Support

Topic: RGB LED definitions

This topic is old and might contain outdated or incorrect information.

oursoulHome userMember since 2009
I'm having trouble configuring the RGB LEDs on my controller in the definition file, and hope someone can help please! I am very new to all this scripting lark and get confused between mapping and definition sometimes and what should go where...

My controller has 40 RGB led pads, each capable of producing 127 different colours, and the colour is dictated by the velocity sent to whichever pad.

I have a chart in the controllers manual which gives the hex values of the colours next to their velocities, but don't think the controller actually uses these to produce the colours, it's just for info.

Rather than having to keep referring to this chart, I am wondering if there's some way of defining a few useful ones i.e. velocity 0x02=red, 0x04=blue, so when i need to use them i can insert the word 'red' or blue' in a mapping command and have it produce that colour?

I've tried using the examples here: http://www.virtualdj.com/wiki/RGB%20Leds.html
but they don't do anything, hence the question about setting up my own definitions for certain colours.

At the moment i've defined my LED pads like this in the Definition file:

<color note="0x00" min="0x00" max="0x7F" name="LED _CLIPLAUNCH1" channel="0" />
<color note="0x01" min="0x01" max="0x7F" name="LED _CLIPLAUNCH2" channel="0" />
<color note="0x02" min="0x02" max="0x7F" name="LED _CLIPLAUNCH3" channel="0" />
...
<color note="0x27" min="0x39" max="0x7F" name="LED _CLIPLAUNCH40" channel="0" />

...but i'm not sure if <color note> is the correct term to use - i've also seen people using <led note>?

When i'm in VDJ I can see all the LED _CLIPLAUNCH in the controller mapping section, but until i know if i'm actually setting them up right i can't work out why they aren't working! (my next question will no doubt be how do you send info from the mapping file to the controller).

The ultimate aim is to have the LEDs light up constantly when i first start it up and nothing's happening, to show where the Cue/Play/loop buttons etc are, then have them blink/change colour when active, eg. sync button constant red until pressed then flashing in time with the tempo when in sync / play button flashing while playing, constant while paused etc etc. (I'd also like to get some tempo 'bar' and vu meter action going on, but lets not run before we can crawl... ;)

Any help, as always, would be most appreciated...

 

Posted Fri 15 Jul 16 @ 9:33 am
oursoulHome userMember since 2009
oops just noticed the MIN value was counting up with the note number when it should always be min="0x00" max="0x7F", that's what you get for using bloody spreadsheets...

so i've corrected it to:

<color note="0x00" min="0x00" max="0x7F" name="LED_CLIPLAUNCH1" channel="0" />
<color note="0x01" min="0x00" max="0x7F" name="LED_CLIPLAUNCH2" channel="0" />
<color note="0x02" min="0x00" max="0x7F" name="LED_CLIPLAUNCH3" channel="0" />
<color note="0x03" min="0x00" max="0x7F" name="LED_CLIPLAUNCH4" channel="0" />

does that look right?
 

Posted Fri 15 Jul 16 @ 10:43 am
oursoulHome userMember since 2009
Right, i've changed all the pads to:

<led note="0x00" min="0x00" max="0x7F" name="LED_CLIPLAUNCH1" channel="0" />
<led note="0x01" min="0x00" max="0x7F" name="LED_CLIPLAUNCH2" channel="0" />
<led note="0x02" min="0x00" max="0x7F" name="LED_CLIPLAUNCH3" channel="0" />
<led note="0x03" min="0x00" max="0x7F" name="LED_CLIPLAUNCH4" channel="0" />
etc.etc.

...as i think <color note> is for if you need to assign hex numbers to velocities (which i don't think i do)...

So the simple question is, is there a way to define colours so a value can be assigned to a text description?

I.E:

0x04="RED"
0x08="LIGHT ORANGE"
0x0C="BRIGHT YELLOW"
0x10="NEON GREEN"

The text description would then be used in the mapping instead of sending the corresponding velocity.

 

Posted Fri 15 Jul 16 @ 2:01 pm
djdadPRO InfinityDevelopment ManagerMember since 2005
are we talking about Leds that offer x7F=127 different colors ? Do you have some table with the colors each of the values offer ? Do they follow some specific bit pattern ?
 

Posted Fri 15 Jul 16 @ 4:44 pm
oursoulHome userMember since 2009
I thought you'd never ask ;)

Yes there are 127 different colours, but as the controller's made for Ableton they don't go in a very logical order, apart from they match the order in Ableton:

I won't paste the lot, but this is the data i've got from the manual:

RGB LEDs

Name Color Velocity
60 #000000 0
59 #1E1E1E 1
58 #7F7F7F 2
57 #FFFFFF 3
1 #FF4C4C 4
2 #FF0000 5
3 #590000 6
4 #190000 7
5 #FFBD6C 8
6 #FF5400 9

I've worked out and noted down what all the colours are (yes 128 of them), and converted the velocities to hex, so I should have all the information required to make a colour definition script - if indeed such a thing is possible? In the VDJscript instructions for v8 it states that there are pre-defined colours:

"For LEDs that offer a MIDI note or cc with the colors defined in velocity you can define the color of each velocity value by providing a pre-defined color, an html color code etc as following:
note/cc - the MIDI note or cc of the LED
values - the velocity values and their assigned colors separated by comma (,). Can use :
pre-defined colors
"red",ARGB(255,255,0,0),
"green",ARGB(255,0,255,0),
"blue",ARGB(255,0,0,255)...etc"

Maybe this answers my question (but would mean i've got to convert the hex values to the RGB values).

There is also this tantalising bit, but i don't think this applies to velocities but to midi cc's:

RGB - Multicolor LEDs Leds that can offer various colors can be defined with a <color> element with the following properties:
ccred - MIDI cc for the red color intensity
ccgreen - MIDI cc for the green color intensity
ccblue - MIDI cc for the blue color intensity
Example:
<color ccred="0x35" ccgreen="0x36" ccblue="0x37" name="LED_DECK_LEFT" deck="1" channel="0" />

Sorry for asking people to explain what is probably clear to those who understand script, like i said, i'm new to all this (but enjoying it!)

Cheers


 

Posted Fri 15 Jul 16 @ 7:25 pm
oursoulHome userMember since 2009
So interestingly, when i changed from <color note> to <led note> and switched on the machine, i can no longer see the LED entries in the controller mapping.

<led note="0x00" min="0x00" max="0x7F" name="LED_CLIPLAUNCH1" channel="0" />

when specifying a "name", should it correspond exactly to something already in the button definitions?

<button note="0x00" name="Clip Launch 1" channel="0" />

I just invented the LED_CLIPLAUNCH1 name as i thought it would help identify it as a separate entity to the button (plus every example i've seen had the name with an underscore and not spaces - is it important not to have spaces in the name?)
 

Posted Fri 15 Jul 16 @ 9:00 pm
oursoulHome userMember since 2009
OK, to carry on the one-sided conversation...

The problem with <led note> was i'd put <name> after the min/max values - moving the name before min/max made the leds appear in the controller mapper again.

This syntax works:

<led note="0x00" name="LED_CLIPLAUNCH1" min="0x00" max="0x7F" channel="0" />

but this doesn't:

<led note="0x00" min="0x00" max="0x7F" name="LED_CLIPLAUNCH1" channel="0" /> (just for info, in case it helps someone else)

---

So now in mapping i'm using:

play ? get_constant 0.80 (linked to LED_CLIPLAUNCH1)

and when i press play (using the vdj on-screen button) the LED lights up different colours depending on the value of get_constant.

unfortunately, if i press the same button on the controller, the led doesn't stay lit. I think this is because by default on this controller each pad lights up green while pressed, so must be cancelling out the outbound message from VDJ to the controller. Any ideas how to remedy that?

I'll be back to answer my own question later maybe... ;)



 

Posted Fri 15 Jul 16 @ 9:44 pm
djdadPRO InfinityDevelopment ManagerMember since 2005
Since those LEDs offer RGB colors it is advised to use <color instead of <led
<color note="0x00" channel="0" values="table" name="LED_CLIPLAUNCH1" table="0=black,1=#1E1E1E,2=#7F7F7F,3=#FFFFFF,4=#FF4C4C, ...... etc "/>

use values="table" to all of the <color lines (leds)
define table="" only in one of them (e..g the first <color of your definition
The table shows what colors will the controller show if the X value is given. table="value1=Color1, value2=Color2, ..., valueX=ColorX
value can be decimal like the example or hex (needs to be 0x00=Color1, etc) but in your case since the provided table shows decimal values, you dont have to convert them
ColorX can be one of the pre-defined VDJ colornames like red, gree,black etc, or #html, rgb etc.
In the above example if VDJ needs to send the color #FF4C4C, it will send 90 00 04

If you define the LEDs as <color then you can use the following actions.
color 'red'
color '#FF4C4C'
play ? color 'green' : color 'red'
get_sampler_color X
cue_color X
etc
which is much better than the constant X action (no one will ever remember the required decimal values) and also serves some special actions that automatically return the color of a sample or hotcue
 

Posted Sat 16 Jul 16 @ 3:41 pm
oursoulHome userMember since 2009
That's very interesting, as i had initially set them up using <color, but had put all the possible colour variations on every <color note line in value="" which made the thing look very messy (and huge)

so let me get this straight:

first line is
<color note="0x00" channel="0" values="table" name="LED_CLIPLAUNCH1"

followed by

table="0=#000000,1=#1E1E1E,...etc up to 127=#4B1502"/>

then all the remaining lines would be just

<color note="0x01" channel="0" values="table" name="LED_CLIPLAUNCH2"/>
<color note="0x02" channel="0" values="table" name="LED_CLIPLAUNCH3"/>

etc etc for the rest up to

<color note="0x27" channel="0" values="table" name="LED_CLIPLAUNCH40"/> (0x27 being the last pad capable of RGB colour).

Is that correct?

Also does this mean you could only use a colour's name (red, green etc) if it had already been predefined in VDJ as matching a certain hex value? I only ask because there are about 9 different hues of red and green, so which one would it choose if i just said 'green'?

It seems a strange way to define the table, having it as part of 1 line in the <color note list. I was hoping a table could be defined as a separate section in the definition file - really for the sake of tidiness so i could add a <--! colour table> heading so i knew where i was in the xml file - and it would be laid out more like 1=#1E1E1E="Mauve", thereby defining what a velocity of 1 meant hexadecimally as well as giving it a useable name.

I do like the idea though, thanks for bringing it to my attention :)
 

Posted Sat 16 Jul 16 @ 10:39 pm
djdadPRO InfinityDevelopment ManagerMember since 2005
yes, the syntax is correct. You only have to define the table="" once (inside any of the your <color /> keys.
Here is the table for the APC40MKII

table="0=black,1=#1E1E1E,2=#7F7F7F,3=#FFFFFF,4=#FF4C4C,5=#FF0000,6=#590000,7=#190000,8=#FFBD6C,9=#FF5400,10=#591D00,11=#271B00,12=#FFFF4C,13=#FFFF00,14=#595900,15=#191900,16=#88FF4C,17=#54FF00,18=#1D5900,19=#142B00,20=#4CFF4C,21=#00FF00,22=#005900,23=#001900,24=#4CFF5E,25=#00FF19,26=#00590D,27=#001902,28=#4CFF88,29=#00FF55,30=#00591D,31=#001F12,32=#4CFFB7,33=#00FF99,34=#005935,35=#001912,36=#4CC3FF,37=#00A9FF,38=#004152,39=#001019,40=#4C88FF,41=#0055FF,42=#001D59,43=#000819,44=#4C4CFF,45=#0000FF,46=#000059,47=#000019,48=#874CFF,49=#5400FF,50=#190064,51=#0F0030,52=#FF4CFF,53=#FF00FF,54=#590059,55=#190019,56=#FF4C87,57=#FF0054,58=#59001D,59=#220013,60=#FF1500,61=#993500,62=#795100,63=#436400,64=#033900,65=#005735,66=#00547F,67=#0000FF,68=#00454F,69=#2500CC,70=#7F7F7F,71=#202020,72=#FF0000,73=#BDFF2D,74=#AFED06,75=#64FF09,76=#108B00,77=#00FF87,78=#00A9FF,79=#002AFF,80=#3F00FF,81=#7A00FF,82=#B21A7D,83=#402100,84=#FF4A00,85=#88E106,86=#72FF15,87=#00FF00,88=#3BFF26,89=#59FF71,90=#38FFCC,91=#5B8AFF,92=#3151C6,93=#877FE9,94=#D31DFF,95=#FF005D,96=#FF7F00,97=#B9B000,98=#90FF00,99=#835D07,100=#392b00,101=#144C10,102=#0D5038,103=#15152A,104=#16205A,105=#693C1C,106=#A8000A,107=#DE513D,108=#D86A1C,109=#FFE126,110=#9EE12F,111=#67B50F,112=#1E1E30,113=#DCFF6B,114=#80FFBD,115=#9A99FF,116=#8E66FF,117=#404040,118=#757575,119=#E0FFFF,120=#A00000,121=#350000,122=#1AD000,123=#074200,124=#B9B000,125=#3F3100,126=#B35F00,127=#4B1502"


When VDJ handles colors, it accepts either one of the pre-defined ones (by its name - look here), or an #html, a Rgb (255,255,0) and that is in both definition and mapping.
In version 8.1 you will need to use the constant action and VDJ expects a 'text' as value. E.g. constant 'green' or constant '#00FF00' etc
In version 8.2 you also have the more friendly action color 'green' which more or less offers whatever the constant actions does , but also take some parameters like color 'red' 50% will return a 50% dimmed red.

Keep also in mind that when a color is selected via a script . eg. color '#45997F' (no idea what color is this lol), it will then read the table values, will find the closest available color and will send the appropriate value to that LED.

You cannot define your own colors. So if you want a LED to light up as Mauve, you will need to use color '#1E1E1E' in your mapping file and VDJ will llook into the tale, see if the #1E1E1E exists (if not , will find the closest) and will sent the defined hex/dec value for that note.

Last but not least, no idea which version/build you use, but strongly recommend to use version 8.2 to get the maximum out of colors (and make sure all work as expected - some things may not be available in ver 8.1 , such as defining table once in definition)

 

Posted Sun 17 Jul 16 @ 10:58 am
oursoulHome userMember since 2009
Ok, I might try all this out in a couple of weeks time (i've got a gig in a couple of weeks, and need to spend some time practicing rather than messing about with scripting!). For the moment i'm quite happy with using the <led note> method, as i don't really need it to do anything fancy like returning hot cue colours, just wanted to be able to light up certain pads to denote which is which - which i can now do thanks to your help with getting it into Ableton Live mode. Then it was just a case of going through all the constants 0.01-1.0 and picking a few colours i liked.

So my final question (for now, anyway;) is how would VDJ deal with the RGB 'states' that are also in the manual? They are dictated by MIDI channel on the same note:

RGB LEDs Type

MIDI Channel Function
0 Primary Color
1 Secondary Color – Oneshot 1/24
2 Secondary Color – Oneshot 1/16
3 Secondary Color – Oneshot 1/8
4 Secondary Color – Oneshot 1/4
5 Secondary Color – Oneshot 1/2
6 Secondary Color – Pulsing 1/24
7 Secondary Color – Pulsing 1/16
8 Secondary Color – Pulsing 1/8
9 Secondary Color – Pulsing 1/4
10 Secondary Color – Pulsing 1/2
11 Secondary Color – Blinking 1/24
12 Secondary Color – Blinking 1/16
13 Secondary Color – Blinking 1/8
14 Secondary Color – Blinking 1/4
15 Secondary Color – Blinking 1/2

As all the led notes are currently set up to use channel '0', would it mean duplicating each note in the definition file 15 times to cover all possible channels?

e.g.

<led note="0x00" name="LED_CLIPLAUNCH1" min="0x00" max="0x7F" channel="0" />
<led note="0x00" name="LED_CLIPLAUNCH1_ONESHOT1_24" min="0x00" max="0x7F" channel="1" />
<led note="0x00" name="LED_CLIPLAUNCH1_PULSING1_24" min="0x00" max="0x7F" channel="6" />

Though heaven knows how you'd go about getting it to switch from primary to secondary pulsing if playing... That doesn't seem like it would work from my (admittedly limited) knowledge of vdjscript.

The reason i ask is because I've had a small amount of success with 'blink' commands, though they don't blink in time with the music. Reading elsewhere in the forums it sounded like there wasn't a way to get it to blink following the tempo, and you'd have to state the blink rate in ms which isn't ideal if you change pitch at any point during your set (unless you take a calculator to gigs, which i don't usually). I did try using get_beatgrid (as was suggested in this other post) but instead of flashing the requested colour the pad cycled through all of the colours in rapid succession - it looked awesome, but not what i was going for!
 

Posted Sun 17 Jul 16 @ 8:31 pm


(Old topics and forums are automatically closed)