文件名称:讯飞TTS.rar
文件大小:10.88MB
文件格式:RAR
更新时间:2015-06-11 15:57:19
TTS
安装讯飞语音插件.需要安装两个文件,讯飞语音TTS.apk 和讯飞语音包.apk,不需要jar文件,直接到系统配置 -> 语音输入与输出 --> 文字转语音设置 -->讯飞语音后边打钩(选择后才能设置其他项) -- > 默认引擎(讯飞语音) -->语言(中文) (用必要是还可以在讯飞语音合成里选择男声和女声) 配置完成后,可直接用系统提供的TextToSpeak的方法直接调用即可. (测试发现,改发音是中标准的中文发音,据了解,国内语音识别系统做的最好的一家,发音连贯,并且可辨认符号如℃等) 示例代码如下: public class NiHaoTTS extends Activity implements OnInitListener { private int MY_DATA_CHECK_CODE = 0; private TextToSpeech tts; private EditText inputText; private Button speakButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.xunfei_tts); inputText = (EditText) findViewById(R.id.input_text); speakButton = (Button) findViewById(R.id.speak_button); speakButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String text = inputText.getText().toString(); if (text!=null && text.length()>0) { Toast.makeText(NiHaoTTS.this, "Saying: " + text, Toast.LENGTH_LONG).show(); //开始阅读 text tts.speak(text, TextToSpeech.QUEUE_ADD, null); } } }); Intent checkIntent = new Intent(); checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); startActivityForResult(checkIntent, MY_DATA_CHECK_CODE); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == MY_DATA_CHECK_CODE) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { // success, create the TTS instance tts = new TextToSpeech(this, this); } else { // missing data, install it Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installIntent); } } } @Override public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { Toast.makeText(NiHaoTTS.this, "Text-To-Speech engine is initialized", Toast.LENGTH_LONG).show(); } else if (status == TextToSpeech.ERROR) { Toast.makeText(NiHaoTTS.this, "Error occurred while initializing Text-To-Speech engine", Toast.LENGTH_LONG).show(); } } }
【文件预览】:
讯飞语音输入法 2.0.1104.apk
讯飞TTS.apk
讯飞语音包.apk