ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Too much latency for a publisher working with sound_play

asked 2011-12-14 09:46:18 -0500

giorgosera gravatar image

updated 2011-12-14 09:48:30 -0500

Hey all,

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?

Thanks George

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-12-14 11:17:43 -0500

130s gravatar image

updated 2011-12-14 22:24:15 -0500

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).

edit flag offensive delete link more

Comments

Thanks Isaac I will give it a go and let u know the result.
giorgosera gravatar image giorgosera  ( 2011-12-14 21:22:53 -0500 )edit

Question Tools

Stats

Asked: 2011-12-14 09:46:18 -0500

Seen: 535 times

Last updated: Dec 14 '11