git-moss / DrivenByMoss

Bitwig Studio extensions for many controllers: Ableton Push I/II, Akai APC40mkI/mkII/mini, Fire, Arturia Beatstep, Novation Launchpads / Remote SLs, NI Maschine / Komplete, Open Sound Control (OSC) and many more.
https://www.mossgrabers.de/Software/Bitwig/Bitwig.html
GNU Lesser General Public License v3.0
592 stars 143 forks source link

[Feature Request] Make use of the Komplete Kontrol Light Guide #319

Closed Robert-K closed 2 years ago

Robert-K commented 2 years ago

I'd like to start this issue off with a huge thank you, this repository alone makes the expensive brick I bought actually useable ❤

I've dabbled in reverse engineering the KK Mk2 before and was able to capture the and show the display data sent to the keyboard using Python. I also managed to create some light shows using the light guide.

IIRC controlling the light guide works pretty much the same way as controlling the button LEDs (Buttons have prefix 0x80, keys 0x81).

Have you considered making use of the light guide? I imagine it could significantly enhance the workflow, for example:

Some more experimental / advanced features could be:

It would have to be optional so as not to conflict with the Komplete Kontrol software.

If that's something you'd consider possible and reasonable, I'd love to contribute!

git-moss commented 2 years ago

Up to my knowledge it is not possible to access the light guide with the standard protocol. I guess you did reengineer the USB protocol?

Robert-K commented 2 years ago

I wasn't aware you were using something else. With python and hidapi, it's pretty straightforward:

import hid

PID = 0x17CC  # Native Instruments
VID = 0x1630  # Komplete Kontrol S88 MK2

NUM_KEYS = 88

INIT = 0xA0
SET_BTNS = 0x80
SET_KEYS = 0x81

device = hid.device()
device.open(PID, VID)

device.write([INIT])

def color(hue, brightness=2):
    return hue * 4 + brightness

device.write([SET_KEYS] + [color(2)] * NUM_KEYS)
git-moss commented 2 years ago

If you do this you take over the full device, which means you cannot use the Komplete Kontrol plugin support anymore. Furthermore, you cannot open the ports so easily on all OSs since the NI drivers block it.