1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Turn off light guide on kontrol Mk2 49

Discussion in 'KOMPLETE KONTROL SERIES' started by Daschine, Mar 8, 2018.

  1. rogerwilco

    rogerwilco New Member

    Messages:
    5
    First—you are a hero doing a hero's work. I just installed an S61 in my studio and there are about 1,000 threads asking how to turn off the light guide and only you who built something that does just this.

    Does this turn off the guide only? Is the idea you run the program and it runs in the background while you're working, or you run it once before you start working?

    I have a Mac and am no Python wizard but am willing to help port this over, if this is still something you're interested in working on.
     
  2. AverageSolusUser

    AverageSolusUser New Member

    Messages:
    13
    Haha thank you for the kind words, that was a nice way to wake up this morning :).

    This program simply turns the lights off like a light switch in your room does. (`keyboard_engine.py` line `54`).
    This program is actually a stripped down version of a much more advanced program that I made (one that reacts to your playing by changing the colors while playing), which is why it may seem a little over-engineered for just this little task.

    So in short: it turns off the light guide only, you run it one time to turn off the lights, then you can close the program, and open and close it again whenever the lights went on for whatever reason.

    >I have a Mac and am no Python wizard but am willing to help port this over, if this is still something you're interested in working on.

    Of course! It shouldn't take longer than 30 minutes to do this I assume. It's really just a matter of installing some dependencies and running the command. Then I'll add it to the releases page for anyone to download.

    I think we can do this effectively through some kind of video call where you share your screen, and I'll guide you through the process of installing the dependencies and running the command. Of course it should also be possible to do via just chat if you don't want to share your screen, but it'll take a little longer.

    Would you be interested in something like this?

    I live in The Netherlands (GMT+1).
     
  3. rogerwilco

    rogerwilco New Member

    Messages:
    5
    Unfortunately a video call would be pretty tough for me as COVID realities and life with kids has stripped my pockets of free time to razor-thin margins. :)

    But if you don't mind following through here I can do this step-by-step. Am I right in thinking the first thing I need to do is get the cx_freeze library installed? https://pythonschool.net/pyqt/distributing-your-application-on-mac-os-x/
     
  4. AverageSolusUser

    AverageSolusUser New Member

    Messages:
    13
    For some reason I didn't get notified of your response, so I'll check this thread manually more frequently from now on.

    I think this is how we get it to work. You need to install everything in 'requirements.txt'. It's a python convention to store all the names of the project dependencies in this text file. You could probably Google this: 'how to install python requirements.txt on mac'.

    I created a bash file to simplify the release process. I'm not sure if it needs editing to make it work for Mac, I'll look into it tomorrow (that's in 8 hours for me).

    If you can run release.sh without errors, I think an executable for Mac should have been produced in a folder somewhere in the cloned repository.

    I'll check this thread again tomorrow. If you can provide me with feedback on what worked so far and which issues you're facing, I can probably help more accurately.

    Edit: I just noticed I didn't include a release.sh in this repo. I'll look up how we I released the executable last time.
     
    Last edited: Nov 30, 2020
  5. rogerwilco

    rogerwilco New Member

    Messages:
    5
    Before I read this last post of yours I got it running on my MacBook. I used cx_Freeze to bundle everything, although it took a few tries to line up a version of Python that it would run on. Getting it converted to an .app wasn't happening but I could run both the setup and the main as executables.

    The good news: the lights turn off, hooray!
    The bad news: gone with the light guide is the functionality of the Browser/MIDI/Instance buttons.

    Now that I have a little handle on how the code works I may try to dive in on this later.
     
  6. AverageSolusUser

    AverageSolusUser New Member

    Messages:
    13
    Ahh I'm afraid it always worked that way (on Windows too), but I never noticed because I didn't actually use my keyboard much as a MIDI controller. I've only ever used it for playing a piano instrument. I've since switched to a digital piano and sold my komplete kontrol device, so I can't do any more testing either.

    I guess you could try sending different bytes to the controller. Maybe there is one specific combination that only turns off the lights, and leaves the rest of the functionality on. As far as I know, it can really only be done by trying random combinations. I don't think there is any reference guide provided by NI.
    So specifically, in keyboard_engine.py > def turn_off(self):
    Change this line: "self.current_state = self.mode_key + empty_fillers" to "self.current_state = [0x81] + empty_fillers" where "[0x81]" is the byte you're changing every time. No luck? Try "self.current_state = [0x82] + empty_fillers", then "self.current_state = [0x83] + empty_fillers", etc.

    It's probably worth it to search google a bit about these keys, maybe somebody else has tried anything familiar.
    All in all, I wouldn't be too hopeful about this unfortunately. NI should just provide a simple button to disable this, as a software engineer I know what I'm talking about when I say such a button should be very easy to implement.
     
  7. rogerwilco

    rogerwilco New Member

    Messages:
    5
    It was very software engineer of you to not mention the crippling bug in your application before I spent the better part of an evening trying to make it work. :D

    I suppose I could cycle through the byte addresses but maybe I'll keep the internet searches alive to see if I can find a more targeted code. Thanks for your help, though!
     
    • Funny Funny x 1
  8. AverageSolusUser

    AverageSolusUser New Member

    Messages:
    13
    It was very software engineer of you to not mention the crippling bug in your application before I spent the better part of an evening trying to make it work. :D
    Hahahaha that made me lol irl.
    But like I said, I honestly didn't know that that sending this byte code did anything more than turn off the lights. The lights were the only part that I noticed changing.

    I'll make sure to update the readme.md on github.

    Edit: updated; should be clear now.