-
I want to have a note played only when certain criteria is met. In the code below, I send the note to a function which will determine whether it should play or not (if I get a positive result back). The LED lights up correctly, but the note plays no matter what (I can even comment out the MIDI.sendNoteON()). What am I doing wrong? if (MIDI.read()) // Is there a MIDI message incoming ?
{
switch (MIDI.getType()) // Get the type of the message we caught
{
case midi::NoteOn: {
chan = MIDI.getChannel();
pitch = MIDI.getData1();
velocity = MIDI.getData2();
arr_pos = binary_search(scales, 127, pitch);
if (arr_pos != -1)
{
digitalWrite(ledPin, HIGH); // Any Note-Off turns on LED
MIDI.sendNoteOn(arr_pos, velocity, chan);
} //end if
} //end case
break;
} //end switch
} //end if
|
Beta Was this translation helpful? Give feedback.
Answered by
franky47
Apr 15, 2022
Replies: 1 comment 4 replies
-
Hum could it be that the SoftThru feature is replaying the incoming note? You may want to disable it in void setup()
{
MIDI.begin();
MIDI.turnThruOff();
} |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
franky47
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hum could it be that the SoftThru feature is replaying the incoming note?
You may want to disable it in
setup
: