I use Teensy3.1 with the Mozzi synthetiser library.
I got hanging problem while using the first initialization code which is: MIDI.begin();
I found actually that the 4.2 version of the Midi library had no knowledge of Teensy boards.

I made a very little patch to restore the Teensy support. For now, I only tested Midi-in.

In midi_Defs.h file, in version 4.2 of the Midi library for Arduino, just patch line #199 with following code:

#if defined(ARDUINO_SAM_DUE) || defined(USBCON) || defined(CORE_TEENSY)
Before at line 199, it was:

#if defined(ARDUINO_SAM_DUE) || defined(USBCON)