[ntp:questions] Using NTP to calibrate sound app

David Woolley david at ex.djwhome.demon.invalid
Sat Jan 26 10:09:41 UTC 2013

no-one at no-place.org wrote:

> small packets.  A calibration run would consist of an initial NTP
> syncronization with an audio packet, followed by a period of some

What you are describing here isn't, I think, the use of NTP, but the use 
of SNTP.  You seem to be making a measurement, form the server, over a 
short amount of time.  True NTP measures frequency and time and does so 
over time periods long compared with the network and scheduling jitter.

> number of minutes during which I will just count audio packets,
> followed by a final NTP synchronization with the last audio packet.
> By knowing the time difference over some number of audio packets I
> hope to calculate the actual audio clock frequency for that device.

The way to do it with NTP is to discipline the main clock frequency, 
over many hours, and then measure the time relative ot the system clock. 
  You may well find that you don't have to measure the sound generator 
frequency because it may use the same crystal as the main clock.

Doing this simply, requires that you have some form of kernel discipline 
for the clock that is able to interpolate between ticks, allowing for 
the frequency correction.

If you try and do SNTP measurements at the start and end of a sort 
period of tone, you will be very susceptible to network delay variations.

Incidentally, given that all phone networks are digital these days, even 
your old method is susceptible to clock errors in the network, although 
I think most networks use atomic time.

More information about the questions mailing list