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:
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
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With