MIDI Timing and PC soundcards

Karl Helmer Torvmark karlto at invalid.ed.ntnu.no
Tue Oct 13 13:46:53 CEST 1998


On Mon, 12 Oct 1998, Thomas Hudson wrote:

> I don't believe it is a hardware issue. It has more to do with modern
> OS's. With something like DOS, you have complete control of the machine
> and no competing processes, so timing is quite good. But modern multitasking
> OS's like Linux or NT weren't really designed with firm real time in mind.
> 
> Delivering what a driver has read to your user-space process in a
> reasonable amount of time is not the only concern, being consistent is
> a problem too. For example, if it takes the OS 10ms to deliver one event
> then 1ms to deliver the next, etc. this causes jitter. Humans are quite
> good at compensating for a consistent delay (think of time delays
> associated with distance in a marching band or orchestra), but when
> the delay time keeps changing it is maddening...
> 
> I have heard that win3.1/95/98 is not that bad (simply because it's not
> a real OS). With Windows NT you really need to use DirectX (the standard
> MIDI stuff is 16 bit and uses thunking).
> 
> For Linux, the ALSA stuff has the best interface and does most timing
> related stuff in the kernel. Of course it helps to not have a lot of
> other users on the system. Of course, other users are not a problem
> on WinNT/Win95/98 ;-).

This is quite correct. I did a test while developing a program to simulate
som hardware on a PC (Running Windows NT 3.5 and 3.11).

I made a routine that would toggle a bit on a parallel I/O card. This
routine was called when data arrived on the serial port.

The result : The PC I tested on ('486, but I don't think a Pentium would
make very much difference) would not respond faster than 50ms to incoming
serial data. Also the time used was very erratic, varying from 50ms to
150ms. This is a LONG time! The variations did not seem to be very
dependant on processor load.

The culpit is Windows, which puts the information in a message queue,
instead of calling my message handler directly.

I recon the DirectX/DirectMusic will help this situation, precisely by
calling message handlers directly. 

------------
Karl H.




More information about the Synth-diy mailing list