Skip to content

fix: stop short mlx chunks stalling playback - #77

Merged
StuBehan merged 3 commits into
mainfrom
chunk-pacing
Oct 29, 2026
Merged

StuBehan merged 3 commits into
mainfrom
chunk-pacing

Conversation

@StuBehan

@StuBehan StuBehan commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Was getting a few seconds of silence partway through replies on the mlx backend. Down to how split_long_text packs the chunks, a short sentence went out on its own ahead of a full 170 char chunk so it finished playing long before the next one had generated. "Yes." followed by a long sentence sat there for 7.3s! Long sentences were also getting cut at whatever word hit the limit, mid clause.

Now anything over 170 splits at , ; : or a dash first and only falls back to words if a clause is still too long, and a chunk under 60 chars borrows the start of the next sentence rather than going out alone. (Tried ramping chunk sizes up from a small first one as well, made it worse, the fixed cost per generate call eats the head start.)

Ran four texts through a local model just under real time, old vs new, timing playback by sleeping for each chunk's duration. The two with a short opener had no gaps after, the two normal paragraphs chunk the same as before. Downside is first audio comes later when a reply opens on something tiny (1.0s to 8.9s worst case), same as a long opener gets now.

434 tests (4 new), ruff clean, README updated.

Split over-long sentences at commas, semicolons, colons and dashes before
falling back to word boundaries, and fill a chunk under 60 characters from
the next sentence instead of sending it alone. A short chunk ahead of a long
one left a pause of several seconds while the long one generated.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread README.md Resolved
@StuBehan
StuBehan merged commit b752112 into main Oct 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant