Skip to content

Add browser-side audio response timing diagnostics #712

Open

Description

@ChenYingHan1121

Problem

CodeTrial already exposes the interviewer's state through the lk.agent.state participant attribute and uses a Web Audio analyser for avatar lip synchronization.

However, there is currently no explicit browser-side diagnostic for comparing when the browser observes the interviewer entering the speaking state with when remote audio activity becomes detectable.

This makes it difficult to investigate whether the interviewer's published speaking state aligns with the audio activity observed by the browser.

Proposed approach

I propose adding a lightweight, developer-oriented timing diagnostic that:

  1. Records a timestamp using performance.now() when the browser observes a transition to the interviewer's speaking state.
  2. Detects the first meaningful remote audio activity following that transition.
  3. Calculates the elapsed time between the two browser-observed events.
  4. Handles track replacement, reconnection, and missing audio without reporting misleading measurements.
  5. Includes automated tests for timestamp calculation, state transitions, and audio activity detection.

The measurement would be reported as a browser-observed timing difference, not as end-to-end conversational latency or the exact time when the candidate hears the audio.

Related work

Issue #105 includes latency measurements comparing Gemini Live with a local model setup. This proposal focuses on browser-side event timing within CodeTrial rather than repeating those model-level benchmarks.

Relevant existing code:

  • web/interview.js — interviewer state and remote audio track handling.
  • web/avatar/stage.js — remote audio analyser used for avatar lip synchronization.
  • web/audio-playback.js — browser audio playback state management.

Questions before implementation

  1. Would this browser-side timing diagnostic be useful for investigating audio response delays in CodeTrial?
  2. Would reusing the existing avatar analyser be appropriate, or should the diagnostic remain independent of avatar visibility?
  3. Would a small, testable implementation of this diagnostic be an acceptable contribution?

I would like to confirm the intended scope and acceptance criteria before starting implementation.

Activity

  1. jserv commented on Nov 15, 2026

    @jserv
    Contributor

    Would this browser-side timing diagnostic be useful for investigating audio response delays in CodeTrial?

    Measure, in the browser, the time from the interviewer's lk.agent.state changing to speaking (read where state.agentSpeaking is set in web/interview.js) to the first remote audio frame above a threshold. Call it a browser-observed gap, as the issue already does.

    Would reusing the existing avatar analyser be appropriate, or should the diagnostic remain independent of avatar visibility?

    Keep it independent of the avatar. attachAvatarAnalyser in web/avatar/stage.js builds no analyser while the avatar is hidden or retired, so a measurement built on it would vanish with that setting.

    Would a small, testable implementation of this diagnostic be an acceptable contribution?

    Keep it developer-facing and off by default: nothing on the candidate's page. web/ has no debug channel today, so say in the pull request where the number is reported and how to turn it on.

    There is no need to ask before a proof of concept: you are assigned, so go ahead with this scope.

  2. added a commit that references this issue on Nov 16, 2026
    daa74a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions