Go Back   Cockos Incorporated Forums > REAPER Forums > MIDI Hardware, Control Surfaces, and OSC

Reply
 
Thread Tools Display Modes
Old 04-13-2020, 10:28 PM   #121
brummbear
Human being with feelings
 
brummbear's Avatar
 
Join Date: May 2016
Location: out west
Posts: 301
Default Connected - nice!

Wow, that is nice progress indeed. Gaining control over the IPC communication scheme would open up some major possibilities. Wondering if it will create conflicts if different SW instances try to talk simultaneously via NIHIA to one keyboard. E.g. if ReaKontrol would pretend to be a KK-SW instance and a real KK-SW instance on a track talk to NIHIA what will happen? Likewise if ReaKontrol pretends to be a Maschine instance. Could we make both (real KK-SW instance and fake ReaKontrol Maschine instance) talk via NIHIA simultaneously to the keyboard? Are states cached only in keyboard or also in NIHIA? Besides simple things like using the additional buttons this would open up crazy possibilities like split screens, switching the focus of the transport buttons to Reaper while having the rest of the keyboard focused on a Msschine VST etc (the latter is today only possible via some clumsy tricks as mentioned in ReaKontrol‘s manual). Or even get around limitations in KK-SW or Maschine that may never get touched by the NI devs.
brummbear is offline   Reply With Quote
Old 04-16-2020, 02:13 PM   #122
terminar
Human being with feelings
 
Join Date: Feb 2020
Posts: 82
Default Update regarding Windows. => PLAUSIBLE

Quote:
Originally Posted by brummbear View Post
Wondering if it will create conflicts if different SW instances try to talk simultaneously via NIHIA to one keyboard. E.g. if ReaKontrol would pretend to be a KK-SW instance and a real KK-SW instance on a track talk to NIHIA what will happen?
Untested but - i think it's handled via the "Instances" stuff. There shouldn't be a conflict. BUT - i realized that the NIHIA is sending much data (display update) every time the instance is changed. That may mean, that the keyboard firmware is really some sort of stupid (which is great, that opens many possibilities). I can answer this question within the next days.

Quote:
Originally Posted by brummbear View Post
Likewise if ReaKontrol pretends to be a Maschine instance. Could we make both (real KK-SW instance and fake ReaKontrol Maschine instance) talk via NIHIA simultaneously to the keyboard?
Maybe but it seems that only the active instance will get the active control. Give me some additional days

Quote:
Originally Posted by brummbear View Post
Are states cached only in keyboard or also in NIHIA? Besides simple things like using the additional buttons this would open up crazy possibilities like split screens,
I think the keyboard isn't maintaining much state data. I haven't disassambled my KK yet (and don't want to do it) but due to the reaction time of the display and hardware (while looking at the data transfer) and the data which is transferred every time it seems that it's "only" a small microcontroller which does its job in the KKMK2 - maybe some different hardware in the MachineMK3. I've seen some photos on the net from a KK-M32 which seem to contain some small TQFP48 (?) sized IC, maybe some Atmel/PIC/STM. On the Traktor S4 there is some bigger Lattice IC, maybe some FPGA. But - most of this is just guessed yet.

One thing: I don't think that we can control the screens independently. I think the "instance" button is hardware-firmware controlled and selects/allows the controlling instance.

Reason for this post: Some Windows progress update. It wasn't that nice to reverse engineer on Windows... Really... But i have some useful information.

First of all (a bit of useless stuff): NI seems to use Boost interprocess somewhere, i also found again some ZMQ references. That doesn't help us really much but it's again nice to see.

Now the important stuff: It seems that i was right with my assumption:
On Windows, NI seems to use NamedPipes. Also i've again found references in the binaries to "NIHWMainHandler" and friends. I've monitored the pipe traffic while starting "Komplete Kontrol.exe" aaaand - we got it.
We have nearly the same messages transfered from the KK.exe to the "com.native-instruments.NIHostIntegrationAgent" and "NIHWMainHandler" pipes, beginning with the "VgS." / 0x03536756 version/ping request, following the "prmy" messages requesting the Request/Notification port names - and so on. There are slightly differences. On OSX the initial ping/version request is 8 bytes long, on windows it's only 4 bytes. On Windows, the port name request has some 4 bytes attached (69 6c 69 74) but generally, it's the same procedure.

I haven't captured with my connected KKMK2 yet because i first had to find the initial search messages but i can go further now. I think there will not be much difference compared to my captured data on OSX.

OK, what's next? I'll try to create some trivial C/C++ windows program with the 0x1610 (KKMK2) connection procedure. If i am still correct it's reasonable to have some first cross platform prototype within the next days / two weeks (has something to do with my spare time and the weather which is getting much better).

I'll give feedback if i've some better (testable) news.
terminar is offline   Reply With Quote
Old 04-16-2020, 08:38 PM   #123
brummbear
Human being with feelings
 
brummbear's Avatar
 
Join Date: May 2016
Location: out west
Posts: 301
Default Inspiring

Inspiring news, terminar! What tool did you use to sniff the named pipe traffic on Win?
- IO Ninja/Pipe Monitor? Appears to be the most useful one...
- Wireshark
- some form of API hooking?
I assume the pipe access is not secured and the payload not encrypted?

Regarding the questions about multiple instances talking SIMULTANEOUSLY to one keyboard: I am afraid you are right about your assumption that only one instance gets active control (whether this may be KK-SW or Maschine-SW). The problem arising from this would be that we might not be able to ADD any functionality to ReaKontrol while KK-SW or Maschine-SW are focused on the keyboard. E.g. how would you make the "additional Maschine" buttons on the keyboard light up while a KK-SW instance is focused on the keyboard? And frankly this would at least for me be almost always the case. While I use the keyboard at times just as a general MIDI keyboard most of the times I use it in conjunction with KK-SW or Maschine-SW, i.e. one instance would already take control via the NIHIA IPC avenue leaving only MIDI for ReaKontrol.

EDIT 1:
Quickly checked the name of the pipes on my system (KK MK2 S88 keyboard and MaschineMikro Mk2 Controller):

General pipes:
com.native-instruments.NIHostIntegrationAgent
NIHWMainHandler

Komplete Kontrol VST or Komplete Kontrol standalone SW adds:

4 pairs of:
NIHWSxxxxxxxxRequest
NIHWSxxxxxxxxNotification

and provided that the keyboard is connected and powered:
NIHWKompleteKontrolMK2-ssssssssaaaaRequest
NIHWKompleteKontrolMK2-ssssssssaaaaNotification

with ssssssss being the serial number of the KK keyboard.

Adding Maschine-VST or Maschine standalone SW adds:

13 pairs of:
NIHWSyyyyyyyyRequest
NIHWSyyyyyyyyNotification

and provided that both controllers are connected and powered:
NIHWMaschineMikroMK2-rrrrrrrrbbbbRequest
NIHWMaschineMikroMK2-rrrrrrrrbbbbNotification
NIHWKompleteKontrolMK2-ssssssssccccRequest
NIHWKompleteKontrolMK2-ssssssssccccNotification

with ssssssss again being the serial number of the KK keyboard and rrrrrrrr being the serial number of the Maschine Controller.

Did not have the time to sniff any traffic yet and compare with your findings.

Last edited by brummbear; 04-17-2020 at 12:58 AM.
brummbear is offline   Reply With Quote
Old 04-17-2020, 01:39 AM   #124
terminar
Human being with feelings
 
Join Date: Feb 2020
Posts: 82
Default

Quote:
Originally Posted by brummbear View Post
Inspiring news, terminar! What tool did you use to sniff the named pipe traffic on Win?
- IO Ninja/Pipe Monitor? Appears to be the most useful one...
A bunch of tools, the usual suspects. Ghidra, Cutter/radare to compare the binaries with OSX, in this case additionally an evaluation of IO Ninja/Pipe monitor for a quick check.
I think if i still need to dive deeper i need to use Detour or some other DLL injection stuff.

Quote:
Originally Posted by brummbear View Post
I assume the pipe access is not secured and the payload not encrypted?
Nope.

Quote:
Originally Posted by brummbear View Post
functionality to ReaKontrol while KK-SW or Maschine-SW are focused on the keyboard. E.g. how would you make the "additional Maschine" buttons on the keyboard light up while a KK-SW instance is focused on the keyboard? And
Hm, i think with KK-SW it should be possible because one can use KK + Maschine2 in parallel but the focus is on the Maschine2 instances.
The messages in the protocol contain (big endian to little endian) "NiM2" (?Native Instruments Maschine 2?) when Machine2-SW is started, in 2012 it was "NiMS" (found on a github project), yesterday when i sniffed KK it was "NiKK". The second message in that specific data block is "prmy". Sam Lerner thought it was short for "pair my" but i think it can also mean "primary" (as a really unusual abbreviation). Maybe there is more and different reaction, don't know yet.

Quote:
Originally Posted by brummbear View Post
General pipes:
com.native-instruments.NIHostIntegrationAgent
NIHWMainHandler
Jup. com.native... is served by NIHIA and NIHWMainHandler is served by NIHA, same on OSX. BTW, i have even seen a function which seems to react as message proxy, forwarding messages from one agent to the other.

Quote:
Originally Posted by brummbear View Post
mutiple pairs of
NIHWSxxxxxxxxRequest
NIHWSxxxxxxxxNotification

NIHWKompleteKontrolMK2-ssssssssaaaaRequest
NIHWKompleteKontrolMK2-ssssssssaaaaNotification

with ssssssss being the serial number of the KK keyboard.
Jupp. That are the two pairs i talked about. The NIHWS*Req/Not are the device type pairs.

Quote:
Originally Posted by brummbear View Post
Adding Maschine-VST plugin adds:

mutiple pairs of
NIHWSyyyyyyyyRequest
NIHWSyyyyyyyyNotification

NIHWMaschineMikroMK2-rrrrrrrrbbbbRequest
NIHWMaschineMikroMK2-rrrrrrrrbbbbNotification
NIHWKompleteKontrolMK2-ssssssssccccRequest
NIHWKompleteKontrolMK2-ssssssssccccNotification

with ssssssss again being the serial number of the KK keyboard and rrrrrrrr being the serial number of the Maschine Controller.
Just guessing: In your case the important pairs should be NIHWS161000<xx>Request/Notification and NIHWS12000<nn> which are the Req/Not pairs to get announcements especially for your devices (0x1610 for KKMK2, 0x1200 for your Mikro MK2).

There should be some data send to the NIHWS...Request port: 0x03447143 (03 C q C) with an answer on the NIHWS...Notification port:
- "ON" => 0x3444e2b (check big endian encoding, may be switched '2b 4e 44 34'), then some 8 byte, then a string length (e.g. 0x09 00 00 00) => big endian 9 bytes and then your device serial number, followed by a trailing 0.
- or "OFF" => 0x3444e2d (and the other data described above).
[/quote]

*EDIT:*
Quote:
Originally Posted by brummbear View Post
4 pairs of:
NIHWSxxxxxxxxRequest
NIHWSxxxxxxxxNotification
Makes sence:
- 0x1350 KK MK1
- 0x1610 KK MK2
- 0x1730 KK A
- 0x1860 KK M
?

Quote:
Originally Posted by brummbear View Post
13 pairs of:
NIHWSyyyyyyyyRequest
NIHWSyyyyyyyyNotification
Great, that's exactly the list of the hardware device ids used by Maschine2-SW i've identified. 6 device types => NIHWMainHandler, 7 device types => com.native....

I think, using Traktor-SW will spawn other yet unknown ID requests but that's of course not our current target.

Quote:
Originally Posted by brummbear View Post
Did not have the time to sniff any traffic yet and compare with your findings.
What you are writing is exactly the same as on my side on OSX (and Windows). I think we are getting closer, thank you for debugging on your side.

Last edited by terminar; 04-17-2020 at 01:54 AM.
terminar is offline   Reply With Quote
Old 04-20-2020, 07:23 AM   #125
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default Mk 1 support...

Hey, this thread is cool; I'm glad I found it, and even more glad that the source is available on gitHub; kudos!

I've got a Mk1 S-61, and have both Windows and MacOs development environments, and some familiarity with the reaper extension API. Perhaps I can take a little bit of time to look into what can be done about achieving compatibility with the MK1 keyboards. Out of curiosity, what's the current level of support, and what's missing. I haven't tried this dll at all yet.

Cheers

K
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 07:32 AM   #126
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

@DrFrankencopter: this would be just wonderful!
Got a S88 MKI and glad to help, although you guys are way beyond my level, lol.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-20-2020, 07:52 AM   #127
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

@_Stevie_ have you tried this *.dll with your MK1 S-88? What works, and what doesn't...trying to get an idea what I'm up against.

Or, does it just not work at all? In which case it might end up on a back burner for me.

I tried a couple times to get access to NI's documentation and SDK's...but they never responded to my requests. Haven't read the thread in great detail yet, but at first glance it looks like all the work done here was done through reverse engineering.
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 08:41 AM   #128
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Unfortunately I really get only this, when installing the DLL and starting REAPER:



Basically, all the necessary info is located in the python scripts for Ableton Live.
But not being a coder, I have a hard time understanding them, lol.

They should be located here:
c:\Program Files\Common Files\Native Instruments\Host Integration\Ableton Live\_NativeInstruments\
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-20-2020, 09:17 AM   #129
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Ok, I'll have a look in my install files to see if I have the Ableton py scripts. Python isn't my forte, but I know a little. I'm anticipating regex hell though.

EDIT: I checked...I have 3 py files under the Mk1 folder. I'll take a look at them this evening
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 09:24 AM   #130
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Awesome! Let me know if I can be of any help.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-20-2020, 01:58 PM   #131
terminar
Human being with feelings
 
Join Date: Feb 2020
Posts: 82
Default First real code progress

@brummbear: I took some time this evening and ported some of my OSX test stuff to windows and made the first two connect-steps.
It's working as expected, i think i can also wrap the whole stuff in a nice and shiny portable connection class later on because i can reuse most of the binary data structs - that are the good news. Also that means i don't need to lean on other tools that much anymore because the general sendMsg() (and receiving a result) is working.

One problem i am currently fighting with (and stopping this evening) are the named pipes, they don't act as they shouldn't do (so i assume i have a bug in my test code). Also i realized today that i have to think about some data receive loop on Windows for the pipes. OSX gives me callbacks on the mach ports which introduces different type of "problems". I want to merge both into one portable loop later on.
terminar is offline   Reply With Quote
Old 04-20-2020, 02:32 PM   #132
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Ok, I managed to get the src from git building/linking in visual studio 2017. I removed the python dependency (which I'm hoping was just some kind of a build tool), and had to add some libraries, but hey, at least it built. Now I'll have access to the full suite of debug capabilities within Visual Studio.

A quick look at the source (which is nice and short BTW) shows that once it does a test for a Komplete Kontrol device (it does this by matching the name) against:
1) Komplete Kontrol DAW - 1
2) Komplete Kontrol A DAW
3) Komplete Kontrol M DAW

If it doesn't find any of those device names then it returns that no Kontrol device is connected.

I don't see anywhere in the source that I have where it would return an error message like you're seeing. But maybe I pulled some old source from the repo. It looks like last update was about a year ago in May 2019. Also, I'm pretty sure the source I'm looking at is not cross platform; I see some stuff that OS-X would barf at. Maybe there's a newer repo somewhere, or did this project go private?
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 02:36 PM   #133
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

My Bad....so I downloaded and built this repo (James Teh): https://github.com/jcsteh/reaKontrol/tree/master/src

Instead of this one (brummbrum):
https://github.com/brummbrum/reaKontrol

which is a fork of James' project

Guess I know what I'll be doing after dinner...
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 03:04 PM   #134
terminar
Human being with feelings
 
Join Date: Feb 2020
Posts: 82
Default

Quote:
Originally Posted by _Stevie_ View Post
Unfortunately I really get only this, when installing the DLL and starting REAPER:
Did you follow the manual?
https://github.com/brummbrum/reaKont...096_Manual.pdf

Maybe you can find something that helps.
terminar is offline   Reply With Quote
Old 04-20-2020, 03:08 PM   #135
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Hey terminar, this post was meant as an answer for DrFrankencopter
I'm using an MK1 keyboard, which isn't supposed to work with ReaKontrol.

But maybe I'm misunderstand you.


@DrFrankencopter: that sounds terrific!
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom

Last edited by _Stevie_; 04-20-2020 at 03:20 PM.
_Stevie_ is offline   Reply With Quote
Old 04-20-2020, 04:24 PM   #136
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

While waiting for dinner to cook I managed to get the new source to build in Visual Studio. I can confirm that it doesn't crash Reaper on load. I don't have my S61 connected to my development machine yet. I'm hoping I don't have to do a full install of Komplete Kontrol (and the libraries) on it.

In my quick browse of the code I see that the Mk1 support has been commented out, and the MCU.cpp file that it relied on has been removed from the latest commit to the repo.

At least I think I have an idea where I need to start poking around...
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 06:40 PM   #137
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Bad news...I installed the NI Driver for my S-61.

I figured the place to start was with the older legacy plugin since it at least had some support for the MK1.

Took me a little bit of time to get it configured. But I kept getting error messages when I'd go to set the control surface mode to HUI "Error opening MIDI inputs and outputs".

I can see through the debugger I could see Reaper trying to communicate...sending track names, etc. But it just never received any midi messages. Never hit those breakpoints.

So, I figured, "maybe it's a problem with the way I had to butcher the code to get it to build in visual studio". So I built the original source via the python script, and unfortunately it behaves the same way.

Not sure what else to say, but it's kinda discouraging. I'll try re-installing the driver, but I must admit this isn't looking promising.
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 07:08 PM   #138
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Ok, so I spoke too soon.

I installed the Komplete Kontrol package from Native Access, and now things behave a little differently.

When I hit play, the plugin does respond and recognizes that the transport is to start playing. But it stops immediately after that. But at least the buttons light up, and there are MIDI messages being passed to the plugin (despite Reaper complaining on launch that there's a Control Surface Error: Opening MIDI inputs and outputs).

If I hit record (with no tracks armed) the transport plays, and hitting stop does make it stop.

I notice that hitting the play button makes it go into pause; and if I played around with it long enough all the transport lights on the S61 went dark.

So...it's "interesting"
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 07:37 PM   #139
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Sorry for making this thread like a personal debugging blog, but it seems that each of the transport buttons is registering 2 identical events per button press. This is why the transport goes into pause immediately.

At least according to the ReaScript console output shown by the plugin

For example:
Button down on play gives:
MIDI message 0x90 0x5e 0x7f
MIDI message 0x90 0x5e 0x7f

and then releasing the button gives
MIDI message 0x90 0x5e 0
MIDI message 0x90 0x5e 0

I'll keep working on it some other time...but there is definitely something odd going on.
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 08:08 PM   #140
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

OK, I promise this is my last post tonight.

Minor victory. It turns out that I had the reaper_kontrol.dll plugin running, and had it set up as a CSurf in my reaper preferences. This was resulting in the double MIDI messages. Seems there is no guide for how to set this up.

So, here's what you need to do:
Under Audio|MIDI Devices Inputs you need to:
Set Komplete Kontrol - 1 to enabled + control
Set Komplete Kontrol DAW - 1 to disabled
Set Komplete Kontrol EXT - 1 to disabled

Under Audio|MIDI Devices Outputs you need to:
set all the Komplete Kontrol items to disabled (not sure if this is strictly necessary, but ya, go for it)

Under Control/OSC/Web:
Make sure that you have not assigned a control surface to Komplete Kontrol (this is what makes the double MIDI messages)

It also seems that if I press buttons that aren't recognized, that the LED's on the transport buttons all go out. There's lots of stuff to figure out.
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-20-2020, 09:22 PM   #141
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Hm I tried all that, but the same error dialog appears again.
I also restarted the NI service from the task manager.

Does the plugin have a preference window somewhere?
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-21-2020, 05:02 AM   #142
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Sorry @_Stevie_ I should have been more clear. What I'm working with right now is a different build of the reaper_kontrol.dll. The one that you downloaded has all the Mk1 support stripped out of it (well, commented out anyways).

I'm building from a much older branch of the source code...where the Mk1 support was built in as a separate C file. My hope is to contain all my changes to one file, and then see if that can get merged into the main branch of brummbear's project.

I can send you what I've got, but I'm pretty sure it's no more than what Reaper offers out of the box (no plugin) via MCU support (I should test that). But, it's a starting place for modification!
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-21-2020, 05:40 AM   #143
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

I took a real quick look at the Ableton Live integration py scripts for the Mk1, and it seems that in order to light up the the Leds, or to draw characters on the screen you need to send MIDI messages back to the Mk1.

I don't see anything in there for support for the buttons on the far right of the controller (Navigate/Browser/Back/Enter/Arrows, etc). I'm not sure where/how these are handled. Perhaps they are MIDI messages on a different device name.

This evening I will poke around a bit more and see if I can:
1) Get the transport lights to illuminate properly
2) Draw a "hello" message to the display

@brummbear, I can start a separate thread for my adventures in Mk1 support, if you'd prefer to keep this thread for your currently supported branch. And again, many thanks for making your source public!
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-21-2020, 06:00 AM   #144
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Quote:
Originally Posted by DrFrankencopter View Post
Sorry @_Stevie_ I should have been more clear. What I'm working with right now is a different build of the reaper_kontrol.dll. The one that you downloaded has all the Mk1 support stripped out of it (well, commented out anyways).
!
Ah sorry, my bad! When I read “here’s what you need to do” I thought this was a call for action
Really appreciate the fact that you are diving into this. Thanks so much!

Feel free to send me anything if you want me to test.

Edit: not sure if this helps but there was a github project for programming the light guides (MK1).
Maybe there’s some useful info in that code?
https://github.com/AnykeyNL/SynthesiaKomplete
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-21-2020, 07:49 AM   #145
pianist_85
Human being with feelings
 
Join Date: Apr 2020
Posts: 3
Default Native komplete kontrol a 25

Hello Brumbear

Because I am blind I pourchased a kontroller Keyboard from native Instrument If you have Instruments that supports the nks standard you can simply browse presets and you have a good speech-feedback. Could you please describe wich keys to use for advanced edit mode etc. In the manual you hafe pictures but they could not be read from the screenreader so I don't know wich button to press.
Thank you and thank you again for the great work!
pianist_85 is offline   Reply With Quote
Old 04-21-2020, 06:58 PM   #146
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Weird things going on with my S61. I can get the plugin to respond to Transport control (yay), and am pretty confident I can add Loop functionality. But weird things happen when I hit the nav buttons (blue right/left arrow) on the keyboard.

As soon as I do that all the transport lights on the S61 go dark. But what's even weirder still is that the plugin does not see any MIDI messages from the nav light button press. I've looked at the Ableton scripts, and the code is looking for the right midi message, and in fact it will spit any received incoming message to the console. But is shows nothing when the nav buttons are pressed!

EDIT: It gets even more interesting. If I launch Komplete Kontrol standalone, the only transport button that works is record (though it sees FFW and RWD). It seems that Komplete Kontrol intercepts everything else.

Without the Nav Buttons able to be seen by the plugin there isn't really much that can be done. The best I can hope for is being able to light up the transport LEDs. As it is, the functionality in the mcu.cpp file I'm working with is less than the baseline reaper integration available by mapping the Kontrol-DAW input as a MCU control surface. Wish I had better news.
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll

Last edited by DrFrankencopter; 04-21-2020 at 07:26 PM.
DrFrankencopter is offline   Reply With Quote
Old 04-22-2020, 07:04 AM   #147
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

There must be some missing link somewhere. Jürgen from MOSS got the MK1 working, however I think he directly captures the USB stream instead of the MIDI stream. But I could be wrong, can't recall 100%.

In any case: does the MK1 maybe need some kind of "keep alive" MIDI pulse?
I know the Behringer devices (X-Touch) need those in order to function.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-22-2020, 08:10 AM   #148
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Perhaps this evening I'll try DrivenByMoss and see if my hardware works with reaper as intended. It's possible that I've got a buggy driver installation (hope so).

Alternatively I see DrivenByMoss has all his source online as well....I could try and walk through it; but it's java and I don't speak java yet.
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-22-2020, 08:29 AM   #149
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

That's a good idea. Once I'm done with work (should be tomorrow), I'll do the same and see if it works. We could contact Jürgen and ask how he did it. But maybe he is not very keen in sharing that knowledge. Not sure.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-22-2020, 08:51 AM   #150
terminar
Human being with feelings
 
Join Date: Feb 2020
Posts: 82
Default MK1 MCU

@_Stevie_ & @DrFrankencopter
To sum the MK1 stuff and maybe give some additional feedback (because you are on the right path):

When i understand the situation correct i think you really need to tinker with jcsteh's mcu code.
---
As brummbear mentioned some posts before he has removed the MK1 test code which is still available in jcsteh's repository.
The MK1 uses a complete different control protocol than the MK2 (someone raise his voice if that's wrong). I think it's the MCU (Mackie Control Universal) protocol. There are some posts on the native instruments forum and FAQ about the MK1 MCU support. I have only found one article in german, maybe you can search for an english version. https://support.native-instruments.c...TE-KONTROL-MK1

In general, as i understood correct there was never a working MK1 version in reaKontrol, even not in the jcsteh repo. MCU seems to be transferred via the MIDI SysEx stuff. There are some repos on github which may have some general Mackie/MCU information (https://github.com/search?q=mackie). On the NI website, there are also some threads about the MK1 MCU stuff like

https://www.native-instruments.com/f...mplate.266581/

To get a working MK1 support in reaKontrol, someone owning an MK1 (or who has access to one) has to reverse engineer the MCU messages for the MK1 e.g. sniffing the messages when the MK1 is connected to Ableton or some other DAW with MK1 "Midi/MCU" support. If there is a documentation about the MCU codes used for the MK1 somewhere it may help. Then a general MK1 support needs to be hacked back into reaKontrol and then - try&error until it works.
---

TL;DR: @DrFrankencopter i think you are right and currently the only person here who has the hardware to get the MK1 support working.

@__Stevie__ You asked some posts before: I don't think that my current reverse engineering of the NIHIA/NIHA is helping to get your MK1 working.
If the MCU messages are also transported via the NIProtocol - then maybe but don't count on that. Also i can't test it, i can only test with my MK2 which is just too different.
terminar is offline   Reply With Quote
Old 04-22-2020, 09:07 AM   #151
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Hey terminar,

thanks for that whole lof of useful information!
And yes, you are right, I just skimmed thru the NI helpdesk page.
They are saying that the MK1 is using the MCU protocol for transport.

The "auto focus selected track" might be a complete different story, though, since it communicates with the Komplete Kontrol instance based on the track selection.

But anyway, let's hope we can get this working. I'm totally willing to help here.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-22-2020, 09:09 AM   #152
terminar
Human being with feelings
 
Join Date: Feb 2020
Posts: 82
Default MK1 MCU

@_Stevie_
Have you tried something like this before:
- https://www.native-instruments.com/f.../#post-1411880
- https://www.native-instruments.com/f.../#post-1803197

Maybe the MK1 now just - "works out of the box" with Reaper?

Just trying to help, sorry if you tried that before or if this is not what you want.

*EDIT*:
So your goal is to get the "auto focus selected track" feature?

Last edited by terminar; 04-22-2020 at 09:15 AM.
terminar is offline   Reply With Quote
Old 04-22-2020, 12:46 PM   #153
brummbear
Human being with feelings
 
brummbear's Avatar
 
Join Date: May 2016
Location: out west
Posts: 301
Default

Quote:
Originally Posted by pianist_85 View Post
Hello Brumbear

Because I am blind I pourchased a kontroller Keyboard from native Instrument If you have Instruments that supports the nks standard you can simply browse presets and you have a good speech-feedback. Could you please describe wich keys to use for advanced edit mode etc. In the manual you hafe pictures but they could not be read from the screenreader so I don't know wich button to press.
Thank you and thank you again for the great work!
Hello pianist_85,

I imagine your screen reader does read the text, only the pictures showing the buttons on the keyboard are a problem. Further I assume that you have figured out how the standard functions work (just like per NI official user manual).

So here come the "extended edit" functions that I implemented on top of the normal behavior:

* Activate Ext. Edit Mode = SHIFT + push 4D Encoder

Once you have entered this mode:

* Insert New Track = push 4D Encoder. Note: If you read the manual I show tips how to make Reaper always insert a track with KK on it. This may be particularly useful for you as well.

* Remove Selected Track = CLEAR

* Toggle Record Arm of Selected Track = REC

* Change Tempo in +/- 1 bpm increments = METRO followed by rotating the 4D encoder

* Change Loop Length in +/- 1 beat increments = LOOP followed by rotating the 4D encoder

Upon command execution the keyboard automatically returns to Standard Mode.

Hope this helps!
brummbear is offline   Reply With Quote
Old 04-22-2020, 01:12 PM   #154
brummbear
Human being with feelings
 
brummbear's Avatar
 
Join Date: May 2016
Location: out west
Posts: 301
Default The Mk1 story

@Stevie @Dr Frankencopter

Basically, @terminar summed it up nicely in his earlier response (thanks for that!).

I would like to add a few things for clarity though:

* The MCU protocol has always been supported by the Mk1 (the Mk2 initially did not, but NI added a rudimentary MCU protocol at a later point also to the Mk2). When you switch on the keyboard (Mk1 or Mk2) and NIHIA is launched by your operating system the default MIDI language on the DAW port is the MCU protocol. BUT: The MCU protocol as implemented by NI does not help much for real DAW integration on the Mk2. The problem is that NI only implemented a few basics like transport control. The more interesting stuff does not work with MCU on the Mk2. On the Mk1 maybe they added some proprietary stuff even to MCU to at least make instance focus work (I don't know, but suspect that this could be the case).

* For advanced DAW integration NI introduced a new, proprietary MIDI protocol based on CC and SysEx messages. Let's call it the "NI DAW MIDI" protocol to distinguish it from ordinary MCU. In order to use this mode you have to tell NIHIA first that you want to speak this protocol rather than MCU. This is done via the HELLO command (see this thread further above). NIHIA respond with the HELLO command and the protocol version of the connected keyboard to acknowledge that it has switched to the NI DAW MIDI protocol and disabled the MCU protocol for that session. You do not need a fancy extension to test any of this: You can simply use a MIDI tool like MIDIOX or whatever and just send the HELLO command to NIHIA (well, you send it to "KOMPLETE KONTROL DAW -1" or whatever your MIDI port name is, but it ends up in NIHIA). The nice thing is that when you do this you can simply watch all the MIDI messages when you press buttons on your keyboard etc. This is what I did to reverse engineer it in conjunction with DBM sources by Jürgen.

* ReaKontrol never worked with the Mk1 although James Teh tried. The problem for him and for me always was that we do not have a Mk1 and it is terribly inefficient to code anything if you do not have the HW. This is by the way also the reason why the A and M series - while being supported - may show some tiny issues such as not 100% correctly scaled levels in Mixer mode. The A and M series use slightly different subflavors of the "NI DAW MIDI" protocol (there are 3 flavors). But all in all they are close enough to work with what has been implemented and tested for the Mk2 S series.

Since you have a Mk1 it should not be overly hard to debug what James tried early on (which I commented out and removed eventually). Once you have solved it it should be fairly easy to bring it back into ReaKontrol.

PS: The IPC communication that terminar is looking into is unrelated to Mk1 specifics. It is rather an attempt to check if we can make ReaKontrol even fancier by not just relying on the "NI DAW MIDI" protocol which was meant for DAW integration. Rather we may be able to additionally mimic being akin to a Komplete Kontrol software or Maschine software and thus gaining much more control over the buttons, screens, light guides etc. But this is still an early investigation, might turn out to be to complex... It would go way beyond just "simple" deep DAW integration.

Last edited by brummbear; 04-22-2020 at 01:23 PM.
brummbear is offline   Reply With Quote
Old 04-22-2020, 02:30 PM   #155
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

@brummbear, thanks for the response. From the symptoms it would seem that the "HELLO" message is not getting through to my S-61, and it's just communicating with regular MIDI messages and hiding some of the buttons from me. I'll do some more digging this evening.

Yes, my plan was to do my best to get the Mk1 working in a separate file, and once it's confirmed to work it can be merged back into your main branch. Hopefully this will make the eventual re-integration easy, and should only require a simple detection logic in the main.cpp (which was already in there before).

I'm not sure what Dev Environment you're using, but I've got it building/running on Visual studio, and the debugging with reaper is nice...I can set breakpoints when midi events are received. It's helpful. I'm going to look into MidiOx too.

@terminar, thanks for your messages too. I can confirm that the basic transport functions work when using the instructions that you linked. But at least on my setup none of the track navigation nor display functioned (just showed Midi CC #'s).

Cheers!
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-22-2020, 02:54 PM   #156
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Hey terminar!

Yes, I think I tried the MCU stuff some years ago and could get it working partially. Can't recall what didn't work.

Quote:
Originally Posted by terminar View Post
*EDIT*:
So your goal is to get the "auto focus selected track" feature?
Yes, that's one of features I really miss, but basically it would be wonderful the get the whole thing running, just as in Cubase
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-22-2020, 04:43 PM   #157
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

No joy guys...

I downloaded and installed MidiOx, and set up the connections to monitor Komplete Kontrol DAW -1. Then I launched Komplete Kontrol and saw the keyboard respond to Komplete Kontrol with it's display ("PRESS BROWSE"). But MidiOX showed none of that communication stream. However if I press the transport buttons I get the expected response messages. With Komplete Kontrol running the transport buttons illuminate in the expected manner (play lights green when playing and stop lights up when stopped and buttons are dark otherwise), but I'm not seeing the MIDI messages that are used to make that communication happen.

I tried a build of brummbear's latest reaper-Kontrol.dll and see that it fails to connect. I was hoping that there would be some kind of reaction to the CMD_HELLO message that is sent out (I even tried different protocol versions), but no, it doesn't connect. Either there is a different HELLO for Mk1, or there is a completely different way of telling the NI service that you want extended features.

I don't have any other DAW's with Komplete Kontrol support, so I can't really do any further snooping.

I'm stumped...

PS: I also tried opening up MidiOx and using the SysEx scratch pad to send 9F017F (which I think is the hello message...well, at least the 9F01 part should be. I didn't know what value to send so I figured 127 wasthe thing to do). At any rate, there was no response.

PS2: I also tried using DrivenByMoss to see what it might send as messages to the S-61Mk1, and all I got was Reaper crashing at launch from the drivenbymoss dll.
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll

Last edited by DrFrankencopter; 04-22-2020 at 06:09 PM. Reason: Added PS's
DrFrankencopter is offline   Reply With Quote
Old 04-22-2020, 04:45 PM   #158
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

I do have Cubase and can do some testing. Basically, I would use MIDIOX as the middle man and spy on the connection, right?
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-22-2020, 04:58 PM   #159
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Quote:
Originally Posted by _Stevie_ View Post
I do have Cubase and can do some testing. Basically, I would use MIDIOX as the middle man and spy on the connection, right?
Yup. In particular right at the start. I need to find out what the secret password is to actually start accessing the higher integration mode.
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 04-22-2020, 08:40 PM   #160
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Fired up MIDIOX and Cubase with the dedicated driver dll.
There you have to set "Komplete Kontrol DAW - 1" for MIDI in and output.
This enables then the transport controls in Cubase AND instance focus.
Setting the the MIDI ports to none disables all this.

Checking MIDIOX definitely shows a bunch of Control Changes on button presses.
So this must be the MCU stuff.
However, there's no indication about the communication when changing tracks (instance focus). So either this happens on a different level or it is obfuscated.

The fact that setting the MIDI ports to none in the driver dll somehow tells me, that the whole communication with Cubase MUST happen on a MIDI basis.
But I could be totally wrong.


On my web research I found some other resources, like the light guide thread:
https://www.native-instruments.com/f...lights.320806/

As far as I understood, people were using Wireshark on the USB port to catch all the communication. But I'm not sure if the bits that we are interessted in
are transmitted via USB. I don't think so. I think this is how Komplete Kontrol communicates internally with the MK1.
In that Ableton Live .py file, are there any traces of USB access?
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.