Preparing your audio
Each request is answered on its own, with no memory of earlier requests, so everything an answer depends on has to be in the audio you send with it. The same question can mean different things on different audio: “Does the caller sound frustrated?” asks something different of one sentence, one turn and a whole call.
Listen to a few of the files you plan to send, after you prepare them. If a person would find it hard to hear or judge what a question asks about, such as a quiet voice under loud noise, the model is likely to find it hard too. Listening also catches problems that preparing the audio can add, such as clipped words or abrupt joins.
Choose whose voice
First decide whether an answer can take everyone in the recording into account, or must judge one person on their own. Most questions take the first path, which needs no editing.
Ask about the whole conversation
Use this path for questions about the conversation itself, such as who interrupts, for questions about one person where the other voices can count, and for recordings of one speaker.
- Send the recording as it is, as one file. A stereo file is mixed into one channel. See Convert the file.
- Name the person each question is about, such as “the caller”, and describe each person in
context. - Add a transcript if you have one. It is optional. Put it in
contexton its own line, labeledTranscript:.
Ask about one person on their own
Use this path when an answer must not be affected by anyone else’s voice, such as how frustrated the caller sounds when the agent is loud. Every cut and join adds sounds that were not in the conversation, and the model hears them like any other audio, so listen to a few of the files you prepare.
- Find the person’s audio.
- In a stereo recording with one person on each channel, take that person’s channel, as in Convert the file. Check which channel is which on a few files before sending the rest, since the order varies between telephony providers.
- In a recording with everyone on one channel, find the person’s turns with speaker diarization, or with the timestamps of a transcript that labels each speaker.
- On one channel, cut out each of their turns.
- Cut in the silence before and after the speech, not at the first and last word, so no word is clipped.
- Fade in and out over a few milliseconds at each cut, so the cuts do not click.
- Leave out stretches where the other person talks at the same time. They still hold the other voice, and diarization is least reliable there.
- Choose how to send them.
- Send them as one file for one answer that describes the person across all their speech. The gaps where others spoke can stay as silence, or you can shorten them to make the file shorter, which costs less and fits more speech into 5 minutes. Keep a shortened gap about as long as a pause between the person’s own sentences: shorter gaps make them sound abrupt or rushed, which changes answers about pace, tone or hesitation.
- Send each turn of 5 seconds or more as its own request for an answer about each turn.
On either path
- The model does not hear which side or channel a sound comes from, so do not ask about left or right.
- Overlapping speech is hard to judge either way. To find it, ask about it directly on a short stretch of audio.
Choose how much time
Whether something happens in a turn or a call
Send the whole file, or the turn when it is at least 5 seconds long. You need one answer, and cutting the audio into windows multiplies requests. A turn shorter than 5 seconds is rejected with audio_too_short, so extend it with the audio before and after it.
How a known moment sounds
- When you know where the moment is, such as the caller’s reply to a yes or no question or the agent’s greeting, cut a window centered on it, at least 5 seconds long, since shorter audio is rejected with
audio_too_short. - A one-word reply lasts a fraction of a second, so keep the audio around it.
Where or how often something happens
Overlapping windows with a noul question, for frequent events or when missing one is costly:
- Make each window at least twice as long as the longest event you expect, and at least 5 seconds: 5 seconds for filler words such as “um”, 6 to 8 seconds for laughter.
- Overlap the windows so every event fits whole inside at least one. For example, 6-second windows every 3 seconds contain any event up to 3 seconds long. Half-overlapping windows double the number of requests.
- Cut at pauses where you can, using voice activity detection.
- Treat yes answers in adjacent windows as one event.
6-second windows every 3 seconds, and a 3-second laugh
Two windows cut the laugh, and the window from 6 to 12 seconds holds all of it.
A span question, checked with noul, for rare events in long audio:
- Ask the
spanquestion of the turn or the file. - For each span returned, cut a window of at least 5 seconds centered on it and ask a
noulquestion about the same event. - Keep the spans the
noulanswer confirms.
audio_start_ms is measured from the start of the file you sent. When the file is cut from a longer recording, add the cut’s start time. See Primitives for the fields of a span answer.
An overall impression of a long recording
- A request takes 5 seconds to 5 minutes of audio. Split longer recordings into parts, ask every part the same questions and combine the answers in your code. Evaluating many files shows how to split them.
- Split at pauses or turn ends rather than every 5 minutes, so no turn is cut in half.
- Combine with the mean for an overall level, or with the maximum for whether something happens in any part. Weight by length when parts differ a lot.
- Each part is answered without the others, so a combined answer can differ from how a listener would judge the whole recording.
Live audio
- Clips: send short clips of the latest audio as the conversation goes on. Each clip is an ordinary request.
- Window length: at least 5 seconds, and long enough to answer on its own. 5 seconds is a reasonable start for how someone sounds.
- How often to send: no more often than one request takes to return. If a request is still waiting when the next clip is due, skip that clip.
- At the end of each turn, or on a timer: sending the latest 5 seconds or more when the speaker pauses often works better, since the clip ends on a whole thought.
- Rate limit: the organization’s 60 requests per minute cover every stream. One clip every 5 seconds is 12 requests per minute, so five streams at that rate reach the limit. See Limits.
- Smoothing: act on several clips in a row, not one.
- Silence and mute: skip clips that are mostly silence, and never join audio from before and after a mute.
- Calls: send both sides mixed into one clip. Send each side as its own clip only to judge one person on their own.
The Answering live audio cookbook runs an app that records short clips as audio plays and sends each clip as it ends.
Decide what stays in the audio
- Silence: trim it for questions about the speech itself, such as tone or emotion, keeping at least 5 seconds of audio. Keep it for questions about pace, pauses or response timing.
- Background sound: keep it for questions about the environment. Do not remove noise before asking about recording quality.
- Re-encoding: each lossy re-encode can make audio sound more artificial. Send the original where you can, and avoid chains such as MP3 to WAV to MP3.
- Audio processing: turn off noise suppression, echo cancellation and automatic gain control where you can. They change the loudness and background noise that questions ask about.
Convert the file
- The API takes MP3 or WAV. See Limits.
- The model hears audio as 16 kHz, 16-bit, one channel. A file with two channels is mixed into one before the model hears it.
- The SDKs’
createconverts WAV files to 16 kHz mono for you. To judge one person on their own, passdownmix_strategy="first_channel"in Python ordownmixStrategy: "first_channel"in TypeScript to keep only the first channel. - Without the SDKs, convert large WAV files to 16 kHz mono so they fit the size limit.