Try the example, from File > Examples > Teensy > USB_MIDI > Buttons.

I highly recommend you use the Bounce library to read pushbuttons (as shown in that example), rather than digitalRead().