packages/meet-core/src/features/call/same-room-audio/. The local call adapter
applies designated playback to the stage’s remote microphone elements. The
microphone strategies run in deterministic fixtures. See
Meet calls
for the app’s standard nearby-audio behavior.
Local group and playback
Every room laptop enablesmeet:same-room-trial locally, enters the same
6–10-character code, and selects the same participant IDs from the existing call
roster. Select yourself and compare the roster checksum aloud. The checksum
covers only the sorted selected IDs. The code and matching procedure are local
operator inputs. Use distinct roster identities for the room laptops.
Each laptop elects the lowest sorted ID among selected participants still in the
roster. Selected peers’ microphone playback is suppressed on each room laptop.
The designated laptop plays non-group microphones. A selected ID stays in the
operator’s list when it leaves the call, so presence loss elects the next ID
without changing the checksum. Rejoining with the same ID can restore the
original designation. An output unplug while that laptop remains in the roster
cannot trigger a group election. Have the affected laptop leave or have every
operator update the selection and compare checksums again.
The adapter sets only local remote microphone playback mute. Screen-share
audio, outgoing mic and explicit mute controls, and recording and transcript
consent retain their usual behavior. Stop the trial or close the call to drop its
playback policy. The event trace records roster membership, designation,
failover and trial mute changes. It contains timestamps and participant and
track IDs, and downloads from the local browser. Keep traces with the trial
recordings and share them only with the consented trial group.
Automatic membership, synchronized output availability and coordinated manual
speaker choice would require a future server relay. This trial uses the
unmodified Meet presence feed and Cloudflare Realtime SFU.
Offline microphone strategies
An explicit mic mute gates that device immediately in A, B and C. Other enabled devices can still pick up the speaker acoustically. Screen tracks never enter the mic gate.
Offline fixture gate
Run from the repository root on the gate host with workspace dependencies available.same-room-audio.json and same-room-audio.md, including on a failed assertion after measurement. Without SAME_ROOM_RESULTS_DIR, Vitest prints the directory it creates under the system temporary directory. The deterministic suite compares 24 rows across seven scenarios, including both speaker modes for the remote-echo scenario. Positive results require running the suite.
- Duplicate energy is the sum of excess per-talker stem energy entering the mix. The strongest retained copy of each talker in each frame is the primary. The ratio uses summed primary energy as its denominator. This excludes phase cancellation between stems.
- Retention is strongest retained stem energy divided by strongest connected capture energy, summed across frames per talker. The reference includes a connected but explicitly muted mic so S3 shows the acoustic trade-off. Stems are available only in the fixture. Capture hard clipping scales the stems with the same per-sample gain.
- Gate switches count mic open/closed transitions after the initial frame. Added latency is the nominal frame buffer and lookahead, excluding computation and media transport. Capture clips count full-scale-or-higher mic samples before saturation. Mix clips count full-scale-or-higher samples in the unnormalized output sum. The screen track stays separate.
- Remote-echo energy is the sum of squares of the remote playback stem returning in the mic mix. S6 uses fixed speaker-to-mic coupling. S4 counts active 20 ms frames after the unplug event until at least 10% of the reference speech energy returns. Zero means recovery in the event frame. A missing recovery reports separately.
Aligning microphone samples for a future gate
The offline helper estimates the target delay per window with GCC-PHAT (generalized cross-correlation with phase transform) and fits a straight line through delays over time. A positive slope means target lag grows. The helper returns the peak ratio and fit residual so a caller can reject weak matches and detect timing jumps. It has no live PCM tap or gating integration.
For receiver-side alignment, start each run with a short chirp or clap and derive
a coarse lag for each mic. On overlapping voiced windows, search a residual
window of ±15 ms around the predicted lag and use periodic GCC-PHAT to check
the prediction. Reject silence, peaks on the search boundary and ambiguous
matches. Fit drift in ppm against a common sample timeline, then correct the
lag with fractional resampling. A jump in jitter-buffer delay or an SSRC change
starts a fresh fit. Log the estimate, confidence and reason for every reset.
Run these experiments before trialing a live gate:
- Feed identical timestamped chirps and independent speech through two, then three physical laptops. Record both the PCM taps and per-track RTP observations. Compare against a shared-clock multichannel reference for ten minutes with injected −100, 0 and +100 ppm source drift. Require a 95th-percentile alignment error at most 2 ms and fitted drift within 5 ppm on voiced segments. Reject timestamp-only alignment if the browser cannot associate RTP or capture timestamps with the PCM samples at that precision.
- Repeat with 1%, 3% and 5% loss, a 100 ms jitter step at minute five, an SFU reconnect, and native AEC, gain control and noise suppression toggled one at a time. Require reacquisition within 3 s of restored overlapping speech and no suppression while estimates are uncertain. Log per-device p95 update time and added playout latency. Reject a candidate that overruns its 20 ms audio frame budget or adds more than 60 ms to median end-to-end latency.
- Compare the gate to the all-open fixture and physical baseline with ten common-voice phrases and five independent overlaps per setup. Require at least 80% less duplicate energy without losing more than 10% of each independent talker’s retained energy when isolated references are available. In blinded listening, require at least four intelligible phrases per talker out of five overlaps. Reject a gate that drops independent speech to remove duplicates.
- For publisher-side control, inject 20, 50 and 100 ms one-way control delay, then disconnect the decision leader during overlap. Measure applied-decision skew, added lead time, expired decisions and mute state. Require p95 applied skew at most 20 ms, normal playback and publishing within 300 ms of decision loss, and zero bypasses of explicit mute. Reject the design if it cannot meet these budgets over the existing realtime path.
Physical playback trial
Physical acceptance requires actual laptop recordings and a trace from the backup laptop. Run once with two room laptops and once with three. Repeat each configuration with room speakers and with room headphones. Keep the remote listener in a separate quiet space on headphones during the call. Record the source revision, browser versions, device positions, fixed output volume, audio processing settings and consent. Use a disposable call on the local prototype with the existing SFU. Rehearse the procedure before saving evidence.-
On each room laptop, open the local Meet origin. Run this in its browser
console, reload, join the same call, and open Settings → Connection →
Same-room audio trial. The remote listener joins with ordinary playback.
- Start a continuous 48 kHz mono recording for each laptop and the remote listener. Any recorder that exports WAV PCM16 or WAV float32 works. Use an external mic or a second device to record the room near each laptop. For the remote listener, use a mic or recorder near the headphone output so the same recorded input can hear both sync claps and playback. Avoid normalization, silence trimming, input changes and recorder pauses.
-
With recorder mics within about 30 cm of one another, make two separate
sync claps, about one second apart. On the backup laptop, press Mark sync
clap as each clap happens. Move the remote listener and recorder to the
separate quiet space while recording continues. After both phases, reunite
all recorders for the third sync clap and mark it on the backup laptop.
A clap sent through Meet includes network latency. Use a shared physical
clap or a separately calibrated common reference for the clock anchors.
Estimate acoustic distance and recorder error for
clockErrorMs, and measure the button-to-clap error fortraceErrorMs. A hardware trigger or a shared-clock recording with a visible trigger can establish those error bounds. Unbounded timing supports a listening trial only. - For the all-speaker baseline, leave the trial stopped. Make ten isolated claps near laptop A, spaced at least one second apart. Read three loud phrases at normal gain, 30 cm from its mic. Then have the remote listener play a fixed probe phrase or tone at fixed gain while the room stays silent. Capture only the returned headphone signal on the remote recording during the echo window. Keep the direct source out of that recording. If built-in overlap protection, manual local mutes or blocked autoplay make the comparison invalid, record that and rerun once the controls match. Log any sustained howl or clipping heard during the run.
-
For the designated phase, enter the same code, such as
ROOM42, on each room laptop. Tick the same participants, including yourself. Compare checksums aloud and start the trial. Check that the remote listener remains unticked and every room laptop shows the same speaker. Repeat the same claps, loud phrases and echo probe with identical levels. Verify that only the designated laptop plays the remote mic and both room and remote users can hear the screen-share audio. Repeat with a mismatched roster and then correct it by matching the checksums. Check explicit mic mute and the existing recording and transcript consent controls. -
For failover, use a continuous remote probe that stays above the room
detection floor on the designated laptop. It must run before the selected
speaker leaves through recovery on the backup, with no speech in the room.
Disconnect or leave the call from the designated laptop and keep recording
every output. Keep the backup laptop in the call through the third sync
clap. On the backup, select Download trace JSON and save it as
trace.json. The trace time measures when that laptop processed roster loss. The recorded audio gap can start earlier. -
Save
a.wav,b.wav,remote.wavandtrace.jsonalongsidemanifest.json. Add another entry underroomfor a third laptop.room[0]supplies the clap source. Eachsyncarray uses approximate windows in that file’s own time, before alignment. Every phase window is relative to the first sync clap on the shared timeline. Put one direct room clap and its expected remote return in eachclapswindow. Give each loud phrase its ownloudwindow. Use a single continuous probe for thefailoverwindow. The script uses 1 ms RMS frames for onsets and 10 ms frames for failover. Choose onset and tone floors above idle noise. Use matching floors across phases. Replace all example times and errors below with observed values. -
Run the analyzer from the repository root with Node. Paths inside the
manifest are relative to the manifest file.
Exit status 0 means every measured row passed. Status 1 means a measured row failed. Status 2 means the input or measurement was inconclusive. Complete the listening and interaction checks separately. A low echo meter reading alone cannot establish that the room heard the remote probe.
-
Stop the trial or remove the local opt-in on each room laptop.