Sync is sometimes drifting a few milli seconds
Typically, the sync is within 200-500µs, drifting a little bit around. Even if it is off by a few ms after boot-up it will recover fast. But, sometimes there is an 2-4ms offset or it is starting good and then drifting away. If I remember correctly that was not happening 2 years ago, but I could be wrong. (I measured sync with two esp32+pcm5102a)
The guys from esphome are using a Kalmann filter for their new resonate player implementations and claim that the sync is much better than with a median filter: https://github.com/Resonate-Protocol/time-filter/tree/main Benefits are that the uncertainty is taken into account and it will compensate for a constant drift. Maybe that is worth a try, it should be fairly easy to implement. Just needs a C wrapper and some modifications to the get_server_now and insert_latency functions.
// Update filter with computed offset and uncertainty from NTP exchange // measurement: ((T2-T1)+(T3-T4))/2 in microseconds // max_error: ((T4-T1)-(T3-T2))/2 in microseconds // time_added: Client timestamp when measurement was taken in microseconds void update(int64_t measurement, int64_t max_error, int64_t time_added);
measurement: ((T2-T1)+(T3-T4))/2 in microseconds = -tmpDiffToServer = -(trx - tdif) / 2
max_error: ((T4-T1)-(T3-T2))/2 in microseconds = (tdif + trx) / 2