Unable to send notes to USB Hosts, but can receive just fine.

Status
Not open for further replies.

Sandwich

Member
Happy Thanksgiving!

I'm running a MIDI router that cross-talks between DIN ports, USB to PC, and a USB Host. Everything works great, I can filter messages, and send messages any direction from any source EXCEPT I can not send any note data to my USB Host. I have only tried notes so far. I can read from the Host just fine and send those messages to any other devices (except other MIDI Hosts). I have this same issue when a device is plugged directly into the USB Host or when a hub is connected with multiple devices. I can still read from all the devices when there is a hub with multiple USB Host devices connected. I can both send and receive to the non-host USB to a PC just fine.

The latest thing I was trying is sending note messages out to the USB Host directly in the program loop, and I still can't get anything through to my equipment. I have tried using these variations (separately):

Code:
midi01.send(type, data1, data2, channel);
midi01.send(mtype, data1, data2, channel); //using mtype conversion like for DINs in MIDI examples
midi01.sendNoteOn(data1, data2, channel);

I attempt to send to all 10 MIDI Hosts (midi01 thru midi10), I have tried with variables and entering numbers directly in the send functions, and as I mentioned before have tried adding functions directly to the loop() so that it's always sending to the midi device. All reads work, and all other sends work throughout the program.

This is the first time I've programmed this device since there has been an update to both Arduino IDE as well as teensyduino. Sometime around February when I was last messing with this device I was able to both send and receive to the USB Host as a single device but had not gotten it working as a hub yet.
 
This is the simplest code I've been able to come up with to test sending out MIDI notes over the USB Host. From what I gather both functions should be valid to start and to stop notes:

Code:
#include <Arduino.h>
//#include <MIDI.h>
#include <USBHost_t36.h> // access to USB MIDI devices (plugged into 2nd USB port)

USBHost myusb;
USBHub hub1(myusb);
MIDIDevice midi01(myusb);

void setup() {
  delay(1500);
  myusb.begin();
}

void loop() {

  delay(1000);
  midi01.send(0x90, 61, 123, 1);
  midi01.sendNoteOn(61, 123, 1);
  
  delay(1000);
  midi01.send(0x80, 61, 0, 1);
  midi01.sendNoteOff(61, 0, 1);

}

However, the instrument at channel 1 never receives the messages.

Edit: Using a teensy 4.0
 
Last edited:
Okay, I've made some progress figuring out the issue! But it leads a little further down the rabbit hole.

My MIDI equipment is a Korg NTS-1, a Korg Monologue, and a Korg Minilogue. I have figured out that my example sketch actually works and is sending out data. My NTS-1 receives the notes fine, and can transmit back out, everything seems to be working fully when either plugged directly into the USB Host or using a hub. However, the issue persists with both the Monologue and Minilogue. The NTS-1 is new to me, so I had assumed the note sends were not working using only the 'logues previously. But I figured out why they are both not playing notes.

When I plug the NTS-1 into the computer and look at the connections with midiox, it just shows up as a single midi in, and a single midi out (sound). Selecting (sound) as midiox's output and playing the keyboard produces sounds out of the NTS-1. When I plug either of the 'logues in, I get a single in, and TWO outs, (output) and (sound). The USB Host is defaulting to the (output) connection, which forwards the midi signals out of the 'logue's midi DIN output. So, I can hook up the Minilogue to the USB Host, and run a DIN from its output into the Monologue (which is not connected by usb). Then anything my teensy receives will go to the Minilogue (which plays no sounds) and then out of it's DIN output to the Monologue, and the Monologue plays sound. This is the same behavior as selecting (output) in midiox and playing notes. The teensy doesn't see the (sound) connection, so the 'logues don't play sound themselves when connected to the USB Host, they only forward out their DIN ports using the (output) connection. If I plug either of the 'logues directly into my PC and select the (sound) output, playing the midiox keyboard produces sounds out of the synth as expected.

So, the USB Host library is definitely working. However some of my synthesizers show up as more than one midi device over USB and the USB Host is defaulting to the one that doesn't produce music from the synth. Does anyone have any ideas on possible solutions to either change the default or output to all the MIDI connections?
 
Status
Not open for further replies.
Back
Top