Quickstart

Build on Conversation with diarized turns and vocal features

Install the package

npm install @prosodyai/sdk

Get an API key

Every call needs a psk_* key. Create one under Organization → API keys in the dashboard. The full key is shown once.

export PROSODY_API_KEY=psk_...

Create a client

import { ProsodyClient } from '@prosodyai/sdk';

const prosody = new ProsodyClient({
  apiKey: process.env.PROSODY_API_KEY!,
});

Transcribe a recording

const result = await prosody.transcribe('./call.wav');

console.log(result.text);

for (const turn of result.turns) {
  console.log(
    turn.speaker.label,      // "Speaker 1"
    turn.startMs,
    turn.text,
    turn.prosody?.state.intonation.pitch,   // 184.2
    turn.prosody?.state.stress.loudness,
  );
}

Diarization and vocal measurement are on by default. Pass { prosody: false } for transcript only.

Read the voice

Every turn carries prosody in physical units. change reports movement against the same speaker's own baseline.

const [turn] = result.turns;

turn.prosody?.state.intonation.pitch;    // 184.2
turn.prosody?.state.intonation.range;    // 4.1
turn.prosody?.state.stress.loudness;    // -21.6
turn.prosody?.state.rhythm.pause;       // 0.12
turn.prosody?.change?.stress.loudness;  // +3.4: louder than they had been
turn.prosody?.change?.intonation.pitch; // -1.8 semitones

Each speaker carries the baseline those changes are measured against:

for (const speaker of result.speakers) {
  console.log(speaker.label, speaker.talkSeconds, speaker.state.intonation.pitch?.median);
}

A field is null when the audio did not support the measurement: pitch on a turn with no voiced audio, for example.

Next

On this page