zebra-spaces: dial the worklet stretch cap from ±8% to ±6%

Gentler pitch shift during buffer adaptation at the cost of slightly
longer ramp time:

- Shrink 4s→2s: ~25s → ~31s
- Grow 0.5s→4s: ~47s → ~61s

Pitch shift drops from ≤1 semitone to ≤0.7 semitone — less perceptible
on music. Fox 2026-06-05 dial.
This commit is contained in:
Russell Ballestrini 2026-06-05 09:17:53 -04:00
parent f07052780b
commit c5ac9e1a3b
No known key found for this signature in database

View file

@ -1775,7 +1775,7 @@ const JITTER_BUFFER_WORKLET_CODE = `
* - buffered > target → stretchFactor < 1.0 (fast playback buffer shrinks)
* - buffered ≈ target → stretchFactor = 1.0 (normal)
*
* Rate change is capped at ±8% and ramped smoothly per-block so the
* Rate change is capped at ±6% and ramped smoothly per-block so the
* pitch shift during adaptation is ≤1 semitone, brief, and centred.
* Listeners can disable stretching entirely via the 'lock_rate' command
* so music never gets resampled.
@ -1800,8 +1800,8 @@ class JitterBufferProcessor extends AudioWorkletProcessor {
this.stretchFactor = 1.0;
this.targetStretch = 1.0;
this.stretchRampPerBlock = 0.0002; /* ~0.075/sec ramp */
this.maxStretch = 1.08; /* cap rate at ±8% */
this.minStretch = 0.92;
this.maxStretch = 1.06; /* cap rate at ±6% */
this.minStretch = 0.94;
this.bufferedReportEvery = 256;
this.bufferedReportCounter = 0;
this.queue = [];
@ -1998,7 +1998,7 @@ function installJitterBuffer(uuid, node){
};
/* All roles now allow time-stretching — listeners benefit too
* (their 4s cushion shrinks toward 2s when feed is clean, grows
* back to 4s on instability). The ±8% rate cap means the brief
* back to 4s on instability). The ±6% rate cap means the brief
* pitch shift during adaptation is ≤1 semitone — barely audible
* on speech, briefly audible on sustained music tones. Fox
* 2026-06-05: "the 4 sec delay doesn't get faster with a better
@ -2160,7 +2160,7 @@ async function refreshLipSyncForUuid(uuid){
* is hitting the listener with loss/jitter, we GROW the worklet's
* target buffer depth from DD_BASE_TARGET (0.5s, conversational) up
* toward DD_MAX_TARGET (4s, full wiggle cushion). The worklet's
* built-in adaptive resampling (±8% rate cap) slowly stretches
* built-in adaptive resampling (±6% rate cap) slowly stretches
* playback to grow the actual buffer toward the new target without
* audible click or gap — pitch shifts by ≤1 semitone during the
* adaptation, returns to normal once the target is reached.
@ -2601,7 +2601,7 @@ const RECV_PLAYOUT_DELAY_SEC = 4.0;
* latency, then the Double Dragon adaptive controller grows it to
* DD_MAX_TARGET_SEC (4s) when the publisher's network or encoder
* shows instability and shrinks it back to DD_BASE_TARGET_SEC (0.5s)
* during sustained clean periods. The worklet's ±8% rate-limited
* during sustained clean periods. The worklet's ±6% rate-limited
* resampling makes the transition smooth: brief ≤1 semitone pitch
* shift during the ramp, silence-free, click-free. */
const SPEAKER_PLAYOUT_DELAY_SEC = 0.5;
@ -6798,8 +6798,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');
<footer style="margin:2.2rem auto 0;font-size:0.65rem;color:#999;line-height:1.7;word-break:break-all;font-family:monospace">
<span id="pi-seal" style="color:#777;cursor:default;user-select:none" title="">page integrity</span> &nbsp;·&nbsp; built <span class="stamp-date">2026-06-05</span><br>
md5 <span class="stamp-md5">b137f24f08a8bc2a9537e066b58adf6d</span><br>
sha256 <span class="stamp-sha">7aacac5e13460ab999f5c20fb39926e73948dcb6e100f16745af602721e08f91</span><br>
md5 <span class="stamp-md5">1724c13cc98aa637c7462217cd46466d</span><br>
sha256 <span class="stamp-sha">e6cb3dc549a0156290a35cd235fb2ec0ad6a9258a0d531eeb2e32c2589b186de</span><br>
<span style="color:#bbb">hashes are of this page with these two fields zeroed — to verify, blank them and re-hash</span><br>
<span style="color:#bbb">one self-contained file — <strong>save a copy</strong> and verify against these hashes; point at your own servers with ?signal= and ?turncred=, or <a href="host-your-own.html" style="color:#999">host your own community</a></span>
</footer>