0
app already speaks what I write, but if I write a question with punctuation mark (?) does not pronounce as a question, the pronunciation is very fast, how do I improve it?
public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener {
private TextToSpeech TTS;
private Button BTN;
private EditText EDT;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TTS = new TextToSpeech(this,this);
BTN = findViewById(R.id.btn_ouvir_texto);
EDT = findViewById(R.id.edt_input_txt);
BTN.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SpeechOut();
}
});
}
@Override
public void onInit(int status) {
if(status == TextToSpeech.SUCCESS)
{
int result = TTS.setLanguage(Locale.getDefault());
if(result == TextToSpeech.LANG_NOT_SUPPORTED || result ==TextToSpeech.LANG_MISSING_DATA)
{
Log.e("TTS", "Idioma não suportado");
}else{
BTN.setEnabled(true);
SpeechOut();
}
}else {
Log.e("TTS","Inicialização falhou...");
}
}
private void SpeechOut()
{
String text = EDT.getText().toString();
TTS.speak(text,TextToSpeech.QUEUE_FLUSH,null);
}
}