Save tts as audio file

5

How can I generate an audio file from a TexttoSpeech to share with other services ( sms , whats , messenger ... )?

I created this function to share

private void shareAudio() 
{
    Intent intent = new Intent( Intent.ACTION_SEND );
    intent.setType("audio/3gpp");
    startActivity( intent );
}

But I have no idea how to "treat" tts before, any ideas?

    
asked by anonymous 04.10.2016 / 03:04

1 answer

0

Alternative 1

The TextToSpeech library does not support audio recording , however, you may try to get into write mode while you speak through the MediaRecord class. > :

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 the API TextToSpeech . So it's interesting to run isLanguageAvailable to see whether or not you can use a particular language in this framework.

Alternative 2

This would be another alternative if you did not want to use the user's voice. You can use Google Translate to read text that has been capitalized by voice and convert to MP3. Then your job would be to save this MP3 inside your application, however it would only work if you have Internet, because it would access Google Translator in real time. See the link below using the word "test" .

link

Details

04.10.2016 / 15:20