Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I save my android tts output in a wav file?

I have looked almost everywhere trying to find a way to save my android tts output in an audio file. I looked at these posts:

  • How can I save TTS output in an audio file on android?
  • How can I allow the TTS to write files to my app's directories?

but couldn't find/understand the answers. I am using synthesizeToFile() like this:

HashMap<String, String> myHashRender = new HashMap<String, String>();
myHashRender.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, result);
String fileName = "/Android/data/com.android.voicelanglearning.vll/ttsfile1.wav";
tts.synthesizeToFile(result, myHashRender, fileName);

So I am reposting the same question. Any help is much appreciated.

Thank you, Mounika

like image 292
mnc Avatar asked Mar 15 '12 03:03

mnc


People also ask

What is Android TTS features?

We've introduced a new feature in version 1.6 of the Android platform: Text-To-Speech (TTS). Also known as "speech synthesis", TTS enables your Android device to "speak" text of different languages.


1 Answers

The important method is synthesizeToFile. It will write the audio to a file on the device that you specify. You can then play that file with a MediaPlayer or you can pull it off the device onto your development system with the adb command-line tool using the command

adb pull <path-to-file>
like image 94
Ted Hopp Avatar answered Oct 11 '22 20:10

Ted Hopp