This is a bit odd, I wonder if it's something in Bela or somewhere else.....
I am using a Ploytec MIDI interface plugged into the fullsize USB socket on Bela. Everything works perfectly except sometimes when my device is slaved to an external MIDI clock I notice my device is lagging behind by about 15ms.
So I altered my code to compensate for it, and suddenly my device was ahead. I keep changing the amount of compensation and sometimes it works, sometimes it doesn't.
Finally it seems to me that each time I power up, the unit behaves differently. At random there is sometimes a 15ms lag and sometimes no perceptible delay at all. Sometimes only 4 or 5 ms.
Is this possible or am I crazy?
At this point I am thinking of putting in an adjustable "MIDI clock offset" parameter which I will just have to set each time I turn the unit on. Not ideal though!