Clocks and latency
One clock for every board
The audio boards share one clock over PTP (PTPv2 over UDP/IPv4, domain 0, end-to-end delay), timestamped in hardware by the board's Ethernet controller. Each audio packet carries that shared time, counted in samples. This is what lets any decoder play any encoder's stream in step, and switch between streams without a gap.
Any board can be the clock master (grandmaster). The best clock wins:
- the lowest PTP priority (a setting, 128 by default, the same as most devices), then
- on a tie, the lowest MAC address.
To choose the master, give that board a lower PTP priority. On a network with Dante equipment that should lead, leave the boards at 128 and make that device Preferred Leader in Dante Controller, or raise the boards above 128.
The master announces itself every 2 seconds. If it goes quiet, the others pick a new one after 6 seconds. A change of master usually steps the time, and decoders resynchronize, with a short gap in the audio.
A board that follows keeps its clock in step by running it slightly fast or slow, by at most 500 ppm. A master further off than that (no working clock is) is followed by stepping the time instead. When a board takes over as master, its clock goes back to its own rate.
Time from NTP
The master's PTP time is real time (TAI, UTC plus 37 seconds) when the board
can reach an NTP server: the one DHCP names, else pool.ntp.org. It sets its
clock from NTP once, when it starts leading, and from then on only runs it a
little faster or slower to stay with NTP, so the boards following it never
see a jump. While it stays within 10 ms of NTP, it announces its time as
traceable to UTC. After a restart that can take a few minutes. /api/status
shows how far it is, as ptp.ntp_offset_us.
That is what lets a computer on the network, such as a web player sending an AES67 stream, set its own clock from PTP. A master without NTP keeps its own time, counted from when it started, and announces it as not traceable.
Clock (PTP) on a board's page shows its State (grandmaster or following), the Master's ID, Time (from NTP, or the master's own clock), the Offset from the master at the last sync, Drift (how much faster or slower than its own rate the board runs its clock to stay in step), Path delay and Priority. The board counts as locked while the offset is within 100 µs.
Two clocks per board
Each USB adapter also runs on its own clock, which never quite matches the network's. A buffer sits between USB and the network on each board, and the board drops or repeats a single sample frame now and then to keep that buffer at its target fill. Drift fixes in the USB line in or USB line out panel counts these. It doesn't resample.
Timing
- Encoder: each packet goes out when its millisecond of PTP time has passed.
- Decoder: each sample plays when PTP time reaches its timestamp plus the Link offset: 4 ms by default for EtherJax encoders, 20 ms for other senders (Link offset, other senders), whose software clocks send packets less punctually. The Stream panel shows the one in use.
The link offset covers only the network. Adding the encoder's buffer (about 3 ms), the decoder's (about 4 ms) and the USB adapters' own buffering, line in to line out should come to roughly 12 to 15 ms. That figure comes from the buffer sizes, not a measurement.