"Apple have the edge as they control the hardware and software, so the timings can be tightly controlled and given a known config"
Using Samsung as an example, just as with Apple and not "android", I have a Galaxy Note, for which samsung controls the hardware, and essentially the software as they can modify whatever they want as long as it passes google compatibility tests. So you can't necessarily compare "android" here - only base AOSP android.
So, to say that apple controls the hardware and software, but not Samsung, or any OEM for that matter, is not correct. You are just saying "android" as in "google", who doesn't make hardware. This is why there is that "update delay" always brought up regarding android updates. What are many of them doing during this time? "tightly controlling their timings", for one.
Samsung has always added and tweaked things over stock android. Music control works just fine, although I cannot speak for MIDI but how hard can that be? I have used real time guitar effect apps such as Andrig that stock Lollipop has only now caught up to as far as latency, which is on par with apple.
So, while there is some truth to what you say as a blanket statement, it is not true when you start talking about specific models of android based phones.
And windows? The OEMs cannot customize the source code. So there is certainly no optimization they can control there. MS's own lumia's could but how are they going to get any OEMs to be excited about making their phones if Lumia has the advantage?