Skip to content

feat(tts): word timestamps for Kokoro - #1495

Merged
msluszniak merged 5 commits into
mainfrom
@ms/kokoro-timestamps
Oct 7, 2026
Merged

msluszniak merged 5 commits into
mainfrom
@ms/kokoro-timestamps

Conversation

@msluszniak

@msluszniak msluszniak commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Description

  • Kokoro chunks now carry words: { text, offset, start, end }, with times in seconds from the start of the stream.
  • Phonemizer: phonemize(text, { words: true }) also returns each input word's position in the phonemes, via phonemis v0.2.0 phonemize_words().
  • Fix: a synthesize() call that failed while phonemizing or partitioning left the pipeline marked busy.

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

  • yarn workspace react-native-executorch test and scripts/run-native-tests.sh -R PhonemizerTest.
  • On device, synthesize text with numbers and dates and check chunk.words against the audio. On iPhone 16 (Kokoro EN_US Core ML) word onsets after pauses matched Whisper word timestamps within 10 ms.

Screenshots

Related issues

#879

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

Kokoro EN_US XNNPACK could not be tested on iPhone 16: it runs out of memory on main too.

Kokoro chunks now report when each input word is spoken. The phonemizer
binding exposes preprocess() and phonemize(text, preprocess?), and
phonemizeWords() locates input words in the phonemes, counting spelled-out
numbers by preprocessing them alone. Also stops a failed synthesize() call
from leaving the pipeline marked busy.
@msluszniak msluszniak self-assigned this Sep 25, 2026
@msluszniak msluszniak added the feature PRs that implement a new feature label Sep 25, 2026

@barhanc barhanc left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be nice to have this word highlighting in the Kokoro example screen to test the changes end-to-end. Regarding the algorithm itself I can't say much, maybe @IgorSwat should take a look

Comment thread packages/react-native-executorch/src/extensions/speech/utils/phonemizer.ts Outdated
Comment thread packages/react-native-executorch/src/extensions/speech/utils/phonemizer.ts Outdated
Bump phonemis to v0.2.0 and expose its phonemize_words() as
phonemizer.phonemize(text, { words: true }), returning PhonemizedText.
Drop speech.phonemizeWords(), preprocess() and the preprocess flag.
phonemis v0.2.0 vendors xsimd, whose headers include each other as
`xsimd/...`. Its CMakeLists adds src/third-party for Android; the
podspec now does the same.
@msluszniak
msluszniak requested review from IgorSwat and barhanc October 6, 2026 11:20
@msluszniak msluszniak linked an issue Oct 7, 2026 that may be closed by this pull request

@barhanc barhanc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested the e2e example and it works nicely. Just some smallish comments regarding the implementation.

Comment thread packages/react-native-executorch/cpp/extensions/speech/phonemizer.cpp Outdated
Comment thread packages/react-native-executorch/cpp/extensions/speech/phonemizer.cpp Outdated
@msluszniak
msluszniak requested a review from barhanc October 7, 2026 16:30
@msluszniak
msluszniak merged commit d67b98f into main Oct 7, 2026
8 checks passed
@msluszniak
msluszniak deleted the @ms/kokoro-timestamps branch October 7, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PRs that implement a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check if timestamped Kokoro is exportable

3 participants