Convert Text into Voice(Speech) and Speech into Text..
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.sayyedrizwan:TextConvertor:1.4'
}
TextConvertor.speechtoText(context); // It will activate voice control to get your voice
// put full switch case in onActivityResult class to get the output
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode){
case 1:
if (resultCode == RESULT_OK && null!= data){
ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
//Get the output of speech
editText.setText(result.get(0)); // result.get(0) is the output
}
break;
}
}
TextConvertor.textToSpeech(context, stringoutput);