[sdiy] midi and clock sync (fault analysis)

m.bareille at free.fr m.bareille at free.fr
Wed Dec 30 02:54:21 CET 2009


Hi Julian,


MIDI is the most perfect unaccurate and unreliable system in terms of latency
and syncs !  It is possible to do worse, but it is already not bad at all ...


The average latency of one little MIDI device is usualy comprised between 1 and
10msec ( sometimes much more...)  This latency can be +/- variable from an even
to another too  . It depend of many things like the processor speed , the
firmware/drivers code quality , the way midi events are managed by this piece of
code ...

It is not rare that into a MIDI device able to receive many kind of messages (
notes, controler,clocks etc ) that some messages be processed much faster than
the other ones and not always with a constant delay and this not always
logical too...


Most of MIDI devices  uses stacks and fill buffers to collect MIDI messages 'on
the fly' with 'real time' interrupts . Just after the new midi message is
arrived , the interrupt routine inform the main loop with a flag that there is
another message to process ... The Main loop will read the incoming message when
it will be it turn into the stack , who is not generaly  immediatly after this
messages has been received, specialy if there are many other message waiting to
be processed before or if the main loop is buzy with some other service tasks. A
good code will manage this dynamicaly , but it is not always the case...
Theoricaly realtime messages like MIDI clock  should be processed as fast as
possible when they are read , but not all firmwares do that ...


So when you combine different MIDI units  together , you add all thoses +/-
variable latencies . So the final delay is almost unpredictible from a MIDI
chain to another ... Basicaly , more device you add into the chain , more long
and variable could be this delay. More MIDI message you transmit on the line ,
most buzy your MIDI processors are , more messy and long could be your
latencies...


If you expect some very accurate sync timings you should consider triggers/gate
clocks or electronics where the average latency is measured in nanoseconds and
work at the TTL/Cmos chip ( or like ) speed... There are many nsec into a msec
;)

Recording sounds to measure MIDI latency to compare different MIDI chains
timings  is valuable method into one  given system but a slightly crazy method
to compare to different MIDI systems together because  each one will have it
owns perfs/timings and +/- variables delays depending what is plugged in ...


Marc B.








Selon Julian <julian at port23.co.uk>:

>
> >>i have an xoxbox built by xoxsource, and it has no sync problems btw, so
> something is not right with the machine you have there..
>
> You have a machine there that works in your setup.
> I have a machine here that works in my setup.
> The same machine does not work in another persons setup.
>
> ...therefore this machine must be faulty.
>
> Thank you for your input, although i cant say that i entirely follow your
> logic : )
>
> Julian
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy

Selon Julian <julian at port23.co.uk>:

>
> >>i have an xoxbox built by xoxsource, and it has no sync problems btw, so
> something is not right with the machine you have there..
>
> You have a machine there that works in your setup.
> I have a machine here that works in my setup.
> The same machine does not work in another persons setup.
>
> ...therefore this machine must be faulty.
>
> Thank you for your input, although i cant say that i entirely follow your
> logic : )
>
> Julian
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>





More information about the Synth-diy mailing list