USB Host 36 MIDI RAW data?

Garug

Well-known member
Is there a way to get the RAW incoming data instead of doing this?

// MIDI message, defined by these 5 numbers (except SysEX)
type = USBhostMIDI[LCXL1.port].getType(); // MIDI message, 128-255
channel = USBhostMIDI[LCXL1.port].getChannel(); // MIDI channel, 1-16
data1 = USBhostMIDI[LCXL1.port].getData1(); // first data byte, 0-127
data2 = USBhostMIDI[LCXL1.port].getData2(); // second data byte, 0-127
cable = USBhostMIDI[LCXL1.port].getCable(); // which virtual cable with MIDIx8, 0-7

I much rather would get rid of this layer of confusion that abstracts the understanding of the actual data.
 
I assume this related to your question in this other thread:
I am currently trying to solve a MIDI problem, it is with 1.57.2 I have tested so far.

The problem is that the LaunchControl XL sends the slider and potentiometer positions at startup, immediately after power on. If slider(s) are fully up (value 127) they get value 0, if they are just slightly down (like 126) they get correct value.

This happens only at power up. if I disconnect and connect the USB it gets them correctly. I have been verifying my code and find nothing wrong, also discussing with Novation.

Currently I suspect there is something that goes wrong with USBHost_t36.h at power up, with MIDI. This is how I read the incoming data.

Code:
Code:
void processUSBhostMIDI() {
  uint8_t type, channel, data1, data2, cable, CC_element, Note_element;

  // MIDI message, defined by these 5 numbers (except SysEX)
  type    = USBhostMIDI[LCXL1.port].getType();      // MIDI message, 128-255
  channel = USBhostMIDI[LCXL1.port].getChannel();   // MIDI channel, 1-16
  data1   = USBhostMIDI[LCXL1.port].getData1();     // first data byte, 0-127
  data2   = USBhostMIDI[LCXL1.port].getData2();     // second data byte, 0-127
  cable   = USBhostMIDI[LCXL1.port].getCable();     // which virtual cable with MIDIx8, 0-7
  
  
    switch (type) {

      
  case 0xB0:
             {
              if(data1 >= 13 && data1 <=20){ LCXL_Controls[data1 - 12].SendA        = data2; LCXL_Controls[data1 - 12].updated = true; } 
              if(data1 >= 29 && data1 <=36){ LCXL_Controls[data1 - 28].SendB        = data2; LCXL_Controls[data1 - 28].updated = true; }
              if(data1 >= 49 && data1 <=56){ LCXL_Controls[data1 - 48].Pan_Device   = data2; LCXL_Controls[data1 - 48].updated = true; }
              if(data1 >= 77 && data1 <=84){ LCXL_Controls[data1 - 76].Slider       = data2; LCXL_Controls[data1 - 76].updated = true; }

              if(data1 == 104 ){ LCXL_Select.SendSelectUp     = data2; LCXL_Select.updated = true; }
              if(data1 == 105 ){ LCXL_Select.SendSelectDown   = data2; LCXL_Select.updated = true; }
              if(data1 == 106 ){ LCXL_Select.TrackSelectLeft  = data2; LCXL_Select.updated = true; }
              if(data1 == 107 ){ LCXL_Select.TrackSelectRight = data2; LCXL_Select.updated = true; }

             } break;
After power when sliders are moved all works perfect. also reading slider 127. A simple demo, this maps the controls to control the LEDs, just to test. https://youtube.com/shorts/KL92lL4lBfY?feature=share This demonstrates the problem https://youtube.com/shorts/FEitLntxIrI?feature=share when slider is fully up the 2 bottom LEDs should be red. the knobs do not have this problem.

A few questions to get the picture more clear:
1. "The problem is that the LaunchControl XL sends the slider and potentiometer positions at startup, immediately after power on. ". You mean power-on of the Teensy with the LaunchControl connected to the USBhost header?
2. "If slider(s) are fully up (value 127) they get value 0, if they are just slightly down (like 126) they get correct value.". Is there a way to prove that this is not caused by the LaunchControl?
3. Which Teensy are you using? The T3.6 or the T4.1?

Paul
 
1. power-on of the Teensy with the LaunchControl connected to the USBhost header? Yes

2. Is there a way to prove that this is not caused by the LaunchControl? No, and I originally thought it is to blame, but it works ok if I disconnect and connect the USB, i.e power on Teensy stays on, just cutting the LaunchControl power.

3. T4.1

But despite of thus would really want to get the RAW MIDI data. The abstraction on that is heavy and it just causes confusion and difficulties to troubleshoot. The MIDI messages them self are simple.
 
With respect to Q&A #2: could it be that the Teensy is just not ready yet? Although you state that with faders not at max (like 126) it works OK.

Is it possible to post your complete code? I have a Teensy 4.1 here and a home-brew MIDI control surface & an Arturia MiniLab MK2.
I'm also wondering whether the USB power of the USB host connector has some issue like late activation.

Paul
 
About the 127 Slider problem,

Made a video and noticed an additional thing


The first startup is by loading the sketch, it seems to work the same as actually cutting the power from Teensy

Second is by disconnecting the USB, but noted now, if the sliders where not moved this problem remains.

After sliders are moved it works when cutting power from USB

I am always receiving the data the same way, I have verified that this problem is only if slider value is 127. also the knobs do not seem to be affected by this.

Note 2 red LEDs means 127 or close to it. Green means 0 or close to it. But I have verified this also with terminal

Code:
 *** LVZ IF STARTING *** 
 *** DEVICE FOUND, Device MIDI0 1235: 61 - connecting ***
     - manufacturer: Focusrite A.E. Ltd
     - product:      Launch Control XL
 *** Launch Control XL DRIVER, Device MIDI0 1235: 61 - connected ***

 POS_1, SendA 64, SendB 64, Pan_Device 64, Slider 0, TrackFocus 0, TrackControl 0
 POS_2, SendA 53, SendB 67, Pan_Device 37, Slider 0, TrackFocus 0, TrackControl 0
 POS_3, SendA 46, SendB 47, Pan_Device 64, Slider 0, TrackFocus 0, TrackControl 0
 POS_4, SendA 42, SendB 127, Pan_Device 54, Slider 0, TrackFocus 0, TrackControl 0
 POS_5, SendA 47, SendB 78, Pan_Device 43, Slider 98, TrackFocus 0, TrackControl 0
 POS_6, SendA 56, SendB 94, Pan_Device 127, Slider 115, TrackFocus 0, TrackControl 0
 POS_7, SendA 69, SendB 110, Pan_Device 127, Slider 98, TrackFocus 0, TrackControl 0
 POS_8, SendA 64, SendB 66, Pan_Device 85, Slider 116, TrackFocus 0, TrackControl 0
 *** INIT LAUNCH CONTROL XL *** 
Change teplate to: 0

So very strange.
 
After watching your last video, I have the feeling that this issue is LaunchControl related.
It looks like when the faders are at maximum at powerup, that fader state is not correctly registered.
At 0:15 through 0:20 you move the 2 faders from max to less and back to max, and the LED changes from green to red.
At 0:22 you unplug the USB and replug at 0:23. What happens if you wait for 10-30 secs after unplugging and then replug the USB connector?

To monitor what the LaunchControl spits out at power-up you could try this web-based monitor. It supports hot-plugging USB MIDI devices [MIDI-OX does not].

Paul
 
Last edited:
Interesting application, thanks. How ever it seems it does not quite catch all data, usually less than 20 messages, sometimes non. there is 24 potentiometers and 8 sliders. Usually the sliders are not on the messages, so makes it difficult to see, but did not see any 0 values.

It probably is not intentional that it sends the messages. Device support said it should not be sending anything unless knobs or sliders are moved. Also there is no known command to get the reports....

It is a bit sad, makes it useless for for our purposes. It just is not acceptable we do not know the positions at startup, that someone should move 24 potentiometers and 8 sliders to get them in synch with the SW. Unintentionally it almost works but the slider 127 problem...
 
It is a bit sad, makes it useless for for our purposes. It just is not acceptable we do not know the positions at startup, that someone should move 24 potentiometers and 8 sliders to get them in synch with the SW. Unintentionally it almost works but the slider 127 problem...
Yeah, that's a pity for sure...

I checked the Programmer’s Reference Guide and there is indeed no mentioning of pot/fader readouts...and weird that it does send out messages at power-up.

This statement from the "Launch Control XL HUI support" document is telling...
*Due to the Pro Tools HUI implementation, the centre detent of the
LaunchControl XL pan pots will not directly correspond to the centre position
of Pro Tool’s pan pots. The controls still work relatively to turn pans left and
right. HUI is designed to work with encoders for pan and send controls. The
Launch Control XL has pots rather than encoders which have an absolute
position. In order to make these work we ‘emulate’ the operation of the
encoders in firmware.
The pan and send controls don’t have pot pick-up, they move immediately
from whatever position they are in. This is great if you want to make a small
adjustment but you may find you hit the end of the pot’s physical travel
before before the virtual control on screen. To correct for this you may need
to turn the control from one end to the other in order to reset the range. You
will need to do this when you first load a session, when you bank tracks (9-16,
17-24 etc.), or when you change from pan to send a, send b etc.

Paul
 
Back
Top