Skip to content

Auto-identify the user's speaker via mic-track activity #13

Description

@tenequm

Feature

After transcription, automatically label the user's diarized speaker as "Me" by matching Soniox speaker segments against mic-track activity.

Soniox diarization returns anonymous numeric labels only - but Blackbox records the mic as its own track, so it already knows which voice is the user. Today that information is thrown away when tracks are mixed before upload.

Approach

Post-processing step after the transcript arrives (fire-and-forget, like AEC):

  1. Mic activity timeline - read the mic track (prefer the AEC-processed audio-processed.m4a, since DTLN already stripped system-audio echo/bleed) and compute per-100ms RMS against a silence threshold. PCM-reading and level-metering patterns exist in AECProcessor / RecordingPipeline.
  2. Overlap scoring - for each diarized speaker label, compute the fraction of its speech time coinciding with mic activity. Pure interval arithmetic.
  3. Decide - winner becomes "Me" in metadata.speakers only if confident (e.g. >70% overlap and clearly ahead of runner-up). Otherwise do nothing - transcript stays as-is.

Prerequisite

TranscriptSegment keeps only start times; the scorer needs end times too. Tokens already carry start_ms + duration - retain what groupTokensIntoDocument currently drops.

Notes

  • Timestamps align for free: the mixed upload file is built on the same timeline as the original tracks, and mic latency offset is applied at record time.
  • Only applies to Blackbox's own dual-track recordings; uploaded files (no mic track) skip it silently.
  • Edge cases handled by the confidence gate: user never speaks, heavy crosstalk, speakerphone room bleed without AEC, diarization splitting one voice into two labels.
  • Fully unit-testable with synthetic two-track fixtures - no hardware needed.

Estimated scope: ~200-250 lines including tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions