mstar.api_server.openai.speech_chunking#
Sentence chunking for /v1/audio/speech.
Long inputs are split into sentence groups that are synthesized as separate
requests and played back in order. This keeps every autoregressive
text-to-speech request inside the length its model was trained for, lets the
engine batch the pieces of one long input like independent requests, and
starts the second piece while the first is still streaming (see
serving_speech). Splitting is purely textual and model-agnostic.
Functions
|
Group |
- mstar.api_server.openai.speech_chunking.split_sentences(text, max_chars=400, min_chars=24)[source]#
Group
textinto sentence chunks of at mostmax_charscharacters.Sentences are never cut unless one alone exceeds
max_chars(then it is wrapped at clause boundaries, then spaces, then by length). A trailing fragment shorter thanmin_charsis merged into its predecessor so the model is not asked to voice a lone “Okay.” Returns[text]when nothing needs splitting and[]for blank input.