-
My apologies if this is captured elsewhere. I searched but was unable to find anything related. I'm new to both arduino and github Setup: I built a typical MIDI input circuit using an optocoupler, and have interfaced it with my Arduino Uno Rev3. I'm sending it MIDI note on/off messages from Ableton Live on my mac through a USB midi adapter, connected to the 5-pin midi connector on my breadboard. I setup a loop in ableton and generate several notes. Several LEDs on my breadboard respond to select notes. All functions well... The LEDs turn on at their respective note-on and note-off commands... I've tested this successfully at both slow and fast tempo in Ableton (30-180 BPM). When I enable the MIDI Clock, the LEDs stop turning on-off at multiple note-on/off commands. It happens even at the slowest tempos. I started wondering if I needed a clock handler, so I added a function to process that too. I have it turning on an LED for a few clock ticks, then turning it off (i.e. once per quarter note). However, even with a handler for MIDI clock, the note-on/off commands are still being missed. When I turn off synchronization (MIDI Clock) in ableton, everything works fine again. I redirected my Ableton MIDI stream to my iPAD and captured it on MIDI Scope. The sequence coming out looks correct. Any thoughts on why enabling the MIDI clock would cause things to get messed up at the arduino? I attached code below as well as a snapshot of the MIDI sequence. Any advice would be appreciated! Thanks! #include <MIDI.h>
#define LEDA 13
#define LEDB 12
#define LEDC 11
#define LEDCLOCK 10
#define NOTEA 0
#define NOTEB 1
#define NOTEC 2
#define CHAN MIDI_CHANNEL_OMNI // midi channel
#define MAXMIDICLOCK 24
#define MIDICLOCKTHRESH 6
int midiclockcount=0;
MIDI_CREATE_DEFAULT_INSTANCE();
void setup() {
MIDI.setHandleNoteOn(MyHandleNoteOn);
MIDI.setHandleNoteOff(MyHandleNoteOff);
MIDI.setHandleClock(MyHandleClock);
pinMode (LEDA, OUTPUT);
pinMode (LEDB, OUTPUT);
pinMode (LEDC, OUTPUT);
pinMode (LEDCLOCK, OUTPUT);
MIDI.begin(CHAN);
digitalWrite(LEDA,LOW);
digitalWrite(LEDB,LOW);
digitalWrite(LEDC,LOW);
digitalWrite(LEDCLOCK,LOW);
}
void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
if (pitch == NOTEA) {
digitalWrite(LEDA,HIGH);
}
else if (pitch == NOTEB) {
digitalWrite(LEDB, HIGH);
}
else if (pitch == NOTEC) {
digitalWrite(LEDC, HIGH);
}
}
void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {
if (pitch == NOTEA) {
digitalWrite(LEDA,LOW);
}
else if (pitch == NOTEB) {
digitalWrite(LEDB, LOW);
}
else if (pitch == NOTEC) {
digitalWrite(LEDC, LOW);
}
}
void MyHandleClock(void){
midiclockcount++;
if (midiclockcount > MAXMIDICLOCK) midiclockcount = 1;
if (midiclockcount == 1) {
digitalWrite(LEDCLOCK, HIGH);
}
else if (midiclockcount == MIDICLOCKTHRESH) {
digitalWrite(LEDCLOCK, LOW);
}
}
void loop() { // Main loop
MIDI.read(); // Continually check what Midi Commands have been received.
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Another data point. I am using the following USB MIDI Interface... I started reading the 1-star reviews, and noticed people with issues of dropped notes. Example: "The adapter is recognized in Linux, and it works with simple note transfer. However, as soon as Midi Time Code is transmitted as well, some notes are hanging while the others are not transmitted at all. I also experience dropped notes and weird delays with arp patterns generated in the DAW. I will try and spend more money on a box-like Midi adapter. Meanwhile I can block MTC in the DAW, but then I cannot sync the external synth, and arpeggios are still unreliable. Simple chords and melodies will play. Absolutely not recommend. I wonder if I should return this unit and get another, like the Roland. |
Beta Was this translation helpful? Give feedback.
Another data point. I am using the following USB MIDI Interface...
https://www.amazon.com/dp/B072B94W7Z?ref=ppx_yo2ov_dt_b_product_details&th=1
I started reading the 1-star reviews, and noticed people with issues of dropped notes. Example:
"The adapter is recognized in Linux, and it works with simple note transfer. However, as soon as Midi Time Code is transmitted as well, some notes are hanging while the others are not transmitted at all. I also experience dropped notes and weird delays with arp patterns generated in the DAW. I will try and spend more money on a box-like Midi adapter. Meanwhile I can block MTC in the DAW, but then I cannot sync the external synth, and arpeggios are still…