nanoKONTROL2-controlling leds

Hello everyone.

Can somebody please help me with this..

I have a nanoKONTROL2 and would like to set it up to work the following way:

1-Using CC's 20 thru 32, I'd like to set up 13 buttons. Each one, will send a different keystroke out, to change shots, in a software called Wirecast' Now, selecting any of this buttons should turn the led 'On' for the selected one, and turn 'Off' the rest of the leds, to reflect the one selected shot. I have configured 'LED mode' to external, in nanoKONTROL2 editor preference, so, receiving 0 or 127 values will turn them off and on.

How do I accomplish this using rules?

Thanks in advance!

Ps. I am using Win 7 64bit

Well if you don’t mind using 13+ global variablex, you can set each one to hold the state of a given controller. Then you set up a rules that when you set the state of a given button to on, you set the variables for the other buttons off.

You then trigger a repeating timer to iterated through the variables turning each one on or off depending on their current statue

Example of translator

Input B0 pp qq
Rules
// Only look for on status, we set off status later
if qq!=127 then exit rules, skip outgoing action
// Only look at controllers of interest
if pp<20 then exit rules, skip outgoing action
if pp>32 then exit rules, skip outgoing action
// Clear existing contents to clear all other channels
ga=0
gb=0
gc=0
…
gn=0

// now set the one on that was on input.

if pp==20 then ga=qq
if pp==21 then gb=qq
…
if pp==32 then gn=qq

 

// number of iterations
gn=13

Output Timer “Update LEDs” gn times no delay 10ms intervale

 

Example of a timer “Update LED’s”

You use ga-gm as your 13 variables controlling 20-32 ga=20 gb=21 … gm=32

Your rule would set ga=127 and gb-gm to zero.

The timer would be set up for 13 iterations and on each iteration dump send out the state of that led

You could use a global variable (say gn) to count down. Timer would look something like this

 

// which variable? 13-1

pp=gn

//Calculate which controller 13=cc32 12=cc31 …

qq=gn+19

// Get the variable value
if pp==13 then xx=gm
if pp==12 then xx=gl
…
if pp==20 then xx=ga

//decrement for next iteration

gn=gn-1

if gb==0 then exit rules, skip outgoing action

Output the controller and value

B0 qq xx

 

There are other ways to do this but this should get you started. If you don’t like using so many global
variables, check out my posts on bit mapping.

 

Here is a bitmap version. Harder to explain but if you know what you’re doing actually easier to implement.

 

You will need to change the inputs and outputs for both your NanoKontrol2 and your DAW. I had to test it with my MIDI Fighter Twister. I created aliases so the MT Pro will probably want to to re-assign them when it opens for the first time.

 

 


Attachments:
1510022676930_NanoKontrol2-2017-11-06.bmtp

Thank so much for your response. You are kind of a genius, and clearly at another level my brother!

I tried the file you attached, but can’t really make it work the way I need it. Maybe I am not explaining my self clearly enough. Please take a look at the file I attached.

The first 13 translators are receiving the CC’s and sending keystrokes to the software I mentioned ‘Wirecast’. Then I try to turn Leds’ on and off on my nanoKontrol2 with very… Well, elementary and primitive programing! On the nanoKontrol2 the switches are set to momentary.

You will see 13 translators, one to turn Led1 on and twelve sending CC’s to turn off the rest of the Leds.

Then I repeated the process, but now one translator turns on Led2 and the next twelve turn off the rest.

To do this for all 13, I would need to replicate this eleven more times! Now Programing the way you did I am sure it can be done in a much more efficient way. I just don’t know how to implement your example to get me there.

Thanks again.


Attachments:
1510109426736_13-Scenes.bmtp

OK, first of all I moved all of your LED translators to a new preset and disabled the preset. You don’t need them but if you want to try and use them for something else, your hard work entering the information is not lost.

I added an Init Preset with 3 translators

  1. On project open, starts a one shot timer Init
  2. When you hit ESC key also starst one shot timer init
  3. On trigger of timer Init, by either of the above, sets the global variable you will be using to 0. It is really not needed but I generally do this to document the global variables I’m using.

I use ga for the bitmap of the LED’s you are controlling and gb for a countdown timer I use later for updating the LEDs

In the Korg Nano2 preset, after removing your translators I added two

  1. Control LED’s monitors the incoming MIDI message. The rules determine if it is controller 20-31 and if it is the rules set up the bit map. Plugging a 1 in to the position of the controller you turned on. I then starts a timer that iterates 13 times.
  2. The timer iteratest 13 times, sending either 127 or 0 depending on the state of that controller. Essentially it will send 7F (127) one time and 0, 12 times depending of the bit position of the variable ga, which we stuffed with the correct bit in the previous translator

Since I’m using your aliases and your values, it should now work for you. Only two translators, and two global variables to control 13 LED’s

Enjoy

 


Attachments:
1510113908086_13-Scenes-2017-11-07.bmtp

WOW! that worked flawlessly!!! Thank you, thank you, than you!

Now… I added another preset, how can I do the following:

  • Pressing any buttons the first time sends only the keystrokes assigned in preset #1:

Button 1 first time pressed sends ‘alt(F1) alt(X)’

Button 2 first time pressed sends ‘alt(F2) alt(X)’

and so on…

  • But pressing any selected button a second time would send only keystrokes in preset #2:

Button 1 second time pressed sends ‘shift(F1)’

Button 2 second time pressed sends ‘shift(F2)’

and so on…

And then it alternates, so if the same button is pressed a third time it will send keystroke from preset #1…

a fourth time it will send keystroke from preset #2, and so on.

  • Now, pressing a different button will ‘clear’ the previously selected button ‘status’. In other words, going back to a previously selected button wont be counted as a second press of that button, but rather a fresh start, and as a first time being pressed.

Also it doesn’t have to be in two different presets. I just did it like that because it was the only way I could visualize it.

Your help is really appreciated!

 


Attachments:
1510153608428_13-Scenes-EDIT-1.bmtp

Hmm not sure I understand completely. What is behavior you are looking for if

Push button 1 – First Time
Push button 2 – First Time
Push button 2 – Second time
Push button 1 – First or Second time? (If second, we will need to maintain the current state of all buttons
which is not necessarily that state of your LED’s)

Ok, pushing button 1 will turn LED ON, the way is working now, and send Keystroke from preset #1.
Pressing that button a second time will keep that LED ON, it will just send a different Keystroke (from preset #2)
Pressing it a third time will send the ‘original Keystroke from preset #1 only, but LED is always ON for that button no matter how many times you press it.

My question was, when pressing button 2 after pressing button 1 one, did you want button 2 to be a first press or a second press since it is a separate button?

Basically this is the scenario. Wirecast is a broadcasting software. I want to select 13 different ‘shots’ with the buttons and have them reflect which shot is ‘LIVE’. Now if a shot is live and I want to trigger a specific ‘Lower third’, like a title or message for that shot, I want to press that button again and it will trigger that Lower third.
If I were to press that button again, the lower third will go away, because that ‘alt(X)’ keystroke on every translator of preset #1 will take care of that. So pressing different buttons just once, will clear any lower thirds while changing shots. I hope this helps you understand the purpose a little.

I Understand your question now. Yes, every time a different button is pressed it should be consider a first time press for that button. So its LED should turn ON, and only Keystroke from preset #1 should be sent.

So any time you press a new button it is counted as a 1st press?

Yes sir! That way only the Shot being selected will be triggered, and any lower third will be cleared.

Also I just noticed the first translator of the ‘SECOND TIME PRESSED’ preset, has an incoming value=00. That was not intentional and is my mistake, it should be just like the rest, value=7F.

Hi,

Using 2 more global variables

g3 = Indicates which preset is selected 0=First Time Pressed 1=Second Time Preset

g4= Indicates last button pressed. If last button is same as first button, preset will toggle. If it is a new button, only preset First TIME Pressed will be selected

New Preset – Preset Toggle handles this

 

Bank Select – Determines by the logic you provided which bank selected if it is new button it is always zero otherwise it toggles. Sets the variable and then sets a one shot timer.

4 Timers to handle preset enable/disable action

Enable 1

Disable 2

Enable 2

Disable 1

I also put the LED controls into a separate preset

Now that you see how these are setup, maybe you can learn from looking at them and be more independent on future needs.

Steve

bome@sniz.biz

Independent Bome Programming Specialist

Bome Q&A moderator

Also, since this was a totally different subject, it should have been posted as a new question.


Attachments:
1510162079130_13-Scenes-8-Nov-2017.bmtp

I apologize for not posting this as a different question, I was not sure if that was the right way to go about it.

Right now is almost working, but I guess the idea of turning presets ON and OFF is not the best way to go.

Whenever a preset is OFF it has to be turned ON first by triggering the appropriate button, and then I have to push the button again to send the keystroke and that kind of messes things up. I tried delaying the output, so that the preset gets turned ON and then the message would go out. But realized the problem is that since the preset has been OFF the incoming signal is not getting thru and I have to push that button again to send the CC a second time.

I appreciate your help and always try to analyze everything so that I can actually learn how to do things. But some of this logic is beyond me at this point.

Try this version

I made it so when project is open First Time Pressed reset is always enabled. I used Init timer as a trigger

I moved the preset toggle preset above the other presets so that they will be enabled/disabled and then the same action can activate the keystroke. Translators always process from top down.

 

 


Attachments:
1510166102544_13-Scenes-8-Nov-2017a.bmtp

Tried, but now SECOND TIME PRESSED preset doesn’t get activated ever. I am looking into it to see if I can find the problem.

Whoops go to preset toggle bank select and change B1 to B3. I’m using a different channel in my testing and didn’t set it back.

Ok, I fixed that. It still wasn’t working as expected but now it is. I changed the translators on FIRST TIME PRESSED and SECOND TIME PRESSED to be triggered by releasing the button or value 00. That way on value 7F the bank was turned on, and upon releasing the button the 00 value is sent and trigger that keystroke successfully!!! I can’t thank you enough for your help and patience. I will upload that file in case someone else finds it useful.