开发者

How can I do addSpeech() in TTS of Android?

开发者 https://www.devze.com 2023-01-30 10:09 出处:网络
I write simple program for tts. I want to study tts function. My code is below. String wakeUpText = \"Are you up yet?\";

I write simple program for tts. I want to study tts function. My code is below.

    String wakeUpText = "Are you up yet?";
    String destFileName = "/mnt/sdcard/hello.wav";
    mTts.addSpeech(wakeUpText, destFileName);
    mTts.speak(wakeUpText, TextToSpeech.QUEUE_ADD, null);

you can see the code is very like http://developer.android.com/resources/articles/tts.html

My problem is that if the hello.wav is not exist, tts cannot 开发者_C百科speak.

error log is below

DEBUG/MediaPlayer(398): java.io.IOException: Prepare failed.: status=0x1

...

DEBUG/SntpClient(70): request time failed: java.net.SocketException: Address family not supported by protocol

How can I do?


Use just it:

String wakeUpText = "Are you up yet?";
mTts.speak(wakeUpText, TextToSpeech.QUEUE_ADD, null);

Not use:

String destFileName = "/mnt/sdcard/hello.wav";
mTts.addSpeech(wakeUpText, destFileName);

You have error message DEBUG/MediaPlayer(398): java.io.IOException: Prepare failed.: status=0x1 becouse you don't have the file

0

精彩评论

暂无评论...
验证码 换一张
取 消