0
$\begingroup$

Rosanswers logo

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


Originally posted by giorgosera on ROS Answers with karma: 43 on 2011-12-14

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by 130s with karma: 10937 on 2011-12-14

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by giorgosera on 2011-12-14:
Thanks Isaac I will give it a go and let u know the result.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.