Example #1
0
 public void onClickFalarArquivo(View view) {
   File file = SDCardUtils.getPublicFile("arquivo-voz.wav", Environment.DIRECTORY_MUSIC);
   if (file.exists()) {
     try {
       MediaPlayer mp = new MediaPlayer();
       mp.setDataSource(file.getAbsolutePath());
       mp.prepare();
       mp.start();
     } catch (Exception e) {
       Log.e(TAG, "Erro ao tocar: " + e.getMessage(), e);
     }
   }
 }
Example #2
-1
 public void onClickSalvar(View view) {
   String s = tMsg.getText().toString();
   // Sintetiza a voz para arquivo
   File file = SDCardUtils.getPublicFile("arquivo-voz.wav", Environment.DIRECTORY_MUSIC);
   HashMap<String, String> params = new HashMap<String, String>();
   tts.synthesizeToFile(s, params, file.getAbsolutePath());
   toast("Voz salva em arquivo: " + file);
 }