Configuring Audio Refclocks
Here's some hints with regards to audio refclock debugging.
These drivers include the wwv, irig, and chu reference clocks.
Make sure your audio device is setup ok for your version
of os/soundcard. Example, can you play an MP3? If so,
that's a good start.
Once you can play sound, try to get input working. I tend
to use the "line" input of my sound cards. I built a couple
of cables for the input. One simply uses a mono input plug
(the audio code handles this, its the left channel). Another
cable uses a stereo plug (clipped off a pair of defunct
earphones), with both channels wired up to the irig output
(or the wwv receiver output).
Plug your stuff together and use your mixer/aumix software to
enable the sound "record" function, and see if you can
hear anything. You must be able to get record/input working
before trying ntpd refclocks.
Once you have your audio hardware tested and cabled up, you
can try playing with the ntpd audio refclocks.
The refclock config itself is a bit tricky. I've had to
fuss around with the ntp.audio config here to get things going.
Here's what I use for irig and wwv:
# irig b (audio)
# flag2 1 is line port, flag4 1 is verbose stats
#server 127.127.6.0 version 4
#fudge 127.127.6.0 flag2 1 flag4 1
# wwv radio clock. time1 wwv, time2 wwvh, flag2 0=mike, 1=line.
#server 127.127.36.0 version 4
#fudge 127.127.36.0 time1 0.0019 time2 0.00773634 flag2 1 flag4 1
Here's my ntp.audio file:
idev /dev/audio0
cdev /dev/mixer0
agc line
monitor vol
Here's a comment I made to myself with regards to a soundblaster
live (pci) in a p133/freebsd host:
jane4 (P133) with sb live wants rec 20
and agc rec (which seems to adjust line anyways)
but it brings up IRIG
With linux, I configure for ALSA audio fragment size with echo:
echo "ntpd 2 128" > /proc/asound/card0/pcm0c/oss
To actually debug the ntpd audio setup, build an ntp.conf with only
the irig/wwv/chu driver, then "ntpd -D2" to get a view of the
audio gain adjustments. I see things like this:
audio_gain: gain 139/54
audio_gain: gain 143/56
..etc
Note that some os/soundcard combinations simply Do Not Work
with input, although their output might work.
The devices I've had working here include a motherboard
based C-Media PCI CMI8738, a PCI slot based soundblaster
live, an ISA soundblaster awe64 gold, and a PCI slot
based sb128 (ENS1371). OS include fbsd 5.3, fbsd 4.7/4.11,
linux 2.4.20-NANO, linux 2.6.3 ppskit lite.
Note that a PC in console mode (not running X windows or equivalent),
can put a huge latency spike into the ntpd offsets when the console
scrolls text down the screen. I suggest that the console not be used
when running ntpd, and that you ssh into the computer to perform
any configuration. Or you could run a window environment such as X
(I'm a twm user myself), as the scrolling inside an xterm is a much less
intrusive (to ntpd) operation than scrolling the bare console.
It is best to not use a so-called "desktop" installation of the typical GNU/Linux
distribution. These tend to pile on a number of programs that can interfere with
ntpd's use of the audio drivers in the OS. If you can be sure that you have
your "desktop" well behaved (I.E., not ursurping the audio), then try using ntpd
and the audio drivers with your preferred distribution. I have tended to install
a bare setup such as CRUX, with no "desktop" installed at all. Another example
is a workstation running a redhat7.x (cough) release, but with none of its
windowing stuff installed. Instead, I downloaded a more recent xorg X window
system setup and compiled it for my particular environment. Both of these
installations have run the ntpd audio wwv and irig drivers well.
--
StevenBjork - 27 May 2008