openmixer — generated API reference
    Preparing search index...

    Function speakerAlignAim

    • WHERE TO READ THE REFERENCE NEXT — the aim, and the whole of how the reach stopped being the overlap's.

      A pair read at one instant shares only n - D samples when one side arrives D late, and speakerAlignOverlapReachMs is where that alone drives the coherence to the floor: 13.3 m, well inside the rooms this desk plays. The fix is not a longer window. It is to read the reference back samples into ITS OWN PAST (omx_ring_read_at) so the two windows carry the same signal again — the confidence then describes the ROOM instead of the analysis.

      The catch is that back must be known before the delay is, and a reading taken with the wrong back is exactly the reading that cannot be trusted to supply a better one. So the aim is a SEARCH and not a feedback loop:

      • While the reading is not trusted, walk a ladder of rungs 0, s, 2s, … across the window, where s is speakerAlignOverlapReachMs in samples. That step is the guarantee: every delay inside the window is within s/2 of some rung, and s/2 is half the distance at which one pair of windows still clears the floor — so if the delay is in the window, some rung reads it with confidence to spare. Nothing is inferred from an untrusted number, which is what a feedback loop does and why one converges by luck.
      • Once a rung IS trusted, aim exactly at the arrival it measured. That reading is worth following, the next one is taken with the windows all but perfectly overlapped, and the aim then agrees with itself and stops moving.

      THE LADDER IS BOUNDED BY THE WINDOW, and that is what keeps the refusals honest: an offset is only ever aimed inside [0, fftSize), so a loudspeaker beyond speakerAlignReachMs has no rung near it, never clears the floor, and stays refused. A search unbounded by the arithmetic's own reach would eventually find any delay the ring holds and publish it with a confidence the fit had not earned.

      A NEAR LOUDSPEAKER NEVER LEAVES RUNG ZERO. Inside the overlap reach the first reading is already trusted, the aim is already 0, and the offset read is not taken — which is why every short-flight number this feature ever published is untouched by the whole mechanism.

      moved says the frame run must start again: frames taken at two offsets are two measurements of two different things, and import('./smart-align.js').fitAlignment refuses to average them. That cost is why this is asked ONLY of a COMPLETE run, and why a trusted aim refines once and then holds: a policy re-deciding on every frame drops the run before it can ever finish, and reports too-few-frames for ever while looking busy.

      Parameters

      • held: SpeakerAlignAimState
      • reading: { arrivalSamples: number; trusted: boolean } | null
      • window: { fftSize: number; sampleRate: number }

      Returns SpeakerAlignAim