Alternative 1
The library Texttospeech does not support audio recording, however, may try to enter recording mode while you speak through the class Mediarecord:
MediaRecorder minhaRecorder = new MediaRecorder();
To start a recording, you need to use the methods prepare()
and start()
:
minhaRecorder.prepare();
minhaRecorder.start();
A Texttospeech can only be used to synthesize text.
It is important to note that not all languages are supported by API Texttospeech. Therefore it is interesting to execute the method isLanguageAvailable
to see whether or not you can use a particular language in this structure.
Alternative 2
This would be another alternative, if you didn’t want to use the user’s voice. You can use Google Translator to read the text that was capitured by voice and convert to MP3. Then your job would be to save this MP3 inside your application, but it would only work if you have Internet, because you would access Google Translator in real time. See the link below using the word "test".
http://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=Teste&tl=Pt
Details
But you say capture (from the microphone) the sound of tts? There is no way to transform tts into a string or something of the type, and from that string to generate an mp3 with tts voice which can be shared?
– pokemon_cwb
@pokemon_cwb I say capture from the microphone the sound of the voice of the person who is speaking using tts. But the issue of transforming string into voice, would also give to use google translator api.
– viana
@pokemon_cwb edited the reply by placing the google translator link as alterative 2
– viana