Define minimum sync standards for the player@v1 role#104
Open
maximmaxim345 wants to merge 4 commits into
Open
Conversation
Make the correction-quality rule outcome-based (Inaudible corrections) and exempt a rare one-shot resync from both the speed cap and the accuracy floor. The speed cap is now a sliding average over 150 ms.
Interpolation only very slightly decreased distortion, lets drop it to keep the Spec simpler. Other (better) strategies like ASRC are encouraged.
maximmaxim345
added a commit
to Sendspin/sendspin-js
that referenced
this pull request
Jun 18, 2026
With the proposed minimum sync standards in Sendspin/spec#104 the default `sync` mode in `sendspin-js` was no longer spec compliant. This PR tweaks them to follow the spec. There were two problems before this PR: - Drift was corrected with up to ±2% playback-rate changes and was therefore audible - And startup errors could sit at 100-150 ms for tens of seconds because a resync re-anchored its backlog forward instead of dropping it.
Member
Author
|
The limits/constants even work for tricky platforms like This works because we define accuracy from the Kalman filter to the output, not end-to-end. And since we also define how the filter has to be implemented and used, this essentially factors out the things we can't control, like network delay and stability. So even listening through a VPN across the world, it might not be perfectly in sync, but the implementation is still spec compliant, since it's doing as well as it can. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The specification didn't exactly define a minimum bar for synced playback. That meant that terribly out-of-sync players were still valid, while their end-user experience was unusable when grouped with other Sendspin players.
The new rules:
client/timecadence floorTo give a head start for new implementations, this PR also adds a simple suggested strategy: discrete, bit-exact sample deletion and insertion. The player drops or duplicates whole frames to correct drift, leaving the audio untouched except at the moments it corrects. N scales with sample rate. Other algorithms like ASRC are still encouraged.
Constants
I'm still not sure what exact values we should pick. The values I picked in this draft are:
sendspin-js.aiosendspin's current 105 ms max (FLAC at 44.1 kHz). The 15 ms floor keeps enough samples per chunk to correct within the ±0.5% cap.Related issues