Skip to content

KokoroAne synthesizeDetailed(text:) no longer chunks long phoneme input since #790 (regresses #712 / #717) #940

Description

@drakulavich

What happened

KokoroAneManager.synthesizeDetailed(text:) used to split long phoneme strings before running the chain. That was added in #717 for #712. PR #790 (1a2da18, "byte-exact NeMo text normalization before G2P", merged 2026-07-10) rewrote the function and the split went away with it. The commit message does not mention chunking, and PhonemeChunker is now gone from Sources/ entirely.

At v0.15.5 the body was:

let chunks = PhonemeChunker.chunk(resolved, maxLength: KokoroAneConstants.maxPhonemeLength)
guard chunks.count > 1 else {
    return try await runChain(phonemes: resolved, voice: voice, speed: speed)
}
return try await synthesizeChunks(chunks, voice: voice, speed: speed)

At v0.15.7 and on main (87a39df) it is:

let resolved = try await phonemes(for: text)
return try await runChain(phonemes: resolved, voice: voice, speed: speed)

So the high-level text API is back to the pre-#717 behaviour: anything past 510 phonemes throws KokoroAneError.phonemeSequenceTooLong from KokoroAneVocab.encode, and every caller has to bring its own chunker again.

Repro

English variant, am_michael, a 543-character English paragraph passed to synthesizeDetailed(text:) on v0.15.7: phonemeSequenceTooLong(526). The same text synthesizes on v0.15.5. In our measurements English prose comes out at roughly one phoneme per character, so the limit is hit somewhere around 500 characters of plain text, and at speed: 2.0 proportionally earlier in wall-clock terms.

Expected

Either the #717 behaviour comes back (chunk resolved on maxPhonemeLength, run each chunk, concatenate), or the removal is documented as intentional so callers know to split text themselves. We currently carry the old chunking in a bridge on our side, which is fine as a stopgap but not something we want to keep diverging.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions