These functions will work:-
void noteOn(byte channel, byte note, byte attack_velocity) {
talkMIDI( (0x90 | channel), note, attack_velocity);
}
//Send a MIDI note-off message. Like releasing a piano key
void noteOff(byte channel, byte note, byte release_velocity) {
talkMIDI( (0x80 | channel), note, release_velocity);
}
void soundsOff(byte channel){
talkMIDI( (MIDI_COMMAND_SOUNDS_OFF | channel), 120, 0);
}
These functions will not work:-
int MIDI_sounds_off(void){
t_midiMsg midiMsg;
midiMsg.msg.command = MIDI_COMMAND_SOUNDS_OFF;
midiMsg.msg.channel = MIDI_DEFAULT_CHANNEL;
midiMsg.msg.data2 = 120;
midiMsg.msg.data3 = 0; /* Velocity */
Serial.write(midiMsg.raw, sizeof(midiMsg));
}
int note_on(int note, int vel){
t_midiMsg midiMsg;
midiMsg.msg.command = MIDI_COMMAND_NOTE_ON;
midiMsg.msg.channel = MIDI_DEFAULT_CHANNEL;
midiMsg.msg.data2 = note;
midiMsg.msg.data3 = vel; /* Velocity */
Serial.write(midiMsg.raw, sizeof(midiMsg));
}
int note_off(int note, int vel){
t_midiMsg midiMsg;
midiMsg.msg.command = MIDI_COMMAND_NOTE_OFF;
midiMsg.msg.channel = MIDI_DEFAULT_CHANNEL;
midiMsg.msg.data2 = note;
midiMsg.msg.data3 = vel; /* Velocity */
Serial.write(midiMsg.raw, sizeof(midiMsg));
}
Replace calls to the latter with the former with the appropriate calling parameters.