[英]Android Text to Speech pitch like chipmunk voice
Need help. 需要帮忙。
How to make an Android TTS like chipmunk voice? 如何制作像花栗鼠一样的Android TTS语音?
I was set pitch to 15 , but nothing much different with pitch = 1 . 我将音高设置为15 ,但音高= 1并没有什么不同。
I'm using TTS with Indonesian local language and work great. 我正在使用印尼本地语言的TTS,效果很好。
Here is my code: 这是我的代码:
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = tts.setLanguage(new Locale("id","ID"));
tts.setPitch(15);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TTS", "This Language is not supported");
} else {
speakOut();
}
} else {
Log.e("TTS", "Initilization Failed!");
}
}
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void speakOut() {
String text = mSpeak.toString();
Toast.makeText(getApplicationContext(), text,Toast.LENGTH_LONG).show();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
tts.speak(text,TextToSpeech.QUEUE_FLUSH,null,null);
} else {
tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
}
}
Thanks 谢谢
I don't know what is TTS engine that you choose exactly, but each of TTS engines have a range for properties - speed, volume, pitch, etc. 我不知道您到底选择了什么TTS引擎,但是每个TTS引擎都有一个属性范围-速度,音量,音高等。
I think "15" is the over value about the range of pitch. 我认为“ 15”是音高范围的高值。 So you will find min/max value of range, than set up the limit.
因此,您将找到范围的最小值/最大值,而不是设置限制。
I got result like yours. 我得到了像你一样的结果。 I changed the
我改变了
tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
to: 至:
tts.speak(text, TextToSpeech.QUEUE_ADD, null);
Finally it doesn't go like chipmunk voice again. 最终,它不再像花栗鼠一样发声。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.