Rules help with APC40 mkII LED Feedback

arvol

2015-07-07 01:55:34

Hey Guys!
I've read through some posts, but still haven't really found what i'm having trouble with.
Had a quick question for you about rules. *I’m using version 1.8*


I have 40 button on my APC40 mkII I am wanting to turn on at the launch of Bomes. (Got this working)

Now I’m wanting to separate these buttons into groups/layers. (8 layers of 5 buttons) (Got this working)

I then want to turn a button from a solid light to a blinking light when pressed. (Got this working)

I then want to have that same button turn BACK to a solid color when a different button (only in that layer) is pressed, AS WELL as having that new button start to flash when pressed. (Can’t figure this out)

And so on, and so on for each layer… wanting all the buttons (per layer) to remain solid unless they are cued up. (one flashing light per layer, as that will be the active clip for that layer)


I’ve spent about 8 hours and all sorts of different ways to output/rule/ and other ways to make this work. I feel that since I have 2 translations with the same incoming midi info, it’s only letting me use one? even when i set variables, or tell the translation to stop processing before moving on to the next one.
I’m sure it’s something simple I’m overlooking.

If anyone has a free min, could someone walk me through what I need to do, step-by-step? I would really appreciate it!

If it matter? This will be used with resolume. I got the mapping down, just need the LED Feedback to work lol

Thanks! :)

~Arvol

arvol

2015-07-07 02:23:58

To add a bit more info:
I've tried about 4-5 different ways, but the way I think would make most since would look like this:


Preset name: Layer 1

Translator 1 Name: Global On (turns on 5 LED buttons, let's say red. Input is processing start) * output is all 5 leds buttons, 90 00 05 is a button I know of. 9=on 0=channel 0 (solid) 00=button number 05=color red*

Translator 2 Name: Button 1 Rule Flashing (no input and output, just using the rules to GOTO/Jump)
Translator 2 Rule: Conditional if pp=0 GOTO Button 1 Flashing

Translator 3 Name: Button 1 Flashing (input 9f 00 7f turns button 1 from default solid state *defined by translator 1* into a flashing state) *output to 9f 00 05 9=on f=channel 15 (1/4 note flash) 00=button number 05=color red. STOP is applied

Translator 4 Name: Button 1 Rule Solid (no input and output, just using the rules to GOTO/Jump)
Translator 4 Rule: Conditional if pp=1 GOTO Button 1 Solid

Translator 5 Name: Button 1 Solid (input 90 00 7f turns flashing button back to a solid button)output to 90 00 05 (read translator 1 for details) STOP is applied.

Translator 6 Name: Button 1 Rule Flashing (no input and output, just using the rules to GOTO/Jump)
Translator 6 Rule: Conditional if pp=0 GOTO Button 1 Flashing (this may be unnecessary, but I put it in, incase needed to use the flashing button again. it would then repeat translator 2-6)

Translator 7 Name: Button 1 RULE Flashing Definition (input is 90 00 7f 9=on 0=channel number 00=button number 7f=full velocity) NO output
Translator 7 Rule: pp=0

Translator 8 Name: Button 1 RULE Solid Definition (input is all the other buttons that are NOT button 1 in layer 1 *90 08 7f 90 10 7f 90 18 7f 90 20 7f) NO output
Translator 8 Rule:pp=1


All Translators have swallow enabled. The rest of the translators are left out, as you get the jist, the others would be for buttons 2-5.

I've tried other methods as well, but this is how i think it should be laid out in my head lol. Hope it wasn't information overload? Better to have too much info, right?

Thanks again guys!

~Arvol

DvlsAdvct

2015-07-07 15:17:01

Hi Arvol

So what you want to do is a little complicated, as you know, but totally doable.

What I would do is assign each layer its own global variable which applies to each button. So if you press button 6 in layer 1, g1=6. If you press button 25, g1=25, and on, and have each button trigger the same timer. In fact, you can probably handle that with one translator per layer, depending on how your presets and layers are set up.

You mention that you are using 8 layers of 5 buttons. Can you explain that a little more in depth so I can understand your logic and work on the idea I have rumbling around in my brain?

Thanks
J

arvol

2015-07-07 15:40:39

Thank you for the reply J, I really appreciate it!
Just a foreword: I'm getting ready to leave my office and drive for about 6 hours, so if I don't get back till later tonight, I'm not ignoring anyone :)

Sorry for such a noobish question, but to create a timer... do I just enter a timer name, or how would I program a timer in depth? The outgoing Timer seems to have features, where as the incoming timer only has a name?

secondly, to create any rule, or to give a midi note a rule. so i simply just type g1=1 or pp=1 (for non global) into the rules box of said midi note?
e.g.: Translator 1: Incoming midi - 90 00 7F
Rule: g1=1
Outgoing midid: 90 00 05 *for red* (or 90 00 7F, whatever...)

In regards to the layers and buttons...
I have 8 faders, with 5 buttons above each of them (not including clip kill, the large layer button, and the 4 smaller solo, blackout, a/b buttons). I was wanting to have my Video clips cued by pressing one of these buttons.
So layer 1 for example would be all red clips, as is layer 2.
Layer 3 and 4 would be green clips.
Layer 5 and 6 would be blue clips.
Layer 7 would be yellow clips,
and layer 8 would be white clips.

SO.... I would want all of layer 1 and 2's buttons to be solid red by default.
Layers 3 and 4 would be solid green by default.
Layers 5 and 6 would be solid blue by default.
Layer 7's buttons would be solid yellow by default.
and Layer 8's buttons would be solid white by default.

If I press a button in layer 1, I would want all the other buttons in layer 1 to remain solid red, while the button I press blinks red. When I press any other button in layer 1 I would want the first button I pressed (now blinking) to turn back to a solid red, and then have the second button I pressed to start blinking.
I want each layer to be independent from each other, so I can have multiple video's cued up (one per layer) and i can see which ones are active.
Make sense?

Again.. Thank you so much for any time and help you could throw in my direction. I really really appreciate it!

~Arvol

DvlsAdvct

2015-07-07 15:59:11

Okay, I see where you're going with this. Alright, so this is how I'd recommend you set everything up, and don't worry about response time. Get back whenever you can :)

I am a huge fan of creating presets. It allows for a cleaner workspace, and organizes your translators in an easy-to-read fashion, especially when you're getting started.

So you would have 8 presets, one for each column, or track, or whatever we're gonna call it. Within each preset you'd have translators for each control, and storing the global variables. I'd recommend assigning a completely different global variable to each column. So column one would be h0-hz (global variables can be g, h, i, j, k, l, m, n, y, z, with 0-9 and a-z as their second letter, so g0, i8, mh, etc. Hopefully that makes sense), the second column i0-iz, etc. I'd recommend keeping track of these, because you're going to need a different global variable for each layer. We'll focus on the first column for now, but the logic is identical for every other column.

In each column preset you'll have a translator to change the layer, which counts up a global variable, and then triggers a timer to change the color, and reference what the playing track is. You'll need a button that resets the variable to 0 when you stop all clips, and you'll need all the other controls you've referenced. I'm trying to figure out the best route to take, so it might take me a little bit, cause there are a few different ways and I might need to get in front of MT Pro to figure it out. More presets might be better, or it can all be housed in one for each layer. Regardless, stuff to think about :)

Jared

arvol

2015-07-07 16:34:22

Very cool! I'll start in on this tomorrow morning. If you think of any other programing info, please let me know, other wise, I'll start with this.

so...
button 1 solid red on would be g0=0
button 1 flashing would be g0=1

button 2 solid on would be g0=2
button 2 flashing would be g0=3

so on and so on, correct?

once i get all these translators up, i would then great a new translator that would default everything to the solid presets g0=0, g0=2

from there i would make a new translator that would make button 1 flash when pressed g0=1, but also turn all other lights back to solid g0=2
and then a new translator that would make button 2 flash when pressed g0=3, but also turn all other lights back to solid g0=2

i excluded the other 3 buttons, but i think you get the idea?

am i understanding this correctly? any timers needed? if so could you walk me through that?

thanks again for all the help!

~Arvol

DvlsAdvct

2015-07-08 15:31:09

That looks right. Just leave g0=0 alone. That would be used for when all clips are off, and all LEDs are solid. So Button 1 would start at g0=1 for solid red.

arvol

2015-07-10 23:07:00

Got the controller working exactly how I wanted it. However.... I have a TON of code in it, that could be condensed down to a smaller file type (that might let things run a little smoother in the long run?)

If someone gets the chance, would you mind opening my file, or look at the text file I exported? I would like to clean it up a bit using rules, if possible. I'm just not savy enough to figure the rules out on my own.

Please and thank you! :)

https://www.dropbox.com/sh/9tqp7aphrifn ... cyL6a?dl=0

~Arvol

arvol

2015-07-14 15:09:56

Hi Jared,
Was hoping you might have a quick minute to look over my project?
I have about 600+ translators that I feel could be condensed down to 10-15.

The only thing this file is doing is turning midi channels 2-16 (certain notes only) to channel 1 (passing through the same notes, and same velocities)

and making it when button "1 is pressed, buttons 2-5 get a velocity of "00"
when button "2" is pressed, buttons 1,3-5 get a velocity of "00"
so on and so on, there are 8 layers that get this code.

if you wouldn't mind looking the project over (everything is label well on what it does) and suggesting what "rules" i could use to condense this massive beast down to a more tame animal, that would certainly help my system run a bit smoother. I would really appreciate it!!

https://www.dropbox.com/sh/9tqp7aphrifn ... cyL6a?dl=0

Thanks bud!

~Arvol

DvlsAdvct

2015-07-14 15:54:36

Hi Arvol

I will take a look at this in the next day or two. I should have time tonight after I'm home from work.

:)
Jared

arvol

2015-07-14 16:10:57

Thanks Jared,
No rush. I just appreciate you taking the time to help :)

DvlsAdvct

2015-07-16 02:26:19

Hey Arvol

So I'm going through this and I am actually a little lost, probably because there are so many translators. Can you tell me why the incoming triggers are all note off messages?

I'm guessing that presets 0-7 are to set the color of the pads on load of the project so they are all consistent when you load MT Pro? Why are the first signals of the second translator in each preset sending out to channel 16?

In Preset 9, why do you send on and off messages at the same time? Is that a Resolume issue? Or is that so the APC40 reacts a certain way?

Preset 10 looks like it's converting CC16 from each channel to every channel, right? You turn CC16 on channels 1-8 and it goes out on channels 2-8. You turn CC 17, same thing. This could be simplified using timers. This would look something like:

Code: Select all

Translator 1: FX Knobs
Incoming Action: qq i1 pp
Rules: if qq<176 [i]//this is the binary code for CC on channel 1[/i] then exit rules, skip outgoing action
if qq>183 [i]//This is the binary code for CC on channel 8[/i] then exit rules, skip outgoing action
Outgoing Action: FX Knob Timer (0ms Delay no Repetition)

Translator 2: FX Knob Out
Incoming Action: FX Knob Timer
Rules: None
Outgoing Action: B0 i1 pp B1 i1 pp B2 i1 pp B3 i1 pp B4 i1 pp B5 i1 pp B6 i1 pp B7 i1 pp
(if you C&P don't forget to remove everything that's in italics)

So every time you turn the knob all 8 channels send at once, and if the knob you are using is on a channel higher than 8 then it will be ignored.

The same theory can be applied to Presets 12 and 13 with the button duplication you're working with, but it might need to be adjusted slightly.

Preset 13 looks like it's converting all presses of a button and releases to the same note on message?

For preset 15 it can definitely be consolidated. You could have one translator for each message, regardless of channel. It'd look something like:

Code: Select all

Translator 1: Button 5
Incoming Message: qq 3E 7F
Rules: if qq<129 then exit rules, skip outgoing action
if qq>135 then exit rules, skip outgoing action
Outgoing Message: 90 3E 7F

Translator 2: Button 6
Incoming Message: qq 3F 7F
Rules: if qq<129 [i]//this is the binary code for Note Off on Channel 1[/i] then exit rules, skip outgoing action
if qq>135 [i]//this is the binary code for Note Off on Channel 8[/i] then exit rules, skip outgoing action
Outgoing Message: 90 3F 7F
(if you C&P the rules don't forget to delete the italics)

And on and on. That make sense?

Use the same logic as above and have all CC 16s across channels 1-8 send out all of those notes at once.

And your last preset looks fine.

Get back to me with your answers and I can keep helping :)

J

arvol

2015-07-16 22:07:17

Jared!! Thank you for the reply, here's what I got:

The incoming triggers are set to “note off messages” due to the APC40’s programing. When I press a “Clip” button (one of the main 40 large button at the top) it has a press and release style program. I want the light’s to remain “on” when i release that button.
For an example: I want the “clip” buttons light to remain solid when inactive, and i want an active clips light to blink when active so I know which clip is currently being used.
If i used the “note on message” it would be overridden by the “note off message” as soon as i released the button.

correct. presets 0-7 only affect the “clip” buttons light’s. turning them from “off” by default, to “on” and turning the “active clips” to a flashing light. I have it set to have the “Active” clip turn the other clips buttons back to solid when pressed (only the clip buttons on that layer)
channel 16 makes the lights flash, so i wanted the “active clip” button pressed to flash, thus it needs to be on channel 16

the reason preset 9 has an on and off message is due to the APC40’s programing. In Resolume i assigned a midi note to turn a “function” on and off, the problem is that these buttons on the APC40 are latching, so in order for me to turn the function “on” in resolute, i press the button once, however, ti turn the “function” off in Resolute, I would have to press the button 2 more times (once to send the “note off” command” and then once more to send the “note on” command, which is what i assigned that “function to accept”, and then once more to send the “note off” command to the APC40 so the light turns off) essentially what I did was turn a latching button to only send the “note on” command, all while send the “light off” command on the second time i press it. *hope that makes sense?*

you are correct. the way the APC40 is setup, if i change the “deck” (pressing buttons 1-8 above the channel fader) those “deck buttons” change the CC channel on the knobs as well. I don’t want that, due to the knob’s being a “master” FX knob. so if i have a “clip playing on deck one (cc channel 1) and i press deck two to get a different clip, i now can not access my fx, due to the cc changing to access more clips. I wanted the fx knobs to be accessible on all decks, so i made a preset that made cc channels 1-8 mirrored so that any change i made on cc channel 2-8 reflects back to cc channel 1 (the default channel that is setup in resolume) that way i can turn fx on and of, and modify intensity from any “deck/cc”
So the code-ing/rule I need is to make cc channels 2-8 become cc channel 1, Then i need a rule to make the LED ring’s around the knob duplicate/copy from cc channels 1-8, so if cc channel 3 for example is turned, the knob would then turn cc channel 1, and the ring lights around that knob would be duplicated on all cc channels 1-8, that way no matter what “deck i am on, the lights will be copied, and any knob change will be copied, but sent back to CC channel 1 to send out to Resolute.
I know this sounds very complex and a bit unnecessary… sorry
would your Rule accomplish this action?

Correct on preset 13. again, the APC40 is set to a latching button that sends a “note on” on the first res, then a “note off” on the second press”. this preset makes the “note off” become a “note on” so i only have to press the button once for on, and once for off (otherwise it would be one press for one, then a second press that does nothing, and a third press to turn it back “off” and a 4th press to turn the button’s light off”)

regarding preset 15, again, when the “deck” buttons are pressed, the aux buttons change channels as well. this just makes any button on and deck, reflect back to channel 1, and then makes the lights copy over to all “decks” as well so i can reference which button is still on.



I really wish I could wrap my head around how these “rules” you sent me are setup and work. is there a reference for the binary codes you have referenced ? the > and < are kind of making sense, but the exit and skip commands are still a bit confusing.
sorry, i wish i was more say in the rules and could grasp the concept quicker than i am. i feel i under stand the incoming and outgoing commands, as well as determining the midi notes/programming, it’s just the rules (local and global) that’s hanging me up. if i could get those down, i feel i could consolidate a lot and become more efficient programmer.

Thanks again for taking the time to help me! I really appreciate you!!

*i update my profile a bit, so if you reference the new profile, presets may have shifted by 2 numbers*


If you think your rules you sent over will work for what i am trying to accomplish, i will try to apply them to my profile and see what happens, just waiting back to see if your rules will do what i’m needing.

Thanks again! you rock!!

~Arvol

DvlsAdvct

2015-07-20 19:08:54

I'll go through this in depth when I get spare the time, but let me at least do a breakdown of rules.

Decimal vs Hexadecimal: These are two different ways of presenting the same kind of information. Decimal is only numbers (0-9) and Hex includes the letters A-F. So 00 in hex is 00 in decimal (since Hex starts with 0 instead of 1), and 0A in hex is 10 in decimal. Important numbers for MIDI are
7F hex is 127 in decimal, (e.g. full velocity)
40 hex is 64 in decimal, or middle
note 30 hex is middle C (so 90 30 is a note on message, channel 1, middle c)

Status 90 is hex for Note On message on channel 1. In decimal, this is 144. So if I put something in the rules that says

if pp>144 then exit rules, skip outgoing action

and set my incoming message as raw MIDI "pp 30 7F" then the translator will not trigger if note 30 is received on any channel other than 1.

I use this tool to constantly convert hex to decimal and back again when I need it. You can also directly enter hexadecimal in the rules (or any other number fields) by prefixing with 0x:

if pp>0x90 then exit rules, skip outgoing action

As far as rules, there are two different kinds of variables: local and global.

Local variables re forgotten once the translator has been triggered. These are limited to oo, pp, qq, rr, ss, tt, uu, vv, ww, and xx. What these allow is for you to replace an exact value or position with any value within that message. So, for example, if your incoming action is

Control Change on Channel 1, on Controller #5, with value 64 (or as raw MIDI: B0 05 40)

then your translator will only trigger when a CC message on channel 1, controller #5, reaches the middle position. You may want that.

But if you want the translator to trigger at whatever position the knob is at, you'd replace the 30 with pp, which means that every time you turn the knob, the translator will trigger, no matter where it is. Local variables are then forgotten once the incoming message is fully processed, so they can't be referenced later. They can only be referenced in the rules for THAT incoming message (hence local)

Global variables are remembered across your project and allow you to store values to be cross referenced by other translators. So, for example, if you only want the play button to work when your volume knob is about 50%, then you'd need a global variable to store the current position of your knob. You could easily just replace the last byte of data for your knob's incoming action as a global variable. This would look something like

Control Change on Channel 1, on Controller #5, any value, set to g1 (or as raw MIDI: B0 05 g1)

So g1 is now always going to be the position of your knob, it is remembered and can be referenced by other translators. So in your play button translator you could have a rule that says

if g1<64 then exit rules, skip outgoing action

This would prevent the play button from sending its outgoing action based on the position of the knob you selected. Does that make sense?

arvol

2015-07-29 20:06:26

Hi Jared,
Thanks for the reply. I'm currently out on tour and will be returning to my office late next week. I will certainly give those a shot and see if I can clean my programming up a bit.

Thank you again for all your time and help!!

~Arvol