Midi.h MIDIUSB doesn't work for 'write'

Experimenting with a pro-Micro making it act as a USB midi device, i found that i can get it recognized, and using the MIDI.h midiUSB example i can read() midi events, but i can not manage to write() any midi back to my laptop.
The 'MIDIUSB.h' library i can manage to get it to work both ways. Anybody know why this is ?
I mean the TX led on the Micro shows activity (in sync with the RX led when midi thru is enabled) also when transmitting individual packets, but nothing is coming through to my DAW (which is confirmed to be working through use of the MIDIUSB.h library)

It's been a while since I last used the MIDI.h library, so I can't really help you with that, but if you just need a MIDI library that supports MIDI over USB, you could use the Control Surface library I maintain:

https://tttapa.github.io/Control-Surface-doc/Doxygen/d3/df7/midi-tutorial.html

Have you got a MIDI monitor in place to see if these signals are getting into your computer?
If they are then it is the DAW that is not picking up the messages.
What DAW are you using?

I am using Ableton, it picks it up just fine when i use MIDIUSB.h, just not with MIDI.h
I could try with Cubase, but the midi input in cubase is not as reliable as Ableton. I could try a standalone NI plug, but again, if Ableton doesn't pick it up, it is rather pointless to even try.

You could try using an online MIDI monitor, e.g. https://www.roxxxtar.com/apps/miditool/.

I wouldn't expect it to unless you have something to convert normal serial into MIDI running inside the computer, like Hairless. If you want to send stuff you have to send it with MIDIUSB.h not MIDI.h

That's not true: GitHub - FortySevenEffects/arduino_midi_library: MIDI for Arduino

In which case @Deva_Rishi needs to post his code.

I was doing some investigation, and i do see i am a few versions back (4.3.1) I will update first and see if that helps at all. I am pretty sure it was supposed to be working in v4.3.1 no harm in updating .

OK, so in version 5.0.2 it does work ! yahoo. I mean everything but the midi-thru, but i do that manually anyway, it wasn't reliable. Had to remove version 4.3.1 or the whole thing won't compile properly of course. For completions sake

USBMIDI_CREATE_DEFAULT_INSTANCE();

#define LED 3
uint8_t channel = 1;

void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) {
  MIDI.sendNoteOn(inNumber, inVelocity, inChannel);
  analogWrite(LED, inVelocity * 2);
}
void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) {
  MIDI.sendNoteOff(inNumber, inVelocity, inChannel);
  analogWrite(LED, 0);
}

void setup() {
  pinMode(LED, OUTPUT);
  analogWrite(LED, 200);
  delay(1000);
  analogWrite(LED, 0);

  MIDI.begin();
  MIDI.turnThruOff();
  MIDI.setHandleNoteOn(handleNoteOn);
  MIDI.setHandleNoteOff(handleNoteOff);
}

void loop() {
  static uint32_t moment = millis();
  static bool noteon = true;
  if (millis() - moment > 2000) {
    moment = millis();
    if (noteon) MIDI.sendNoteOn(64, 127, channel);
    else MIDI.sendNoteOff(64, 0, channel);
    noteon = !noteon;
  }
  MIDI.read();
}

Thanks all !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.