Can't get chase to work with a script

Discuss macro programming, and post any new macros here!
velimatti
Posts: 15
Joined: Fri Jan 16, 2015 6:27 am

Can't get chase to work with a script

Post by velimatti »

Hi Guys!

I've recently bought a bunch of LED tubes which don't have any built in brains, so basically I'm controlling ~500 RGB channels using DMXIS

It works great, but a lot of tweaking of course. So now I've been writing a bunch of python macros for it. I already have a nice table in a python file, which creates all of the macros dynamically for me if I do any edits to the colors etc.

I'm not a noob what comes to programming, but I can't figure out how the oscillator chase value value works. Lets say I select 100 channels in the UI, play around with the oscillator and color values and find something I like.

-> Now I have a macro which prints out the cannel RGB and oscillator (type, speed, amount etc) values to the console so I can copy/paste them from there to my 'fx table'. This is fantastic. I do this because I'm still figuring out my light configuration, and saving the settings to the bank presets don't do the trick. I mean if I put in more fixtures and change the DMX channel order, all of the presets will break -> so now I'm building python scripts so I can say 'find all of the new tube channels, and set these values to them so I can overwrite the broken preset' ...so they're macro based presets of sort.

...My issue is with the chase. When I use python to set the oscillator values, the chase doesn't work. it seems like all of the knobs are in the 'right' settings (how I ouputted the values), but all of the channels do the plain sine wave, and no chase is applied. If I manually poke the chase in the UI even a bit (I set it to 0.24 programmatically, and then nudge it to 0.25) -> the sliders are doing the chase again. ...then I save this and apply again using the python API -> again the chase acts like its is at 0, even the UI tells differently (if I choose any slider, I can see the value is 0.24 in the UI, but the channels are all going up and down in sync and no chase is applied).

...Soooo... Am I doing sometghing wrong here? Do I manually need to calculate the delta for each selected channel and apply some magical interval so it works like it does when you do it in the UI (select channels, turn oscilator on, and apply the same chase value to all channels).

Thanks.

I'm using the 1.5 beta.

Thanks.
velimatti
Posts: 15
Joined: Fri Jan 16, 2015 6:27 am

Re: Can't get chase to work with a script

Post by velimatti »

installed beta 1.5.1, and didn't work.
velimatti
Posts: 15
Joined: Fri Jan 16, 2015 6:27 am

Re: Can't get chase to work with a script

Post by velimatti »

Oh man. This was an user error. However the documentation of the API could be a bit more clear I think.

I had to reverse engineer this one.

The documentation states that setChase "Sets the oscillator phase for the given channel.". I guess that is kind of clear if you think that there is only one oscillator ... and then you need figure out that you need to manually calculate the delta between each fader (which is of course not stated anywhere). I was hoping it works automagically. Just like it works in the UI.

Anyway.

So how the UI works is that if you select 10 channel faders
--> AND then turn the 'chase' knob the visual values of the chase (in the UI) go from 0.0 to 10.0
---> if you select 11 channel faders, it goes from 0.0 to 11.0!! Woho!

...So in conclusion, the UI presentation of the 'chase' value is totally dependent on how many channels you select. I missed this one.

==> Luckily, if you select the channels individually (in the UI), you'll see that DMXIS has distributed the 'chase' value to all of the channels using some logic which seemed like magic.

But its not.

Ignore what the UI chase value says when you have multiple channels selected and when you adjust the 'chase' channel value. You can calculate the real chase float value using this math "(amount of channels you've selected) / (chase channel value)"

For example:
- select 288 channels (Like I said, I'm controlling ~500 channels so this is a common use case for me)
- fiddle with the chase value in the UI -> lets say chase value 72 gives you what you'd like to see
--> the real chase value is 72 / 288 ==> 0.25

-> so 0.25 is your 'chase' value which you want to apply programmatically

Then the algorithm is very simple. Just loop through every (selected) channel you have and apply the delta of 0.25

Super simple method like this would do it:

def getOscValue(current_value, interval):
new_value = current_value + interval
# keep the value below 1.0, because 1.0 is the max value
if new_value > 1:
new_value = new_value - 1
return new_value

Hope this helps someone else. I spent too much time on this.

The macro API is a life saver. Thanks providing it you guys Enttech!
Post Reply