1
我需要用戶文本的聲音風格改變到語音TTS引擎 下面是我的代碼更改聲音風格
private TextToSpeech tts;
tts = new TextToSpeech(context, new TextToSpeech.OnInitListener() {
Voice voiceobj = new Voice("This is kirti for welcome you", Locale.getDefault(), 1, 1, false,
"This is");
tts.setVoice(tts.getVoice());
}
我使用Android的語音類作爲其上API級21 http://developer.android.com/reference/android/speech/tts/Voice.html
添加Setvoice ()http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#setVoice(android.speech.tts.Voice)
** 1 ** - 拼寫錯誤'getVoices()'。 ** 2 ** - 我想你必須像'tts.setVoice(tts.getVoices(0));'(是0可用的第一個語音)一樣使用它嗎? –
@DerGolem謝謝,但它不允許我添加整數參數 –
它有什麼期望?一個字符串?一個語音對象? –