Skip to content

Commit d3fbd61

Browse files
IgorSwatchmjkb
andauthored
feat: text to speech (#710)
## Description <!-- Provide a concise and descriptive summary of the changes implemented in this PR. --> ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [ ] Bug fix (change which fixes an issue) - [x] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [ ] Other (chores, tests, code style improvements etc.) ### Tested on - [x] iOS - [x] Android ### Testing instructions <!-- Provide step-by-step instructions on how to test your changes. Include setup details if necessary. --> ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [x] I have performed a self-review of my code - [x] 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 There are still a few side things to be done on this feature. --------- Co-authored-by: chmjkb <[email protected]>
1 parent 78121b1 commit d3fbd61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4545
-27
lines changed

.cspell-wordlist.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,10 @@ FSMN
8484
fsmn
8585
subarray
8686
topp
87+
kokoro
88+
phonemizer
89+
phonemizers
90+
phonemis
91+
Español
92+
Français
93+
Português

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const handleGenerate = async () => {
111111
We currently host a few example [apps](https://github.com/software-mansion/react-native-executorch/tree/main/apps) demonstrating use cases of our library:
112112

113113
- `llm` - Chat application showcasing use of LLMs
114-
- `speech-to-text` - Whisper model ready for transcription tasks
114+
- `speech` - Speech to Text & Text to Speech task implementations
115115
- `computer-vision` - Computer vision related tasks
116116
- `text-embeddings` - Computing text representations for semantic search
117117

apps/speech-to-text/App.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

apps/speech/App.tsx

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import React, { useState } from 'react';
2+
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
3+
import { TextToSpeechScreen } from './screens/TextToSpeechScreen';
4+
import { SpeechToTextScreen } from './screens/SpeechToTextScreen';
5+
import ColorPalette from './colors';
6+
import ExecutorchLogo from './assets/executorch.svg';
7+
import { Quiz } from './screens/Quiz';
8+
9+
export default function App() {
10+
const [currentScreen, setCurrentScreen] = useState<
11+
'menu' | 'speech-to-text' | 'text-to-speech' | 'quiz'
12+
>('menu');
13+
14+
const goToMenu = () => setCurrentScreen('menu');
15+
16+
if (currentScreen === 'text-to-speech') {
17+
return <TextToSpeechScreen onBack={goToMenu} />;
18+
}
19+
20+
if (currentScreen === 'speech-to-text') {
21+
return <SpeechToTextScreen onBack={goToMenu} />;
22+
}
23+
24+
if (currentScreen === 'quiz') {
25+
return <Quiz onBack={goToMenu} />;
26+
}
27+
28+
return (
29+
<View style={styles.container}>
30+
<ExecutorchLogo width={64} height={64} />
31+
<Text style={styles.headerText}>Select a demo model</Text>
32+
<View style={styles.buttonContainer}>
33+
<TouchableOpacity
34+
style={styles.button}
35+
onPress={() => setCurrentScreen('speech-to-text')}
36+
>
37+
<Text style={styles.buttonText}>Speech to Text</Text>
38+
</TouchableOpacity>
39+
<TouchableOpacity
40+
style={styles.button}
41+
onPress={() => setCurrentScreen('text-to-speech')}
42+
>
43+
<Text style={styles.buttonText}>Text to Speech</Text>
44+
</TouchableOpacity>
45+
<TouchableOpacity
46+
style={styles.button}
47+
onPress={() => setCurrentScreen('quiz')}
48+
>
49+
<Text style={styles.buttonText}>Text to Speech - Quiz</Text>
50+
</TouchableOpacity>
51+
</View>
52+
</View>
53+
);
54+
}
55+
56+
export const fontSizes = {
57+
xxl: 34,
58+
xl: 22,
59+
lg: 18,
60+
md: 16,
61+
sm: 14,
62+
xs: 12,
63+
xxs: 10,
64+
};
65+
66+
const styles = StyleSheet.create({
67+
container: {
68+
flex: 1,
69+
justifyContent: 'center',
70+
alignItems: 'center',
71+
backgroundColor: '#fff',
72+
},
73+
headerText: {
74+
fontSize: fontSizes.lg,
75+
color: ColorPalette.strongPrimary,
76+
margin: 20,
77+
},
78+
buttonContainer: {
79+
width: '80%',
80+
justifyContent: 'space-evenly',
81+
marginBottom: 20,
82+
},
83+
button: {
84+
backgroundColor: ColorPalette.strongPrimary,
85+
borderRadius: 8,
86+
padding: 10,
87+
alignItems: 'center',
88+
marginBottom: 10,
89+
},
90+
buttonText: {
91+
color: 'white',
92+
fontSize: fontSizes.md,
93+
},
94+
});
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"expo": {
3-
"name": "speech-to-text",
4-
"slug": "speech-to-text",
3+
"name": "speech",
4+
"slug": "speech",
55
"version": "1.0.0",
66
"orientation": "portrait",
77
"icon": "./assets/icon.png",
@@ -14,7 +14,7 @@
1414
},
1515
"ios": {
1616
"supportsTablet": true,
17-
"bundleIdentifier": "com.anonymous.speechtotext",
17+
"bundleIdentifier": "com.anonymous.speech",
1818
"infoPlist": {
1919
"NSMicrophoneUsageDescription": "This app needs access to your microphone to record audio."
2020
}
@@ -24,7 +24,7 @@
2424
"foregroundImage": "./assets/adaptive-icon.png",
2525
"backgroundColor": "#ffffff"
2626
},
27-
"package": "com.anonymous.speechtotext"
27+
"package": "com.anonymous.speech"
2828
},
2929
"web": {
3030
"favicon": "./assets/favicon.png"
File renamed without changes.

apps/speech/assets/executorch.svg

Lines changed: 9 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)