Hi,
I had some problems with midi on raspberry pi and made an external with pyext to get midi in and out on an alternative way for troubleshooting. I did this to learn some more python, also.
To my surprise some irregular audio i/o warnings and clicks i had before did not show up using this externals anymore.( closed any midi connections in the pd-midi dialogue.)
I got curious and measured hardware midi roundtrip latency using the timer-object. Compared with pd's alsa-midi and oss-midi it is much faster.
I read somewhere pd's midi is somehow synced to the audiobuffersize, perhaps this is the reason midi is faster via python(?)
The script relies on the python-rtmidi library
https://pypi.python.org/pypi/python-rtmidi
(rtmidi is a C++-library)
You need pyext installed in pd's startup-folder to use it within pd:
http://grrrr.org/research/software/py/
I attached the script (needs to be in the pd-path) and a pd patch to demonstrate and test it.
On my Raspberry Pi i measured usually 2.3ms lateny using rtmidi (min. 1.3, max 4ms) and ~5.3ms using pd's alsa-midi and the built-in objects (min 4, max 6.6), running headless with no gui, audiobuffersize 6.
Tested with Raspbian wheezy, pd-extended 0.43.4, python 2.7.3, pyext 0.2.2
I'm learning python, suggestions welcome
Jens