Skip to content

Commit 02b9cbf

Browse files
committed
2 parents ef9daf6 + f48daa3 commit 02b9cbf

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,70 @@
11
# TextConvertor
22

33
Convert Text into Voice(Speech) and Speech into Text..
4+
5+
<br><br>
6+
7+
<h3> Speech converting into Text <h3>
8+
<img src="img1.png" height="550px" width="310px">
9+
10+
<br><br>
11+
<h3> Text converting into Speech <h3>
12+
<img src="img2.png" height="550px" width="310px">
13+
14+
<h2> How to add TextConvertor </h2>
15+
16+
<h3> Define maven() into repositories </h3>
17+
18+
allprojects {
19+
repositories {
20+
...
21+
maven { url 'https://jitpack.io' }
22+
}
23+
}
24+
25+
26+
<h3> Add the dependency </h3>
27+
28+
dependencies {
29+
implementation 'com.github.sayyedrizwan:TextConvertor:1.4'
30+
}
31+
32+
33+
34+
<h2> How to use TextConvertor <h2>
35+
36+
<h3> To Convert speech into text </h3>
37+
38+
TextConvertor.speechtoText(context); // It will activate voice control to get your voice
39+
40+
41+
// put full switch case in onActivityResult class to get the output
42+
43+
@Override
44+
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
45+
super.onActivityResult(requestCode, resultCode, data);
46+
47+
switch (requestCode){
48+
case 1:
49+
if (resultCode == RESULT_OK && null!= data){
50+
ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
51+
52+
//Get the output of speech
53+
editText.setText(result.get(0)); // result.get(0) is the output
54+
}
55+
break;
56+
}
57+
58+
59+
}
60+
61+
62+
<h3> To Convert text into speech </h3>
63+
64+
TextConvertor.textToSpeech(context, stringoutput);
65+
66+
67+
68+
69+
70+

0 commit comments

Comments
 (0)