diff --git a/packages/react-native-executorch/common/rnexecutorch/models/text_to_speech/kokoro/Kokoro.cpp b/packages/react-native-executorch/common/rnexecutorch/models/text_to_speech/kokoro/Kokoro.cpp index d73fb6205..4493ec513 100644 --- a/packages/react-native-executorch/common/rnexecutorch/models/text_to_speech/kokoro/Kokoro.cpp +++ b/packages/react-native-executorch/common/rnexecutorch/models/text_to_speech/kokoro/Kokoro.cpp @@ -198,7 +198,7 @@ std::vector Kokoro::synthesize(const std::u32string &phonemes, const auto tokens = utils::tokenize(phonemes, {noTokens}); // Select the appropriate voice vector - size_t voiceID = std::min(phonemes.size() - 1, noTokens); + size_t voiceID = std::min(phonemes.size() - 1, noTokens - 1); auto &voice = voice_[voiceID]; // Initialize text mask