nanoKontrol2 and Yamaha LS9 mixer

nottooloud

2012-03-16 18:13:10

I'm trying to use a nanoKontrol2 in Mackie HUI mode to control channels on the 2nd page of my Yamaha LS9-16 mixer.

nK2 fader 1 sends E0 pp qq, where pp and qq are identical and range from 00 to 7F.
LS9 fader 17 wants F0 43 10 3E 12 01 00 33 00 00 00 10 00 00 00 pp qq F7, where pp ranges from 00 to 07 and qq ranges from 01 to 7F.
With no rules, it works, and is very responsive, but of course the nK2 fader only moves 1/8 of the way while the LS9 fader goes full scale.
I tried a rule of pp=pp/15. The scaling works, but it's laggy and slow, and MT crashes with buffer overflows.
How should I be doing this?

DvlsAdvct

2012-03-16 19:23:26

You could try a series of rules to designate every 18 steps a new +1. Something like...

Code: Select all

Translator Name: Fader
Incoming Action: E0 pp qq
Rules: if pp==0 then Goto "0"
if pp<=18 then Goto "1"
if pp<=36 then Goto "2"
if pp<=54 then Goto "3"
if pp<=72 then Goto "4"
if pp<=90 then Goto "5"
if pp<=108 then Goto "6"
if pp<=127 then Goto"7"
Label "0"
ga=0
Exit rules, execute outgoing action
Label "1"
ga=1
Exit rules, execute outgoing action
Label "2"
ga=2
Exit rules, execute outgoing action
Label "3"
ga=3
Exit rules, execute outgoing action
Label "4"
ga=4
Exit rules, execute outgoing action
Label "5"
ga=5
Exit rules, execute outgoing action
Label "6"
ga=6
Exit rules, execute outgoing action
Label "7"
ga=7
Exit rules, execute outgoing action
Outgoing Action: F0 43 10 3E 12 01 00 33 00 00 00 10 00 00 00 ga qq F7
make sense?

nottooloud

2012-03-17 05:12:20

Doesn't that add a big decision tree and still calculate pp for every increment?
Must be something I'm not understanding. Are divisions really bad news?
I guess I'm surprised that my one division dogs the machine so hard.

What I'm actually trying to do, I think, is scale 0-127 up to MSB LSB.
There has to be a more efficient algorithm.
The one I'm using isn't even mathematically correct, it just happens to scale properly.
Instead of LSB cycling for each MSB, it goes up 1.

florian

2012-03-17 10:10:25

chiming in...
  1. MT should never crash, could you please post the preset that caused MT to crash (or send to me or Bome via PM)?
  2. DvlsAdvct correctly provided an alternative (and more flexible) way, but a division should not matter in terms of performance. I suspect that your rules or translator entries caused some kind of feedback or infinite loops, which can indeed eat a lot of CPU.
Thanks,
Florian

nottooloud

2012-03-17 21:17:37

Tried DvlsAdvct's code, for which I thank you both.
Less laggy than my division, certainly, but still laggy.
When I severely exercise the nK2 fader, I get the same crash.
MT pops up a window marked Errors, with a flickering text "Error message queue is full".
That window blanks, and that's all there is.
MT is still functioning as a translator, but no longer responds to keyboard or mouse.
I have to kill it to quit.

With my division rule, it locks up pretty easily when joggling 2 faders.
Experimenting further, I can lock it up with no rules, just ram a lot of fader moves through it.

There will definitely be situations where I will smack all 8 faders to 0 at once.
It needs to be able to handle a decent amount of data.
Attachments
LS9 Korg nK HUI.bmtp
(1.65 KiB) Downloaded 296 times

nottooloud

2012-03-17 21:47:04

New version.
I unchecked the return from the LS9 and the out to the nanoKontrol to eliminate feedback loops.
I set up translators for all 8 faders.
When I simply slide 4 faders bottom to top at a moderate speed, I get the message queue lockup.
Attachments
LS9 Korg nK HUI crash.bmtp
(2.25 KiB) Downloaded 280 times

DvlsAdvct

2012-03-18 00:36:16

Hi nottooloud

How have you set up your MIDI ports?

nottooloud

2012-03-18 05:50:54

Not sure what you mean.
No passthrough.
In from the nanoKontrol2, out to an M-Audio Uno to the LS9.

florian

2012-03-18 14:07:14

I've tried the preset. The problems are caused by the standard 5-pin DIN MIDI connection.

Original MIDI speed is roughly 1 controller message (3 bytes) per millisecond. You translate one message to an 18 byte sys ex message, so when moving multiple sliders at once, you controller message rate is e.g. 1 message per millisecond (or more, since it's USB). MT will translate them each to 18 bytes, so MT tries to send to your LS9 with a rate of 18 bytes per millisecond! The MIDI interface can only process 3 bytes per millisecond, so they get queued up. Midi Translator itself has a relatively small queue to enforce realtime behavior, so eventually, MT's queue will overflow and the error message will pop up.

However, I could not make MT crash -- the error message pops up but operation continues w/out problems and you can dismiss the error window.

As I see it, the lag is caused by the queue-up caused by the slowness of the 5-pin DIN MIDI connection. I can clearly see the lag in the log window. Try a virtual MIDI OUT port instead and you'll see that there won't be any lag visible in the log window.

I have tried this on Windows. Are you on Windows or OSX?

Thanks,
Florian

nottooloud

2012-03-18 17:49:10

I'm running Windows XP on a Core Duo 2 GHz Lenovo laptop.
So I'm just trying to push too much data through the hardware, and MT is correctly restricting it?
Which means that this approach is simply not going to work. Alas.

Here I am unable to dismiss the error window.
MT does continue to translate, as I said, but mousing over it gets me hourglass.
If I click the error window close X twice, Windows offers to kill it as unresponsive.

florian

2012-03-18 18:14:22

thanks for the details. I assume you're using version 1.7.2, right?

You can change the preset so that it overrides any pending MIDI messages.

Basically the way to go is for the first slider (MIDI CHannel 1):
  • instead of using local variable pp, use a global variables, e.g. g0
  • instead of sending the sys ex MIDI message, issue a one-shot timer "slider 1" with 0ms delay
  • use a new translator entry with incoming action timer "slider 1" and outgoing action the Sys Ex MIDI message, using g0 instead of pp
You can do the same thing for all sliders, using a different global variable and a different timer name for every slider.
The trick is that there can only be one active timer of a given name. So when you start a timer, old timer(s) running on that name are killed. So only the last MIDI message is sent.

Let me know if that works. Otherwise I'll try to make it work myself.
Florian

nottooloud

2012-03-18 19:28:46

That works!
I don't know which I'm more impressed by, your program or your support.
Now I just need to properly convert from the Korg's 00-7F to the Yamaha's MSB 00-07 and LSB 01-7F to get full resolution out of the nK2 fader.
Seems like I just multiply by 8, but how do I split the result into the two variables?

Searching, it looks like you've already answered this one. I'll go read stuff.

nottooloud

2012-03-18 23:16:55

So here's what I've got working.
I don't completely understand it, but the limits scale correctly and it tracks smoothly.

pp is my incoming 0-127 value.
g1 ga is my outgoing 1-1920 MSB LSB value.

Code: Select all

Label "scale up"
qq=pp*16
Label "truncate to MSB"
g1=qq/240
rr=g1*240
Label "subtract to LSB"
ga=qq-rr

nottooloud

2012-03-19 02:19:59

And for anybody wanting to play along at home, here's the project file.
The filter for 24 is disabled because I pair channels 23 and 24 on the console as playback returns.

Next I want to tackle the mute switches and those pesky LEDs.

In cc mode, I can set the LEDs to internal, change the buttons from momentary to toggle.
I've decided to do this all in the nanoKontrol2's Cubase (Mackie HUI) mode for portability.
Korg's editor/librarian is awful, so I'm using MT to do all the heavy lifting.
And in HUI mode, the LEDs don't do anything, and the buttons are momentary. No settings.
When I plug this nK2 into a machine running Reaper and enable it in preferences, it just works.
The LEDs in the transport controls, solos, mutes, and rec enables all track correctly.
So it must be capable of receiving messages from outside.

nK2 Mute 1 does 90 10 7F when pressed, 90 10 00 when released.
Yamaha LS9 channel 17 on is blah blah blah 01 F7, and off is blah blah blah 00 F7.
That part I can work out.
Reaper seems to be sending a string of B0 49 00 messages when idle.
When I toggle the channel 1 mute in Reaper, it sends 90 09 00 a couple of times, or 90 08 00, or 09 10 00.
I haven't a clue what to do with that.
Attachments
LS9 Korg nK HUI 2.bmtp
(3.15 KiB) Downloaded 279 times

florian

2012-03-19 08:47:46

Hi nottoloud,

thanks for the preset! I don't know about the LED's on the NK2, maybe check out the documentation?

Florian

nottooloud

2012-03-19 18:13:19

That's one I hadn't seen yet, thanks. Unfortunately, it says "in DAW mode, the DAW deals with it."
Maybe I need to me looking at documentation for Mackie's HUI protocol.

nottooloud

2012-03-19 18:36:18

I found another Korg file that has a bunch of information, but sending BF 30 00 or BF 30 7F to the nK2 doesn't seem to do anything.
Perhaps "Native KORG Mode" is cc.

Code: Select all

4.Native KORG Mode Messages ----------------------------------------------------

(1) Native KORG mode Display LEDs
+--------+------------------+--------------------------------------+
| Status | Second   | Third |   Description                        |
| [Hex]  | [Hex]    | [Hex] |                                      |
+--------+----------+-------+--------------------------------------+
|   BF   |  2E      |  ss   |   Cycle (ss= Off:00~40 On:41~7F)     |
|   BF   |  2B      |  ss   |   REW                                |
|   BF   |  2C      |  ss   |   FF                                 |
|   BF   |  2A      |  ss   |   STOP                               |
|   BF   |  29      |  ss   |   PLAY                               |
|   BF   |  2D      |  ss   |   REC                                |
+--------+----------+-------+--------------------------------------+
|   BF   |  20      |  ss   |   Group 1 Solo                       |
|   BF   |  21 ~ 27 |  ss   |   Group 2 ~ 8 Solo                   |
|   BF   |  30      |  ss   |   Group 1 Mute                       |
|   BF   |  31 ~ 37 |  ss   |   Group 2 ~ 8 Mute                   |
|   BF   |  40      |  ss   |   Group 1 Rec                        |
|   BF   |  41 ~ 47 |  ss   |   Group 2 ~ 8 Rec                    |
+--------+----------+-------+--------------------------------------+

nottooloud

2012-03-19 19:05:01

Yah, here we go.

Korg nanoKontrol2 in Cubase (Mackie HUI) mode LED control

90 nn 7F turns on LED #nn, and 90 nn 00 turns it off.

Record LEDs are 00-07
Solo LEDs are 08-0F
Mute LEDs are 10-17

Transport codes are:

Track Left 2E
Track Right 2F
Cycle 56
Marker Set 59
Marker Left 58
Marker Right 5A
Rewind 5B
Forward 5C
Stop 5D
Play 5E
Record 5F

florian

2012-03-20 00:56:27

great! too bad I only have a NanoKontrol 1 here...
Florian

nottooloud

2012-03-20 01:42:22

I envy you your extra fader.

I've got the Mute buttons tracking reciprocally between the nK2 and the LS9.
Solo buttons are next.

Midi Translator rulez OK.

nottooloud

2012-03-20 17:30:26

I was hoping to use the knobs to run the LS9 faders 25-32.
Trivially easy in cc mode, but in Mackie mode they're set up as incremental pan controls.
Knob 1 sends repeated B0 10 10 when turning right, and B0 10 41 when turning left.
When you get to the right end, it switches to B0 10 3F. Left end is B0 10 7F.
Pseudo endless encoders with end markers. It's probably 128 steps, and I could increment and decrement global variables with the end triggers as recalibration.

Ugh.

nottooloud

2012-03-20 17:46:05

Huh. Well, that wasn't so hard.
Midi Translator is amazing.

This sort of a thing per knob:

Code: Select all

Preset 2: LS9 nK2 knobs

Translator 2.0: knob 1 timer
Options: stop=false
Incoming: nK k1 incremental
Rules: 
  if pp!=127 then skip next rule
  k1=0
  if pp!=63 then skip next rule
  k1=127
  if pp!=1 then skip next rule
  k1=k1+1
  if pp!=65 then skip next rule
  k1=k1-1
  Label "scale up"
  qq=k1*16
  Label "truncate to MSB"
  j1=qq/240
  rr=j1*240
  Label "subtract to LSB"
  ja=qq-rr
Outgoing: One-shot timer "nK2 k1": 0 ms delay

Translator 2.1: ch25
Options: stop=false
Incoming: On timer "nK2 k1"
Outgoing: MIDI F0 43 10 3E 12 01 00 33 00 00 00 18 00 00 00 j1 ja F7
So, attached is the fully working preset to run page 2 of a Yamaha LS9-16 with a Korg nanoKontrol2.
Mutes are LS9 channel Ons 17-24, lit when the channel is on as per the console.
Solos are LS9 Solos 17-24
Records are LS9 channel Ons 25-32.
Buttons track each other both ways.
Since the nanoKontrol2 faders and knobs aren't motorized, the LS9 tracks the nK2 but not vice versa.
There is no automated synchronization, which means that after you fire it up or load a new scene into the LS9,
you have to move all the faders and knobs on the nK2, and push all of the relevant buttons on either unit.
Attachments
LS9 Korg nK HUI 6.bmtp
Korg nanoKontrol2 controlling Yamaha LS9-16 page 2
(10.54 KiB) Downloaded 292 times

florian

2012-03-27 21:33:36

Hi Nottoloud,

glad you figured it out... and thanks a lot for sharing!
Florian