Android TTS 和口型同步
Android TTS and Lip Sync
我目前正在构建一个由 Android 驱动的机器人头部。我使用的是标准 android.speech.tts.TextToSpeech 但是我没有想到如何制作动画或检测它在说什么以便我可以做嘴巴运动(我知道如何控制硬件)
我能看到的唯一 class 可能有帮助的是 http://developer.android.com/reference/android/media/audiofx/Visualizer.html
有没有人做过 Android TTS 口型同步并可以提供一些建议?
是否有回调方法可以连接到口型同步
这是我的 TTS 代码
private void speakWords(String speech) {
//implement TTS here
if (speech != null && speech.length() > 0) {
HashMap<String, String> myHashAlarm = new HashMap<String, String>();
myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_VOLUME, "1");
myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "SOME MESSAGE");
myTTS.speak(speech, TextToSpeech.QUEUE_FLUSH, myHashAlarm); //QUEUE_ADD
}
}
您可以按照 post 中的说明使用 UtteranceProgressListener
Unable to detect completion of TTS (callback) android.
此博客还解释了播放完成回调的可选参数
http://android-developers.blogspot.co.uk/2009/09/introduction-to-text-to-speech-in.html
我建议为您的 TextToSpeechService
添加一个 SynthesisCallback
侦听器。这样做将允许您在可以移动机器人嘴巴的不同时间间隔接收回调。
有关详细信息,请参阅 http://developer.android.com/reference/android/speech/tts/SynthesisCallback.html。
我目前正在构建一个由 Android 驱动的机器人头部。我使用的是标准 android.speech.tts.TextToSpeech 但是我没有想到如何制作动画或检测它在说什么以便我可以做嘴巴运动(我知道如何控制硬件)
我能看到的唯一 class 可能有帮助的是 http://developer.android.com/reference/android/media/audiofx/Visualizer.html
有没有人做过 Android TTS 口型同步并可以提供一些建议?
是否有回调方法可以连接到口型同步
这是我的 TTS 代码
private void speakWords(String speech) {
//implement TTS here
if (speech != null && speech.length() > 0) {
HashMap<String, String> myHashAlarm = new HashMap<String, String>();
myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_VOLUME, "1");
myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "SOME MESSAGE");
myTTS.speak(speech, TextToSpeech.QUEUE_FLUSH, myHashAlarm); //QUEUE_ADD
}
}
您可以按照 post 中的说明使用 UtteranceProgressListener Unable to detect completion of TTS (callback) android.
此博客还解释了播放完成回调的可选参数 http://android-developers.blogspot.co.uk/2009/09/introduction-to-text-to-speech-in.html
我建议为您的 TextToSpeechService
添加一个 SynthesisCallback
侦听器。这样做将允许您在可以移动机器人嘴巴的不同时间间隔接收回调。
有关详细信息,请参阅 http://developer.android.com/reference/android/speech/tts/SynthesisCallback.html。