Midiusb noteon/noteoff

Hi

I am trying to write a midi controller with leonardo pro micro which will

a) be able to play drum hits (using fluid drums)
b) be able to control alolooper and various fx using toggle switches

Part b is working (controlling levels with midi learn and the controlChange() function in the midi usb library)

However i cannot get the noteon/noteoff to work.

I am assuming that i need to send 36 for bass drum and by convention, use midi channel 10.
Therefore I have a loop running over my 4 drum buttons as follows:

void readDrumButtons()
{
  for (byte i=0;i<4;i++)
  {
    int btnState = io.digitalRead(drumBtns[i]);
    if (btnState!=lastVal[i]) 
    {
      lastVal[i]=btnState;
      hasChanged=true;
      if (btnState==LOW)  noteOn(DRUMCHAN,36+i,0xD0);
      else noteOff(DRUMCHAN,36+i,0xD0);
      MidiUSB.flush();
    }
  }
  if (hasChanged) {delay(5);hasChanged=false;}
}


When monitored through midiOx midi input diagnostics I get

midiox

 00004469   5  --     99    24    D0   10  C  1 Note On               
 00004528   5  --     89    24    D0   10  C  1 Note Off     

Which looks to me ok (am assuming 24 is hex for 36 dec)

However, I cannot hear anything either through Fluid Piano or Fluid drums when the leonardo is connected to the moddwarf

And when I use the midi display utility inside the mod web interfaceI get strange results

For my 4th button (noteon/noteoff 39) the display gives me:

4thbutton_noteOn
4thbutton_noteOff

and where the it seems to think its a control message with control 48 value 96 on channel 15 (it is channel 15 but its not a control message)
The same is true for my 3rd and 2nd buttons (noteon/noteoff 38 and 37)

But noteon/noteoff 36 (my first button) produces no result at all.

Is there anything I am missing here? I have checked that audio is on and that the notes both 24 and 36 can trigger sounds in the fluid piano plug iin.

Anyway, if anyone can help I’d be really grateful.

1 Like

Doh! I’ve already answered it (but only by writing out the problem did I arrive at it).

The noteOn volume was too loud (D0=208) - when I reduced it to 60 everything was fine!

Sorry about that! But hope the process might be useful to someone else.

2 Likes

Glad you got it working, and that we could be your “rubber duck” :slight_smile:

2 Likes