How to fix a problem of sound_play for playing wave file in c++?

asked 2016-10-08 20:09:21 -0600

78226415 gravatar image

Hi everyone, I want to play a wave file by using sound_play in c++, the codes like: sound_play::SoundClient sc; sc.playWave("/root/Desktop/test.wav");

and it shows:

[WARN] [WallTime: 1475855177.583316] Sound command issued, but no node is subscribed to the topic. Perhaps you forgot to run soundplay_node.py?

but i have run it before, like:

root@lgx-robot:~/hlf_ws# rosrun sound_play soundplay_node.py [INFO] [WallTime: 1475853878.411334] sound_play node is ready to play sound

If i try to play it with python as is: rosrun sound_play play.py /root/Desktop/test.wav

it is ok and you could hear the sound of the wave file.

And if i run the command: rosrun sound_play say.py "hello world" it shows:

root@lgx-robot:~/hlf_ws# rosrun sound_play say.py "hello world" Saying: hello world Voice: voice_kal_diphone

and i could hear the sound. My environment is ubuntu14.04 LTS, ros indigo. what should i do? Should some one would help me? thanks

edit retag flag offensive close merge delete

Comments

From your description I can't tell why this is happening; it would be useful if you included the full source code for your program (or a simplified version of it that shows the problem). You may also want to inspect the ROS graph to make sure that your node is publishing on the correct topic.

ahendrix gravatar image ahendrix  ( 2016-11-10 00:03:40 -0600 )edit