我该如何拯救我的Android TTS输出的wav文件? [英] How can I save my android tts output in a wav file?
问题描述
我看过几乎无处不在试图找到一种方法来拯救我的Android TTS输出的音频文件。我看着这些帖子:
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:
- <一个href="http://stackoverflow.com/questions/9229795/how-can-i-save-tts-output-in-an-audio-file-on-android">How我可以节省TTS输出在Android上的音频文件?
- <一个href="http://stackoverflow.com/questions/7132673/how-can-i-allow-the-tts-to-write-files-to-my-apps-directories/">How我可以让TTS将文件写入我的应用程序的目录?
- How can I save TTS output in an audio file on android?
- How can I allow the TTS to write files to my app's directories?
但无法找到/明白的答案。我使用 synthesizeToFile()
是这样的:
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);
所以我重新发布了同样的问题。任何帮助是非常AP preciated。
So I am reposting the same question. Any help is much appreciated.
感谢您, Mounika
Thank you, Mounika
推荐答案
最重要的方法是<一个href="http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#synthesizeToFile%28java.lang.String,%20java.util.HashMap%3Cjava.lang.String,%20java.lang.String%3E,%20java.lang.String%29"相对=nofollow> synthesizeToFile
。它会写音频到您指定的设备上的文件。然后,您可以播放与文件的MediaPlayer
或可以将设备与亚行把它关闭到您的开发系统
使用命令的命令行工具
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>
这篇关于我该如何拯救我的Android TTS输出的wav文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!