[ntp:questions] Audible signal generator ("BBC pips")?
nomail at example.com
Sun Nov 18 15:30:46 UTC 2012
Ralph Aichinger <ralph at pangea.at> wrote:
> As the Raspberry Pi I am currently using as a NTP box has
> an audio output available, I am wondering if this otherwise
> unused output (on a dedicated NTP box) could be used to
> generate BBC style pips or other audible time signals?
> As I am probably not the first one to have that idea:
> Is there software for Linux that does this? Playing
> a sound file is easy. Playing it in sync with ntpd
> is a lot harder.
It would actually be quite easy to output tones through
the soundcard driver. I wrote a program for Linux some
time ago to output an "on hold" signal for a PBX that had
only support for external "music on hold", which is quite
a hassle to use legally here.
You just put a sine burst as a series of sound samples in
an array and write that to /dev/dsp when you like. A
couple of ioctl()s set the sample rate etc.
I actually used a bit of ramp-up and ramp-down on the sine
amplitude to avoid the nasty clicks that can be heard on
that wikipedia page, which result from sudden switch to
To start at the right time you can use a usleep() call to
wait (after inquiring the time and calculating how long
to wait). Of course first you wait a second or so too
short and then get the time again and re-calculate, in
case the clock has drifted a bit.
More information about the questions