Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIDI.sendRealTime seems not working properly over USB #16

Open
LinkeHand opened this issue Apr 25, 2022 · 2 comments
Open

MIDI.sendRealTime seems not working properly over USB #16

LinkeHand opened this issue Apr 25, 2022 · 2 comments

Comments

@LinkeHand
Copy link

I installed the example code "AllEvents" on my Arduino Leonardo.

Most time, I do not get the Midi-NoteOn-Message from this example on my USB-Port. I Checked it with midi-ox unter windows 10 and even unter Ubuntu.
It seems that sending a MIDI-SendRealTime message like "MIDI.sendRealTime(MidiType::Clock);" corrupts a following Midi-Message most times.
I disabled the output on serial port an still got this error.
I changed the MIDI-sendRealTime - Message from "Clock" to "Start". I get still this error.
I added a second MIDI-sendRealTime-Message in the example code. I only see the first MIDI.sendRealTime-Message in midi-ox.

I don't have a clue.

Regards Bernd

@LinkeHand
Copy link
Author

Supplement: I reduced the example code AllEvents to this:

#include <USB-MIDI.h>

USBMIDI_CREATE_DEFAULT_INSTANCE();

unsigned long t0 = millis();
unsigned long tClock = millis();

using namespace MIDI_NAMESPACE;

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void setup()
{

}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void loop()
{

// send a note every second
// (dont cáll delay(1000) as it will stall the pipeline)
if ((millis() - t0) > 1000)
{
t0 = millis();

byte note = random(1, 127);
byte velocity = 55;
byte channel = 1;

MIDI.sendNoteOn(note, velocity, channel);
MIDI.sendNoteOff(note, velocity, channel);

}

if ((millis() - tClock) > 100)
{
tClock = millis();
MIDI.sendRealTime(MidiType::Clock);
}
}

And here a a few lines out of my log in midi-ox:

00007BE4 5 -- F8 -- -- -- --- Timing Clock
00007C16 5 -- F8 -- -- -- --- Timing Clock
00007C36 5 -- F8 -- -- -- --- Timing Clock
00007C5A 5 -- F8 -- -- -- --- Timing Clock
00007C62 5 -- 80 0F 37 1 Eb 0 Note Off
00007C76 5 -- F8 -- -- -- --- Timing Clock
00007CA7 5 -- F8 -- -- -- --- Timing Clock
00007CD4 5 -- F8 -- -- -- --- Timing Clock
00007CF9 5 -- F8 -- -- -- --- Timing Clock
00007D2A 5 -- F8 -- -- -- --- Timing Clock

The complete log is here

Arduino-midi.log

regards Bernd

@tstirrat
Copy link

Hi, I'm getting the same. Serial midi works fine, but USB midi (Arduino Micro [LEONARDO]) sends corrupted data (3 bytes of 0x0) after each realtime message:

Screenshot 2024-10-11 at 8 17 17 PM Screenshot 2024-10-11 at 8 18 39 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants