ROS中PocketSphinx语音识别_安装arbotix simulator仿真环境_turtlebot的仿真语音控制                     


这篇博客里有写到实现播放语音,可以有不同的声音

可以参考http://www.pirobot.org/blog/0022/

hydro中的声音驱动已经装过

 sudo apt-get install ros-hydro-audio-common
The sound_play package uses the CMU Festival TTS library to generatesynthetic speech.  Let's test it out with the default voice as follows.  First fire up the primary sound_playnode:

roscore

$ rosrun sound_play soundplay_node.py

In another terminal, enter some text to be converted to voice:

$ rosrun sound_play say.py "Greetings Humans. Take me to your leader."

The default voice is called  kal_diphone.   To see all the English voices currently installed on your system:

$ ls /usr/share/festival/voices/english

To get a list of all basic Festival voices available, runthe following command:

$ sudo apt-cache search --names-only festvox-*

To install the  festvox-don voice (for example), run the command:(这个前面已经装过,这个声音难听)

$ sudo apt-get install festvox-don

And to test out your new voice, add the voice name to the end of the command line like this:

$ rosrun sound_play say.py "Welcome to the future" voice_don_diphone


There aren't a huge number of voices to choose from, but a few additional voices can be installed as described here and demonstrated here.   Here are the steps to get and use two of those voices, one male and one female:(这个声音比较好听)

$ sudo apt-get install festlex-cmu
$ cd /usr/share/festival/voices/english/
$ sudo wget -c http://www.speech.cs.cmu.edu/cmu_arctic/packed/cmu_us_clb_arctic-0.95-release.tar.bz2
$ sudo wget -c http://www.speech.cs.cmu.edu/cmu_arctic/packed/cmu_us_bdl_arctic-0.95-release.tar.bz2
$ sudo tar jxf cmu_us_clb_arctic-0.95-release.tar.bz2
$ sudo tar jxf cmu_us_bdl_arctic-0.95-release.tar.bz2
$ sudo rm cmu_us_clb_arctic-0.95-release.tar.bz2
$ sudo rm cmu_us_bdl_arctic-0.95-release.tar.bz2
$ sudo ln -s cmu_us_clb_arctic cmu_us_clb_arctic_clunits
$ sudo ln -s cmu_us_bdl_arctic cmu_us_bdl_arctic_clunits

You can test these two voices like this:

$ rosrun sound_play say.py "I am speaking with a female C M U voice" voice_cmu_us_clb_arctic_clunits
$ rosrun sound_play say.py "I am speaking with a male C M U voice" voice_cmu_us_bdl_arctic_clunits

NOTE: If you don't hear thephrase on the first try, try repeating the command.  Also,remember that a sound_play node must already be running in anotherterminal.

You can also use sound_play to play wave files or a number of built-insounds.  To play the R2D2 wave file in the pi_speech_tutorialsounds directory, use the command:唧唧哇哇的声音

$ rosrun sound_play play.py `rospack find pi_speech_tutorial`/sounds/R2D2a.wav

Note that the  play.py script requiresthe absolute path to the wave file which is why we used 'rospackfind'.  You could also just type out the full path name.

To hear one of the built-in sounds, use the  playbuiltin.py script together with a number from 1 to 5; for example://汽笛声

$ rosrun sound_play playbuiltin.py 4


Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐