一、安装3.0引擎;下载地址:链接: https://pan.baidu.com/s/1jAY0EWxTFdsoPdy9kfwlFA 提取码: qhs6
二、转到系统设置-->语音 -->选择TTS语音引擎
三、demo仅实现播放;主要思路:
1.实例化 TextToSpeech textToSpeech = new TextToSpeech(this, this);
2.重写onInit方法,初始化 int result = textToSpeech.setLanguage(Locale.CHINA);
3.参数设置:textToSpeech.setPitch(1.4f);// 设置音调,1.0是常规
textToSpeech.setSpeechRate(1.2f);//设定语速,1.0正常语速
4.合成并播放 textToSpeech.speak(et_input.getText().toString(), TextToSpeech.QUEUE_FLUSH, null);
5.释放资源 textToSpeech.stop(); textToSpeech.shutdown();