开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜