On Sun, Jul 04, 2010 at 11:05:02PM +0100, Dan Mills wrote:
On Sun, 2010-07-04 at 23:35 +0200,
fons(a)kokkinizita.net wrote:
Well, at least those sound cards that provide
both audio and midi
*could* do this - timestamp incoming midi and provide that info
in some way, and requiring similar time stamps for outgoing midi.
Could do it even with separate midi and audio cards, as long as the midi
RX ISR can somehow grab a timestamp from the audio card driver (in an
interrupt context), and as long as the midi RX ISR is getting serviced
with negligible latency (Otherwise you need to timestamp in hardware).
In reality is is probably only practical in an embedded context where
you have total control over the hardware.
Note that even with this you will have some jitter due to the way a UART
typically over samples to get the centre location of each bit (But at
midi rates this should only be measured in tens of microseconds).
It shouldn't be, and you don't even need an UART. Just handle it
as an analog signal, i.e. one more audio channel.
Even 44.1 kHz is enough to preserve all information. The ratio
of bit frequency vs. sample frequency is a bit odd, but that is
in practice not a real problem. On input just use some DSP to
recover the bits (peanuts on a modern CPU). On output all you
need to ensure is that the zero-crossings of the generated analog
waveform (after the antialias filter) are correct, then let the
HW turn it into the required square wave.
Result: sample-accurate MIDI.
Ciao,
--
Je veux que la mort me trouve plantant mes choux, mais
nonchalant d’elle, et encore plus de mon jardin imparfait.
(Michel de Montaigne)