Using WifiUdp.h on Arduino Mega and ESP8266?
the WiFiEsp class for UDP is WiFiEspUDP

#include &lt;WiFiEsp.h&gt;
#include &lt;WiFiEspUdp.h&gt;
#include "AppleMidi.h"

APPLEMIDI_CREATE_INSTANCE(WiFiEspUDP, AppleMIDI);