Skip to navigation

Advanced Settings

Balance latency and naturalness with predictive chunking, and get word-level timestamps over WebSockets.

When you stream text over WebSockets, it arrives in pieces, often a few tokens at a time from an LLM. This page covers two features that control what Falcon does with that text:

  • Predictive chunking decides when Falcon has enough text to start speaking. Use it to give up a little speed for more natural speech, or a little naturalness for speed.
  • Word timestamps give you the start and end time of every spoken word, so you can tell what the user had heard when they interrupt.

Every setting on this page goes at the top level of the frame, next to text. If you put one inside voice_config, Falcon ignores it and doesn’t return an error or warning.

Predictive Chunking

Falcon generates speech one sentence at a time. A full sentence gives the model enough context for natural rhythm and intonation. Falcon has to decide when each sentence ends, though, and the time it spends deciding adds to how long your user waits for audio.

predictive_chunking sets how quickly Falcon makes that decision.

ValueBehaviorGood for
strict (default)When a sentence ending is ambiguous, Falcon waits for one more character before deciding.Narration, and text with a lot of times, abbreviations or titles
lenientFalcon makes its best guess and starts generating audio straight away.Voice agents and other real-time apps where quick turn-taking matters

An ambiguous ending is one like 2 p.m., the U.S. or Dr., where the period may or may not end the sentence. With lenient, Falcon will now and then split a sentence at one of these points, and you may hear a short pause there. Endings that aren’t ambiguous are never delayed, whichever mode you pick.

{
"text": "Your appointment is at 2 p.m. tomorrow.",
"predictive_chunking": "lenient",
"context_id": "turn_1"
}

For a voice agent, start with lenient. You only need the buffer settings below if your text arrives with little or no punctuation.

If you use a voice agent framework such as LiveKit or Pipecat, turn off its sentence tokenizer or text aggregation and stream LLM tokens straight to Falcon. When the framework splits text before Falcon does, you wait twice, and predictive chunking has little left to speed up. See Best Practices.

Buffer settings

Predictive chunking uses punctuation to find where sentences end. Some text arrives with very little punctuation, such as raw speech transcripts or some LLM output. When that happens, Falcon falls back on two buffer settings that decide when to send an unfinished sentence anyway.

If an LLM writes your text, the simpler fix is to make sure every sentence it writes ends with punctuation. The Best Practices page has a system prompt template that does this.

SettingRangeDefaultWhat it does
min_buffer_size0–1000 characters100Sends the text once this many characters have built up
max_buffer_delay_in_ms0–1000 ms300Sends the text if nothing more arrives within this time

Falcon sends an unfinished sentence as soon as it hits either limit.

Larger values give the model more context to work with, so speech sounds better. Smaller values get audio started sooner. Setting either value to 0 tells Falcon not to wait on that limit at all. With both at 0, almost every chunk is turned into audio the moment it arrives. That gives you the lowest Time to First Byte (TTFB), but each fragment is spoken as a separate utterance and the joins between them can sound choppy.

Invalid values

SettingIf you sendWhat happens
predictive_chunkingAnything other than strict or lenientYou get warning INVALID_PREDICTIVE_CHUNKING and audio generation continues. Omit the field to use strict.
min_buffer_sizeA number outside 0–1000, or a value that isn’t a numberYou get warning INVALID_BUFFER_SIZE and the previous value is kept.
max_buffer_delay_in_msA number outside 0–1000, or a value that isn’t a numberYou get warning INVALID_BUFFER_DELAY and the previous value is kept.

Both buffer settings accept numbers sent as strings, such as "100". In your client, check warning_code rather than the message text, which can change. See Errors & Warnings for the full list.

Example

Let’s say the first chunk of text received is: “I just wanted to say that”

  • This sentence is incomplete and has no punctuation, so Falcon doesn’t immediately send it for audio generation.
  • The current length is 24 characters, which is below the default min_buffer_size of 100 characters.
  • Falcon waits for more input. If no additional text arrives within the time set by max_buffer_delay_in_ms (e.g., 500 ms), Falcon sends whatever text it has.

Result: After 500 ms, “I just wanted to say that” is sent for audio generation to avoid further delay. This mechanism ensures fast responses (good TTFB) without compromising too much on naturalness or context.

Word Timestamps

With word timestamps on, Falcon tells you when each word starts and ends in the audio it sends. You can use them to work out what the user had heard when they interrupted.

Word timestamps work in every locale except Chinese, Japanese and Korean.

Turning them on

add_word_timestamps is sent once and applies to every context. Each context starts with voice_config. clear stops that context's audio, and the next text starts near 0.

Send "add_word_timestamps": true on a text frame, next to text. Once set, it applies to every context on that connection. Only Falcon 2.1 is served on this socket.

Configure each named context before its first text frame. Each named context needs its own voice_config. Send "end": true on the last text frame of a turn.

{
"text": "Hello there.",
"add_word_timestamps": true,
"context_id": "turn_1"
}

What you receive

Audio and timestamp frames are mixed, and final has no timestamps.

Timestamps come in their own JSON frames, mixed in with the audio frames. They aren’t part of the base64 audio field. Read them the same way you read audio, final, error and warning frames.

{
"context_id": "turn_1",
"trace_id": "0f8bb0ef-8dcb-4815-8b3a-1e2d3c4b5a69",
"timestamps": {
"words": [
{
"word": "hello",
"start_s": 0.106,
"end_s": 0.386,
"start_frame": 3,
"end_frame": 10
},
{
"word": "there",
"start_s": 0.386,
"end_s": 0.706,
"start_frame": 10,
"end_frame": 18
}
]
}
}
FieldDescription
context_idThe context whose audio these times belong to
trace_idThe request id shared with that context’s audio frames
timestamps.words[].wordNormalized spoken text
start_s, end_sSeconds from the first sample of that open context
start_frame, end_frameThe same positions on a 40 ms grid

At the default 24 kHz sample rate, start_frame is about floor(start_s / 0.04). A word can start inside a bucket, so highlight from the seconds.

A word is omitted until it has both a start and an end. One utterance can span several timestamp frames. Remaining words are flushed before that context’s final frame. final itself has no timestamps.

The audio clock

Zero is the first audio sample of the context, before the first word, and audio continues after the last word.

Zero is the first sample of the open context, including silence before speech. It is not when the socket opened, when the text was sent, or when the first word starts.

While that context stays open, later chunks and later sentences are appended and frame numbers keep increasing. A wait between sends does not move the clock. The first word starts after a short lead-in. Audio continues after the last end_s.

LifetimeClock
Another text frame on the same open context, or another sentence in the same textContinues
A different context_id on the same socketStarts again near 0
Same context_id after end: true and finalStarts again near 0. Send voice_config again before the next text on this context. See Context ID.
Same context_id after clear: trueStarts again near 0 for text sent after the clear

Highlighting

At 0.30 seconds the playhead highlights hello. The lead-in and the gap stay unhighlighted.

Play each context’s audio from its first sample, on its own timeline. On each animation frame, let played be seconds since that context’s first sample started playing, and highlight the word with start_s <= played < end_s.

Leave the lead-in and the gaps between words unhighlighted. Words do not overlap. Turn the highlight off at the last end_s.

Timestamps usually arrive after the first audio chunk, and the first word’s timestamp can arrive after playback has already entered it. Apply a timestamp as soon as it arrives.

Keep one player timeline per context_id. If you append the next context’s audio onto the previous buffer, a clock that starts at 0 points at the wrong sample. Silence inserted by a playback underrun has the same effect: that silence is not in start_s.

Mapping words back to source text

Pay stays pay, $50 becomes fifty and dollars, and 2pm becomes two, p, and m.

Match words in order. The same word can occur twice, each with its own interval.

The word field is what was spoken: letters are lowercase, and punctuation is removed. Hello comes back as hello.

One source token can become several spoken words. $50 becomes fifty and dollars. 2pm becomes two, p, and m. Compare source tokens case-insensitively, with punctuation stripped. If the spoken-word count and the source-token count differ, do not pair them by index. Dates, currency, times, acronyms, and IPA or pronunciation-dictionary replacements are the cases that expand.

Handling interruptions

At 1.30 seconds, hello through table are kept and is and ready are dropped. Then send clear for turn_1.

When the user talks over the agent:

  1. Stop playback.
  2. Send a clear frame with that turn’s context_id, so Falcon stops sending audio that’s still queued. See Context ID.
  3. Drop any audio you’ve already received past the current playback position.
  4. Drop any timestamps whose start_s is past that same position. Keep timestamps for words already heard.

clear does not remove frames the client has already received. Text in the same frame as clear is dropped, with TEXT_IGNORED_WITH_CLEAR. Send the clear and any new text as separate frames. Text sent after the clear starts a new audio clock near 0.

The timestamps you’re left with match what the user actually heard.

Best Practices

  • Tune latency with predictive_chunking first. Use lenient for voice agents and strict when speech quality matters more than speed.
  • If you use LiveKit or Pipecat, turn off the framework’s sentence tokenizer or text aggregation so Falcon does all the splitting.
  • Change the buffer settings only if your text has little or no punctuation.
  • Keep every setting on this page at the top level of the frame, outside voice_config.
  • On barge-in, keep one timeline per context, cut audio and timestamps at the playback position, and send clear so later text starts a new clock.

Next Steps

FAQs

Set predictive_chunking to lenient. Look at the buffer settings only if your text arrives with little or no punctuation.

No. strict only waits when an ending is ambiguous, such as 2 p.m. or Dr.. Other sentence endings go through without delay.

They’re probably inside voice_config. Move them to the top level of the frame, next to text.

No. Turn off the sentence tokenizer or text aggregation and stream LLM tokens straight to Falcon. Falcon already waits for each sentence to end, so splitting in the framework as well only adds delay.

Check that add_word_timestamps is passed as true and that your locale isn’t Chinese, Japanese or Korean.

They are seconds from the first audio sample of the open context, including silence before speech, not from when the socket opened or when the text was sent.

After end: true and final, the next audio for that context_id starts near 0. This also applies to the default context. Send voice_config again before the next text on this context. See Context ID. After clear: true, the clock also starts near 0.