Time delays in MS Windows sound systems with Linrad-03.12
(April 5 2010)
Linux generally gives very small time delays. Microsoft Windows is different. There are many driver types but only ASIO drivers seem to be suitable when a SDR under Windows is to be used in realtime with a transmitter.

Processing parameters for Linrad.

The purpose of the investigations on this page is to evaluate the delay caused by various sound card drivers. For this reason Linrad is set to SSB bandwidth using a Gaussian shape of the filter. The parameters used are shown in figures 1 to 3.

Fig 1. The first parameter screen.

Fig 2. The second parameter screen.

Fig 3. The third parameter screen.
The processing delay caused by the first FFT is one buffer of size 128 samples which corresponds to 128/96000 seconds or 1.33 ms. Asking for a first FFT bandwidth of 2 kHz should give delays of 1 ms within the nearest factor of two. Selecting a Gaussian filter with about 2 kHz bandwidth will add 2.66 ms in the third FFT or the corresponding FIR filter. That means that the parameters used on this page are associated with an absolute minimum time of about 3 ms.

Fast timing with a Delta 44.

Figure 4 shows the processing screen under Windows XP 32 with a Delta 44 used for input as well as for output. The output is with ASIO and Portaudio with an ASIO buffer size of 64.

Fig 4. Delta 44 for input as well as for output on a dual Xeon E5410 system with 8 cpu cores running Windows XP 32 bit.
The baseband sampling rate is 48 kHz, bandwidth reduction is a single power of two. The size of the baseband filter/fft is 7 in powers of two which can be seen in the upper right corner of the baseband spectrum. That means that the third FFT size is 128 adding 2.66 ms of delay so we do have the expected 3 ms of delay in the Linrad processing buffers.

The Delta 44 buffers should add 42 ms for input and output together with buffers of size 2048 (see figure 6) so the 64 size buffers should add 1.3 ms. The timing info of Linrad shows a margin of 2 ms so the total delay should be expected to be 3+1.3+2 = 7.3 ms but the actual delay reported by Linrad is 9 ms and the delay observed on an oscilloscope is 10.9 ms as can be seen in figure 5. There is an extra delay of 3.6 ms. Presumably that is caused by an additional buffering corresponding to the dma rate set in Linrad, 750 Hz or 1.3 ms plus one extra ms for unknown reasons.

Fig 5. The time delay through Linrad. A 2 ms pulse, upper track, is sent into input channel 1 of the Delta 44. The loudspeaker output is obtained 10.9 ms later on output channel 1. The ASIO buffers are set to 64.
When selecting large DMA buffers in the Delta 44 ASIO driver as shown in figure 6 while still running Linrad at a DMA rate of 750 Hz, the time delay from antenna to loudspeaker becomes 59 ms as one can see in the oscilloscope image, figure 7. The buffering is outside Linrad so the timing given in the processing screen, figure 8, only accounts for about 50 % of the buffer delay.

Fig 6. The control window for Delta 44.

Fig 7. The time delay through Linrad. A 2 ms pulse, upper track, is sent into input channel 1 of the Delta 44. The loudspeaker output is obtained 59 ms later on output channel 1. The ASIO buffers are set to 2048.

Fig 8. Here the Delta 44 buffers are set to 2048. The actual delay is 59 ms.

Timing on a fast multi-core computer.

The D5400XS which was used above to demonstrate that fast timing is indeed possible under Microsoft Windows has a motherboard sound system by Sigmatel. The computer is also equipped with a Soundblaster Audigy LS. Linrad-03.12 has Portaudio on the output side. These are the alternatives:

Native MME.
MME through Portaudio
Direct Sound through Portaudio
WDM-KS through Portaudio
WASAPI through Portaudio
ASIO through Portaudio.

Portaudio is very slow with MME as well as with Windows Direct Sound. They require very large buffers (low DMA rate in Linrad) so they are not included in the tables below. The delay problems are on the output side where needless processing takes place within Windows. There is a sound system from IDT with equalizers and other things that I found no way to disable with Sigmatel and Audigy LS but Delta 44 does not go through it. Unfortunately Delta 44 works only under 32 bit Windows XP but it does work well under Linux with about 10 ms from antenna to loudspeaker.

The delay time from antenna to loudspeaker (converting from RF to audio at 90 kHz bandwidth causes negligible delay) is listed with the parameters (bandwidths) given above and with the Linrad parameter "Max DMA rate" set to 100 and 999. The input sampling rate was 96 kHz for Delta 44 and 190 kHz for SDR-14. The output was set to 96 kHz in all cases.

                         Max DMA rate=100      Max DMA rate=999 
                         SDR-14   Delta 44     SDR-14  Delta 44.

Delta 44, native MME       90        74           64       41
Delta 44, PA WDM-KS        72        42           69       14
Delta 44, PA ASIO          55        29           67       11
Audigy LS, native MME     102        90           78       55
Audigy LS, PA WDM-KS       95        55          fail     fail
Sigmatel, native MME       98        84           74       51
Table 1. Times in milliseconds from antenna to loudspeaker on a D5400XS, a computer with 8 Xeon E5410 cores running Windows XP 32.

The SDR-14 has a fixed block size of 8192 bytes. With 4 bytes per sample and 190 kHz sampling rate the buffer holds 10.8 ms of data. The delay in the various buffers on the input and output side does not necessarily add. Once the first buffer is full, data could travel rapidly through all the buffers including the processing buffers of Linrad. The D5400XS always has plenty of idle CPU cores to do processing immediately.

For Windows Vista only one driver works correctly. That is the native MME driver for Sigmatel. The delay is much longer than with Windows XP, about 120 ms. The other drivers silently loose data and may seem to work normally, but decoding digital modes will likely give poor results. Modern soundcards with ASIO drivers might work better with Vista, but staying with Windows XP is probably the best solution now. (Year 2010)

I failed to get any good solution for Windows 7. The SDR-14 can not run at 190 kHz, one has to set a lower speed. There also seem to be conflicts between the add-ons for the different sound output systems. Having several soundcards from different manufacturers installed under Windows 7 does not seem to be a good idea.

To SM 5 BSZ Main Page