Yeah you can connect via USB MIDI using an OTG adapter by enabling "USB MIDI Peripheral mode" in Developer Options. There's plenty of videos on how to set it up from the Android MIDI Arranger App community - just N.B. you may need a powered USB hub depending on your use-case.
I use my tools from a linux machine (reliable) and Android (OK). I got a h4midi wc to improve the setup. Webmidi and JS is not idealz as wakelock is needed and javascript is actually slow.