[ntp:questions] Audio refclock+linux+soundcard = yuck

Tim Shoppa shoppa at trailing-edge.com
Sun Sep 28 11:55:05 UTC 2003

First, the good news: My Ten-Tec RX-320D arrived last week.  After completely
re-doing the ground system for my shack (maybe it was compliant with the NEC
when it was built but a 40-foot run from the AC entrance panel to the
cold water pipes cannot be a good RF ground!) by pounding some copper pipe
into the ground, I've found it to be a wonderful computer-controlled SW
receiver.  It has a DSP IF which may cause some latency issues, but as
long as the filter settings are kept constant I don't see how it could make
much difference.

The radio is so much better than the previous analog-tuned thing I had
been using.  With that the frequency drift was large enough that I was
forced to touch up the tuning a couple times an hour, to the point that
I didn't get particulary good refclock_wwv statistics (other than to
see that it worked, mostly).

More good news: I can get refclock_wwv to play nicely and decode timecodes.
It sees WWV *and* WWVH (Hawaii seems to be particularly strong on 10MHz
this morning from the East Coast).

Then the not-so-good news: Now that I've been investigating refclock_wwv
performance, I think all my cheapo PC-clone audio hardware sucks.  In
different ways.

I'm using the Linux 2.4.22 kernel with the NANO patch.  I've tried
various combinations:

1.  On-motherboard (K7S5A) i810-compatible sound.  With OSS sound this is
a complete non-starter: It only samples at 48kHz and the stream from
/dev/audio is complete garbage (at about 200 kbytes/sec...???).

2.  On-motherboard (K7S5A) i810-compatible sound.  With
ALSA I decode the second pulses but there seems to be so much jitter
in the audio sampling rate that refclock_wwv never locks on to minute
sync.  Indeed, if I record a couple minutes worth of WWV at 8kHz, and
graph the regions where the minute pulse should be, I see a couple
hundred ms variation up and down from minute to minute.  No, it's not
the motherboard's spread-spectrum FCC compliance, I turned that
off long ago for my PPS sources.

For some reason, a couple of weeks ago I thought combo #2 above
was working decently, not just with low latency (a few ms range)
but also with good stability.  But I probably didn't do that for
more than a few minutes.

3.  A PCI sound card I bought a couple years back for $15 or so.  With
both OSS and ALSA, it seems to start working pretty well.  In a couple
of minutes it is syncing to the minute pulse, and it starts decoding
digits in the timecode.  After another 10 or 15 minutes I'm getting all
the digits.  BUT... the offset is circa 600 milliseconds!  Now a
couple of those milliseconds come from WWV/H propogation and a few
more probably from the radio's DSP filtering.  And the jitter is in
the 100 millisecond range.

Some more investigation with the #3 setup above shows that if I loop
the sound from line in, through the linux drivers, and back out the
line out, there is an audible most-of-a-second delay.  Undoubtedly
NTP's measurement of 600 milliseconds is this same number.  Doing the
same with setup #2 the delay is at most a millisecond or so.  (That
took a scope to measure).

My mind boggles at where the sound is for those 600 milliseconds.  OK,
I could see a millisecond or two in the codec and a few in
software latencies.  But 600 milliseconds is several thousand samples!
The ALSA drivers have a metric buttload of utilities and tools, maybe
the 600ms number is somehow tunable since I'm convinced it must be in

So what I'm looking for is some wisdom: can good audio low-latency
performance be had with Linux?  I'm tempted to go out and
buy a better sound card, but I'm not sure exactly where to start.
The i810-compatible thing on the motherboard seems pretty nice except
for its extreme jitter... is it likely that a PCI-card version of the
same thing would have its own dedicated clock?

I've got a couple other combinations to try this weekend... other
motherboards with on-board sound, maybe an old ISA card, etc.


More information about the questions mailing list