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
| Property | Type | Description |
|---|---|---|
id | string | Speaker id, stable within this recording or live session |
label | string | Display label in this transcription |
talkMs | number | Attributed speaking time |
talkSeconds | number | talkMs / 1000 |
talkShare | number | Share of all attributed speaking time, 0 to 1 |
turnCount | number | Attributed transcript turns |
state | VoiceProfile | Baseline measured across this speaker's frames |
isUnknown | boolean | true 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[];
}