File tree Expand file tree Collapse file tree 5 files changed +22
-16
lines changed
packages/react-native-executorch
common/rnexecutorch/tests
hooks/natural_language_processing Expand file tree Collapse file tree 5 files changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ add_rn_test(TextToSpeechTests integration/TextToSpeechTest.cpp
231231 ${RNEXECUTORCH_DIR} /models/text_to_speech/kokoro/Synthesizer.cpp
232232 ${RNEXECUTORCH_DIR} /models/text_to_speech/kokoro/Partitioner.cpp
233233 ${RNEXECUTORCH_DIR} /models/text_to_speech/kokoro/Utils.cpp
234- LIBS ${PHONEMIS_LIBS}
234+ LIBS phonemis
235235)
236236
237237add_rn_test (LLMTests integration/LLMTest.cpp
Original file line number Diff line number Diff line change 22#include " utils/TestUtils.h"
33#include < algorithm>
44#include < gtest/gtest.h>
5- #include < ranges>
65#include < rnexecutorch/Error.h>
76#include < rnexecutorch/models/text_to_speech/kokoro/Kokoro.h>
87
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ TEST_EXECUTABLES=(
2929 " VADTests"
3030 " TokenizerModuleTests"
3131 " SpeechToTextTests"
32+ " TextToSpeechTests"
3233 " LLMTests"
3334 " ImageSegmentationTests"
3435 " TextToImageTests"
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ export const useTextToSpeech = ({
9494 const instance = guardReady ( 'forward' ) ;
9595 try {
9696 setIsGenerating ( true ) ;
97- return await instance . forward ( input . text ?? "" , input . speed ?? 1.0 ) ;
97+ return await instance . forward ( input . text ?? '' , input . speed ?? 1.0 ) ;
9898 } finally {
9999 setIsGenerating ( false ) ;
100100 }
@@ -105,7 +105,7 @@ export const useTextToSpeech = ({
105105 try {
106106 setIsGenerating ( true ) ;
107107 return await instance . forwardFromPhonemes (
108- input . phonemes ?? "" ,
108+ input . phonemes ?? '' ,
109109 input . speed ?? 1.0
110110 ) ;
111111 } finally {
@@ -136,7 +136,7 @@ export const useTextToSpeech = ({
136136 setIsGenerating ( false ) ;
137137 }
138138 } ,
139- [ moduleInstance , guardReady ]
139+ [ guardReady ]
140140 ) ;
141141
142142 const streamFromPhonemes = useCallback (
@@ -161,17 +161,23 @@ export const useTextToSpeech = ({
161161 [ guardReady ]
162162 ) ;
163163
164- const streamInsert = useCallback ( ( text : string ) => {
165- if ( moduleInstance ) {
166- moduleInstance . streamInsert ( text ) ;
167- }
168- } , [ moduleInstance ] ) ;
164+ const streamInsert = useCallback (
165+ ( text : string ) => {
166+ if ( moduleInstance ) {
167+ moduleInstance . streamInsert ( text ) ;
168+ }
169+ } ,
170+ [ moduleInstance ]
171+ ) ;
169172
170- const streamStop = useCallback ( ( instant : boolean = true ) => {
171- if ( moduleInstance ) {
172- moduleInstance . streamStop ( instant ) ;
173- }
174- } , [ moduleInstance ] ) ;
173+ const streamStop = useCallback (
174+ ( instant : boolean = true ) => {
175+ if ( moduleInstance ) {
176+ moduleInstance . streamStop ( instant ) ;
177+ }
178+ } ,
179+ [ moduleInstance ]
180+ ) ;
175181
176182 return {
177183 error,
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ export interface TextToSpeechInput {
108108 * @property {number } [speed] - optional speed argument - the higher it is, the faster the speech becomes
109109 */
110110export interface TextToSpeechPhonemeInput {
111- phonemes ? : string ;
111+ phonemes : string ;
112112 speed ?: number ;
113113}
114114
You can’t perform that action at this time.
0 commit comments