C.W.K.
Stream
Lesson 04 of 05 · published

Where the Text Breaks

~9 min · chunking, cache-identity, prosody

Level 0Silent
0 XP0/36 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"How you cut the text changes how it sounds. So the cut has to be deterministic — and part of the cache key."

Long Text Has to Be Cut

A long passage is synthesized in chunks, and where you cut it is not cosmetic — it shapes the prosody, the pauses, the breath. Bellows's chunker follows a couple of clear rules. A newline is a hard boundary: a line break in the text is a real break in the speech. And standalone, leading, or trailing English gets detached — a run of English at the edge of a Korean sentence becomes its own chunk. The guiding principle is "words stay whole, sentences detach": never split in the middle of a word, but let clean seams become boundaries.

The Cut Is Part of the Identity

Here's the connection back to Track 4: because chunk boundaries change the audio, they're folded into the cache identity. The same input, chunked the same way, produces the same split and hits the same cache. If chunking were nondeterministic — different boundaries run to run — the "identical" request would resynthesize every time, and the cache would never hit. Deterministic chunking is what makes long-form audio cacheable at all.

Preview Before You Pay

Because the split is deterministic and matters, Bellows can show it to you. Speak previews the exact chunk boundaries before you commit — you see where the text will break, so there are no surprise cuts landing mid-thought after you've already paid. It closes the loop: the chunking you see in the preview is the chunking that gets synthesized, keyed, and cached.

Code

Deterministic split: newline hard-breaks, edge-English detached·python
def chunk(text: str) -> list[str]:
    chunks = []
    for line in text.split("\n"):          # 1. a newline is a HARD boundary
        # 2. detach standalone / leading / trailing English so a run of English
        #    at a sentence edge becomes its own chunk (words stay whole).
        for piece in detach_edge_english(line):
            chunks.append(piece)
    return chunks

# Chunk boundaries CHANGE the audio (prosody, pauses), so they ride in the
# cache identity. Same text -> same split -> same cached audio.
# Speak previews the exact boundaries BEFORE you pay: no surprise cuts.

External links

Exercise

Take a short mixed-language paragraph with a couple of line breaks and some English embedded in it. Chunk it by hand using two rules: newline is a hard boundary, and edge English detaches. Mark every boundary. Then show how a different chunking of the same text would change the audio — and explain why that means chunk boundaries have to be in the cache key.
Hint
Cut at the newlines first, then peel English off the edges. Now imagine cutting one sentence in a different place: the pauses move, so the audio differs. Different audio from the 'same' text is exactly why the cut must be part of the identity.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.