Different MIDI command for left and right hand

Synthesia is a living project. You can help by sharing your ideas.
Search the forum before posting your idea. :D

No explicit, hateful, or hurtful language. Nothing illegal.

Postby anykey » 09-21-17 5:44 am

I am using the Komplete Kontrol keyboard which has full color Guide Lights. I wrote a simple program to control the lights using Synthesia but ideally I would like to upgrade it, so that I can use 2 different colors for the left and right hand notes.

I guess there are 2 "easy" ways to do this.
- Use 2 seperate MIDI channels for left and right hand, but this might break compatibility with other keyboards
- Use the intensity/velocity value. Right now, all notes are send with intensity/velocity of 1. If you can make notes for left hand with intensity 1 and the right hand with intensity 2, I could easily use that data to control the right color lights.

Here my code to control the Komplete Kontrol (S61) lights using synthesia.

Posts: 9

Postby Nicholas » 09-21-17 11:14 am

First: nice work! How did you manage to reverse the protocol? Did you have to use a hardware analyzer? It's a shame that it takes HID messages and isn't just shoehorned into MIDI messages. That would have been more convenient. Whenever NI adds "official" support, it sounds like it's going to be more work for us (especially on iOS)! :lol:

Also, am I reading this right: do you get to supply a raw RGB-triple for the color?! The documentation we've seen from NI (that doesn't work with stand-alone apps like Synthesia) showed a fixed set of about half a dozen colors. Full RGB support would be awesome.

Now to answer your question:

The next preview of Synthesia 11 is about to support the proprietary key lights from "The ONE Smart Piano". It supports a left/right hand distinction (using two different color lights), which we're hoping to support. I vaguely remember that information already being pulled through so it's trivially accessible to Synthesia's key light code. So it should be easy to add. We'll see if that's actually the case.

In any event, their "proprietary" scheme really just boils down to using After Touch messages (0xA0) instead of Note messages (0x90) with the lowest two bits of data byte 2 indicating hands. (Bit 1: "red" light, bit 2: "blue" light; I forget which hand those correspond to at the moment.) The only other difference I've seen is that they decided not to use MIDI note numbering -- where middle C is 60 -- and instead start counting from A0 at the far left edge of an 88 key keyboard. You could adapt your Python code to listen for that scheme instead and you'd get left/right hand broken out. And because they use completely different messages, you could just have it listen for both schemes simultaneously and get forward/backward compatibility with Synthesia's "traditional" key lights in older versions and the new proprietary scheme at the same time.

It's not ideal (mostly because it's a one-off implementation by some other manufacturer; making you adopt Synthesia's quirks which were necessarily adopted from their quirks), but it would solve the problem. :D
Posts: 11235

Postby anykey » 09-21-17 11:24 am


Yes I can provide full RGB codes and that also really seems to work. Here a short example: https://www.instagram.com/p/BZTdar0DLU6/

I also seem to be able to refresh the data very fast, without impacting the performance of the keyboard in anyway.

Thanks for the info about Version 11, when released I will modify my python code for it. Sounds like I can easily modify my code for that :-)

Will Synthesia 11 be a free upgrade? any idea on release date?
Posts: 9

Postby Nicholas » 09-21-17 11:29 am

That RGB video is awesome (and promising)!

11 -- like all past and future releases -- will be a free update. :)

The next preview of 11 is coming along nicely. I've learned not to give release dates though, because they're always wrong. The best I can offer is to follow along with the news in this section of the forum.
Posts: 11235

Postby Nicholas » 09-21-17 3:45 pm

... actually, I can do even better!

I've had a chance to check and I remembered correctly. There is an old, never-enabled feature lurking in the key light code for a device prototype we were working with a manufacturer on (years ago) that never made it to market as far as I know. It was going to have RGB lights and would use a different color per finger. Everything in Synthesia was ready to go: per-finger light messages that fell back automatically to just the hand if finger hints didn't exist. I just tested it and it appears to still be working perfectly.

This one has fewer quirks because I helped to invent the scheme! :lol:

Here's how it works:

  • Choose "Finger-based channel" from the bottom of the key light channel list (starting in the next Synthesia 11 preview)
  • Have your Python app watch for Note messages, mostly the same as before with the following difference:
  • The finger is stored in the message's channel according to the following table.
These are zero-based (despite most MIDI libraries using ones-based counting for channels).

  • Channel 0 means "we don't know who or what this note belongs to, but light something up anyway".
  • Channel 1-5 is left hand fingers, thumb through pinky.
  • Channel 6-10 are right hand fingers, thumb through pinky.
  • Channel 11 means "left hand, unknown finger".
  • Channel 12 means "right hand, unknown finger".
(Note Off messages are still channel-less and always use MIDI status 0x80.)

This system provides even more info than the upcoming ONE Smart Piano lights and also means you don't have to convert between MIDI note numbers and that weird A0-based key indexing.

The only thing that's a little wrinkly here is that the Note On channels technically won't match the Note Off channels. So if you send these out to a keyboard/synth that doesn't understand this system, you'll get a bunch of eternally-opened notes. The workaround: don't send these out to an unsuspecting keyboard/synth! :D

There is even a bonus message that gets sent when Synthesia begins playing a song. You can use it as a sort of "reset all the lights" / "get ready" type of thing. It uses a general purpose CC message (CC#16) to say which hands have been selected and whether the user is playing (vs. "Watch and Listen Only"). Here's how it works:

Status: 0xB0 (CC on channel 1)
Data1: 0x10 (CC#16: General purpose slider)
Data2: bit flags, see below

Code: Select all
enum LightHand
   Unknown = 0,

   Right = 0x1,
   Left = 0x2,
   Both = Right | Left,

   UserPlayed = 0x4

Some examples:

  • User-played right-hand: B0 10 05
  • User-played left-hand: B0 10 06
  • User-played both hands: B0 10 07
  • Watch and listen only: B0 10 00
Posts: 11235

Postby anykey » 09-21-17 6:56 pm

Cool! Thanks for the detailed info!!!

I can easily adjust the script to this. Will do so when availble and will make movie to show it off :-)
Posts: 9

Postby Nicholas » 10-24-17 6:06 pm

The new key light mode is live in the 10.4.4376 preview! You can try this out now.
Posts: 11235

Postby smalok » 02-14-18 1:34 pm

This sounds very interesting!

Any progress by now?

Thanks for all your hard work!
Posts: 1

Return to Feature Requests

Who is online

Users browsing this forum: No registered users