1

I am developing a text-to-speech android application. I wish to convert my translated speech into a mp3 file and save it on the device. Is there any way to do it?

2 Answers2

0

Refer this link :

HashMap<String, String> myHashRender = new HashMap();
String wakeUpText = "Are you up yet?";
String destFileName = Environment.getExternalStorageDirectory()+"myAppCache/wakeUp.wav";
myHashRender.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, wakeUpText);
mTts.synthesizeToFile(wakeUpText, myHashRender, destFileName);

OR

THIS ANSWER

I hope this will help you

Community
  • 1
  • 1
Amrut Bidri
  • 6,116
  • 6
  • 34
  • 79
  • Thanks for your answer. But, I am still having some problem with my code. It would be great if you help me. I am inserting your code in the SpeakText method and changing the variable names,etc. But, it is not working. Can you tell me where am I going wrong? `code` public void speakText(View view){ String toSpeak = write.getText().toString(); Toast.makeText(getApplicationContext(), toSpeak, Toast.LENGTH_SHORT).show(); ttobj.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null); } } `code` – user3319410 Mar 15 '15 at 17:20
  • check WRITE_EXTERNAL_STORAGE permission – Amrut Bidri Mar 16 '15 at 05:05
0

The only thing is you must put that code in a right place, also never forget to add this permission to the manifest.xml:

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">


 </uses-permission>

or i give you a link on this stuff...

Enamul Hassan
  • 5,000
  • 23
  • 38
  • 54
dondondon
  • 781
  • 6
  • 4