USB Midi Note off Question

Status
Not open for further replies.

mtiger

Well-known member
Hi Guys,

Question regarding a midi drum sequencer, when you trigger a step, a 'usbMIDI.sendNoteOn' message is sent, and when you deactivate that step, a 'usbMIDI.sendNoteOff' message is sent. However, the midi note still remains in the DAW piano roll. I'm wondering how one would remove that step when the noteOff message is sent, otherwise the DAW sequencer still plays the note even though the MIDI sequencer LED remains OFF, which is misleading to the user.

Any ideas?

Cheers,
M
 
Sounds like a problem with your DAW (which one?) expecting only NoteOn with a velocity of zero as NoteOff, and not handling actual NoteOff correctly.

To test, try sending NoteOn with zero velocity. If that fixes it, file a MIDI conformance issue on your DAW.
 
Ableton Live.

I changed the message to NoteOn with 0 velocity and still the note remains even after the step has been turned off.
 
It's not clear to me what you mean by this but it does sounds like it's the DAW's behaviour that you want to change not the Teensy.

Isn't it the same issue when you send notes from a MIDI-keyboard? How is this not an issue for the user?

If the DAW's state (paused record?) is available to the Teensy you could add a conditional that only sends the note-on/off if the DAW is in an active play/record state... but this means notes won't sound either and this may be worse than recording errant notes.

If I'm way off base perhaps you could spell out your issue in much greater detail?
 
Sure, this is what I'm using. Very simple, but perhaps I'm missing something.

Code:
void Sequencer(byte realTimeByte) {
  if (activeMode == SEQUENCER) {
    if (realTimeByte == CLOCK) {

      sequencePosition++;

      // Handle MIDI ** NEEDS IMPROVEMENT WITH NOTE OFF 
      if (stepState[i] == 1) { //This is a simple button state
        if (sequencePosition == i * 6) {
          usbMIDI.sendNoteOn(note, velocity, channel);
        }
      } else {
        if (sequencePosition == i * 6) {
          usbMIDI.sendNoteOff(note, velocity, channel);
        }
      }

      //Reset sequence position.
      if (sequencePosition == sequenceLength) {
        sequencePosition = sequenceStart;
      }
    }

    if (realTimeByte == START || realTimeByte == CONTINUE) {
      sequencePosition = sequenceStart;
    } else {
      if (realTimeByte == STOP) {
        //Do Nothing
      }
    }
  }
}
 
Last edited:
Status
Not open for further replies.
Back
Top