I have a subscriber written in Python and subscribes to some sensor msgs. It uses sound_play to perform speech synthesis and inform the user about the information received by the sensors. My main problem is that the latency is huge. The sensor detects the obstacle at time t and sends it to the subscriber. However, sound_play reporoduces the sound at time t + long_after. Apparently my subscriber sends too much messages to sound_play which accumulates the messages in a buffer. Is there any way to workaround this issue?
Alhough I am not 100% sure, the latency might come from both
ROS' sound_play and also
festival. Even though
sound_play assures that it can handle multiple play request simultaneously, I had difficulty that caused a problem when trying to handle multiple requests within very short interval (ticket opened).
One workaround worth trying is to use
festival (or other native player) directly. For example for text2speech, do something like this.
process = subprocess.Popen(['festival', '--tts'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout_value, stderr_value = process.communicate(spokenTxt) process.wait()
For playing audio file, using
mplayer is an option if you're on
Ubuntu. These worked out for us well (although certain interval b/w each play was necessary to guarantee the proper execution and the sound quality).
Asked: 2011-12-14 15:46:18 -0500
Seen: 134 times
Last updated: Dec 15 '11