'MIDI' was not declared in this scope

Starting with a fresh installation of IDE 1.8.4, use the IDE library manager to install USB Host Shield Library 2.0 by Oleg Mazurov, et al., version 1.3.1. Then install the MIDI Library by Forty Seven Effects, version 4.3.1.

Open the example starting from File | Examples | USB Host Shield Library 2.0 | USBH_MIDI | bidirectional_converter. The example compiles without errors.

The example source code is different from the version you have. You might be using an obsolete version so upgrade to the latest USB Host library. And use the example code included with the library.

The MIDI serial library is different from the one mentioned in your sketch. I installed the Forty Seven Effects version which is specified in the latest example comments. You may have to remove other MIDI serial libraries to get this to work.