How to set buffer size to start processing in Streaming TTS with min_buffer_size
The min_buffer_size
parameter sets the minimum number of characters that must accumulate in the buffer before the TTS engine begins converting text into audio.
We buffer incoming text until it reaches this threshold before processing and chunking begins.
This helps balance latency with natural sentence completion during real-time TTS streaming.
Parameter Details
- Type: Integer
- Range:
30
to200
- Default:
50
- Purpose: Minimum character length that triggers buffer flushing and TTS processing.
How It Works
- When the buffer reaches
min_buffer_size
, the text is automatically processed and streamed as audio. - If the buffer does not reach the threshold, the text is held until:
- More characters arrive, or
- A flush command is sent.
Manual Flush Option
A flush command forces the TTS engine to immediately process the current buffer — even if it hasn’t reached the min_buffer_size
.
Practical Example
Suppose min_buffer_size = 50
, and you send an 80-character sentence in two parts:
To process the remaining 20 characters, send a flush message.