Reference

Speaker

One voice in a result, its measured baseline, and its enrolled identity

Speaker represents one voice. Every turn references a Speaker object, and the same object appears in Transcription.speakers.

class Speaker {
  readonly id: string;
  readonly label: string;
  readonly talkMs: number;
  readonly talkShare: number;
  readonly turnCount: number;
  readonly state: VoiceProfile;

  get talkSeconds(): number;
  get isUnknown(): boolean;

  toString(): string;
  toJSON(): {
    id: string;
    label: string;
    talkMs: number;
    talkShare: number;
    turnCount: number;
    state: VoiceProfile;
  };
}

Properties

PropertyTypeDescription
idstringSpeaker id, stable within this recording or live session
labelstringDisplay label in this transcription
talkMsnumberAttributed speaking time
talkSecondsnumbertalkMs / 1000
talkSharenumberShare of all attributed speaking time, 0 to 1
turnCountnumberAttributed transcript turns
stateVoiceProfileBaseline measured across this speaker's frames
isUnknownbooleantrue for unattributed audio

talkShare sums to 1 across Transcription.speakers. It is 0 for every speaker when the recording attributed no speaking time.

for (const speaker of result.speakers) {
  console.log(speaker.label, `${(speaker.talkShare * 100).toFixed(1)}%`);
}

id identifies the voice within one recording or live session. A person your organization enrolls, with their consent, carries a durable person_id and resolves to that same person_id across recordings and live sessions. The raw result of prosody.analyze() carries it under per_speaker[].identity, and a live session carries it under session.speakerProfiles[].identity. prosody.speakers.list() returns the people stored for your organization. Identity indexes are isolated by organization, and enrollment is governed by the Voice Authentication Policy.

label is assigned by first appearance: Speaker 1, Speaker 2, and so on.

Access

const [speaker] = result.speakers;

speaker.id;
speaker.label;
result.getSpeaker(speaker.id);
result.turnsBySpeaker(speaker);
result.conversation.getFrames(speaker.id);
result.conversation.getChanges(speaker.id);

turn.speaker holds the same object:

turn.speaker === result.getSpeaker(turn.speaker.id);

VoiceProfile

VoiceProfile is the speaker's measured baseline for the conversation: the reference everything speaker-relative is measured against.

interface VoiceProfile {
  intonation: {
    pitch: VoiceStat | null;
    range: VoiceStat | null;
    slope: VoiceStat | null;
  };
  stress: {
    loudness: VoiceStat | null;
    peak: VoiceStat | null;
  };
  rhythm: {
    voiced: VoiceStat | null;
    pause: VoiceStat | null;
    onset: VoiceStat | null;
  };
  tilt: VoiceStat | null;
  frameCount: number;
}
interface VoiceStat {
  median: number;
  min: number;
  max: number;
  count: number;
}

count is the number of frames that supplied the measurement. A nullable stat is null when every frame lacked that measurement.

speaker.state.intonation.pitch?.median;
speaker.state.stress.loudness?.min;
speaker.state.rhythm.pause?.max;

Transcription lookup

interface Transcription {
  speakers: Speaker[];
  frames: VoiceFrame[];
  moments: Moment[];
  vad: AffectVad | null;
  getSpeaker(id: string): Speaker | undefined;
  turnsBySpeaker(speaker: Speaker | string): TranscribeTurn[];
}

On this page