In a distributed system like GroovyMorning, where audio captured by a Java recorder is analyzed by a Python segmenter, synchronization is a constant challenge. The Master Sync mechanism was designed to ensure exact correspondence between the Java stream and the Python segmenter.
Several factors introduce an offset (latency) between two servers listening to the same radio stream URL:
ffmpeg process starts.
Without recalibration, an offset of several seconds could affect the final recording during AI detection.A simplified acoustic fingerprinting technique is used to calculate the actual offset between the two instances. The technical process unfolds as follows:
The Java recorder waits for the first segments of the continuous recording to be written to disk. As soon as segment No. 5 is available (about 5 seconds after startup), a fingerprint is extracted:
/api/sync_offset)This binary is transmitted via a POST request to the Python segmenter, accompanied by the information positionInSeconds=5. This informs the Python segmenter about the audio state on the Java side at time T=5s.
A rolling buffer of the audio currently being processed is maintained by the Python segmenter. Upon receiving the fingerprint:
3.45 indicates, for example, that the Java stream is lagging 3.45 seconds behind the Python stream.

The delta received by the Java recorder is stored in the masterOffsetSeconds variable.
While system time (NTP) synchronizes clocks, it does not guarantee the synchronization of stream content. A radio stream can have a variable delay due to broadcasting servers (CDNs). Fingerprinting proves to be the only reliable method to ensure segmentation based on the sound content actually perceived on both sides.
This “Master Sync” mechanism allows GroovyMorning to achieve high precision in chronicle extraction.