1
votes

I am currently working on an algorithm in c# to implement MIDI MTC, slave sync using the old, but still good, Windows Multimedia API, winmm.dll. My software actually uses a hybrid between the midi stream mode (midistreamopen, etc.) and the more typical midioutopen, midiinopen, etc. mode. While the stream itself cannot be altered time wise to obtain sync, I can achieve sync with incoming MTC clock messages by changing the tempo in real time using the midistreamproperty call.

However, after examining the stream mode accuracy in more detail I am a bit baffled by its behavior. In particular, let's just forget about tempo changing and sync'ing and think about starting two PCs at about the same time using, for example, Midi Machine Control; both machines are simply running preloaded midistreams with say, regular and periodic slow beats. Of course there would be some offsets in the beats from the beginning but wouldn't you think that the offsets would remain relatively constant over time? I would think, time wise, midistream mode would be accurate over many hardware platforms. I would think it would not have a lot of drift between the two platforms. It should certainly be more accurate than the more typical timer based sequencers.

My investigations have shown that there is drift between two midi streams running on two different hardware platforms. It is not a lot of drift but it is different enough so over a few minutes you can hear the beats coming closer together and moving apart. Both streams are started with the same tempo and division (time division). I have tried various slower and higher tempos and divisions. The drift seems to be worse with more extreme parameters which I would expect but I would not expect much variation with more normative operating conditions. I can overcome this issue with small tempo changes in real time but I would prefer minimal intervention of this sort. I know this is sort of a odd question that may not get a lot of responses but I thought it would be worth a shot to try.

2
You have actually observed the drift. Are you asking whether you should believe your lying ears? - CL.
I guess that certainly is one way of thinking about it but my real question is concerned with what is normative to expect from kernel streaming? I would think drift would be an important consideration for streaming which is aimed at such a precise real time application as music reproduction. If a song is faster or slower depending on the hardware platform I would think that would be unacceptable. There are no specs for stream mode or any kind of PC streaming that I know of. I would expect some drift but I do not know what constitutes acceptable behavior for critical, time dependent streaming. - Mark

2 Answers

0
votes

MTC is not enough to keep systems in sync. MTC encapsulates SMPTE timecode which is based on seconds, not beats.

MMC is for controlling start, top, go back to the beginning, etc.

The part you're missing is the MIDI beat clock. It's effectively a pulse sent 24 times per quarter note (on most systems). With this message, you can keep multiple systems nearly perfectly in sync.

See also: http://www.omegastudios.com/blog/bid/306605/Part-2-MIDI-Beat-Clock-and-the-Three-Dimensions-of-Sync

0
votes

Well, after doing a data study the answer is practically, no drift. Here is a .pdf of the jitter and drift of two different midi streams running on two different PCs each running the same midi beat file. The drift is the black line charted out over 5 minutes. The jitter is small but due to Windows messaging and not due to kernel streaming.

http://mixermuse.com/blog/wp-content/uploads/2014/04/Jitter-and-Drift-Study.pdf

Scroll down in the pdf to see the chart.