Page 1 of 1

RGB via OSC

Posted: 01 Dec 2014 18:29
by Suloo
Hi there,

i`m currently setting up a cliplauncher for Bitwig via OSC, but i cannot get my head around a solution.
The open API by Bitwig makes everything easier i think, still i would need some help.
I've read the manual and also searched in here to find ways, but didn`t find what i was looking for sadly.

Basically i got an 8x8 Clipgrid and i would like to use switches.
We got an observer in Bitwig wich sends out the clip colors in RGB.

For example:

darkgray: RGB(0.3294117748737335, 0.3294117748737335, 0.3294117748737335)
grey: RGB(0.47843137383461, 0.47843137383461, 0.47843137383461)
lightgrey: RGB(0.7882353067398071, 0.7882353067398071, 0.7882353067398071)
greyblue: RGB(0.5254902243614197, 0.5372549295425415, 0.6745098233222961)

whenever i change the color of a clip i can receive the value in Lemur via:

/track/{1-8}/clip/{0-7}/color

I can monitor what Bitwig exactly puts out with the monitor modul, so i got a list of 30 different colors like that above wich i want to use.

Questions:

1. Can i set up a switch to change its color by any color from RGB range wich is sent out by Bitwig?
2. Or do i need to make a multiline script onLoad (or onOSC ??) telling the switch, that these exact colors could arrive, and that it should then change its color according to it.

I´ve set up a little script i found in the forum but it just colors the object in the first color of the array: This is execution onLoad.

Code: Select all

decl color_array= {RGB(0.3294117748737335, 0.3294117748737335, 0.3294117748737335),RGB(0.47843137383461, 0.47843137383461, 0.47843137383461)};
setattribute(Switches65,'colors',color_array);
Switches65 is the name of my switch.

If you could show me how to do such a think, it would be great!

thanks
Mark

Re: RGB via OSC

Posted: 01 Dec 2014 21:51
by Suloo
ok, i made a rather around the corner approach by setting up this, but its not working:

Code: Select all

decl darkgrey = RGB(0.3294117748737335, 0.3294117748737335, 0.3294117748737335); //those are the color values i get from the API
decl grey = RGB(0.47843137383461, 0.47843137383461, 0.47843137383461);
decl lightgrey = RGB(0.7882353067398071, 0.7882353067398071, 0.7882353067398071);
decl greyblue = RGB(0.5254902243614197, 0.5372549295425415, 0.6745098233222961);
decl darkbrown = RGB(0.6392157077789307, 0.4745098054409027, 0.26274511218070984);
decl lightbrown = RGB(0.7764706015586853, 0.6235294342041016, 0.43921568989753723);
decl darkblue = RGB(0.34117648005485535, 0.3803921639919281, 0.7764706015586853);
decl lightblue = RGB(0.5176470875740051, 0.5411764979362488, 0.8784313797950745);
decl purple = RGB(0.5843137502670288, 0.2862745225429535, 0.07960784435272217);
decl pink = RGB(0.5809804010391235, 0.21960784494876862, 0.4431372582912445);
decl red = RGB(0.8509804010391235, 0.18039216101169586, 0.1411764770746231);
decl orange = RGB(1, 0.34117648005485535, 0.0235294122248888);
decl beige = RGB(0.8509804010391235, 0.615686297416687, 0.062745101749897);
decl gras = RGB(0.45098039507865906, 0.5960784554481506, 0.0784313753247261);
decl green = RGB(0, 0.615686297416687, 0.27843138575553894);
decl aqua = RGB(0, 0.6509804129600525, 0.5803921818733215);
decl skyblue = RGB(0, 0.6000000238418579, 0.8509804010391235);
decl lightpurple = RGB(0.7372549176216125, 0.4627451002597809, 0.9411764740943909);
decl porky = RGB(0.8823529481887817, 0.4000000059604645, 0.5686274766921997);
decl skin = RGB(0.9254902005195618, 0.3803921639919281, 0.34117648005485535);
decl lightorange = RGB(1, 0.5137255191802979, 0.24313725531101227);
decl lightbeige = RGB(0.8941176533699036, 0.7176470756530762, 0.30588236451148987);
decl lightgrass = RGB(0.45098039507865906, 0.5960784554481506, 0.0784313753247261);
decl lightgreen = RGB(0.24313725531101227, 0.7333333492279053, 0.3843137323856354);
decl lightaqua = RGB(0.26274511218070984, 0.8235294222831726, 0.7254902124404907);
decl lightsky = RGB(0.2666666805744171, 0.7843137383460999, 1);

if (getattribute(clip1,'colors') == greyblue) //clip1 is a monitor object that is receiving the color value in RGB
{
setattribute(Switches65,'colors',greyblue); //Switches65 is my actual switch
}
would i need to put both inside container or is there a better way to update the switch colors according the colors in the DAW?

The file is attached..

this also doesn`t work:

Code: Select all

getattribute(clip1, 'colors');

if ('colors' == red)

{
setattribute(Switches65,'colors',red);

}

Re: RGB via OSC

Posted: 03 Dec 2014 06:11
by Macciza
Hi
Re, only changing to first color in list , Have you made sure to select MultiColor for the object?
With that selected it should change to two alternating colours....

You might need to go through some programming basics first to get a handle on things like variables and memory etc
The script at the bottom doesn't work because of a number of reasons , the get attribute bit is not stored anywhere
And so you can't just compare 'colors' as it doesn't exist anywhere
Needs to be something like
decl acolor = get attribute etc
If ( a color == whatever) etc

What exactly does bitwig send ? A name or numbers? I've /oscaddressstuff/color 'grey' or /color .3 .7 .5 ?
If it sends a name then define those colors globally as expressions, match against the name and refer to the expression
If it sends as numbers then you would simply use those numbers in a script to set the relevant color

Hope that helps a little