在ROS中使用中文语音交互(百度语音baidu_speech)

目前,ROS可以用的中文语音工具还是有一些的,功能也越来越丰富,但有一些有使用的限制,有一些用起来不是很方便。

这里以百度语音为例具体说明,参考链接如下:

1 http://wiki.ros.org/baidu_speech

2 https://github.com/DinnerHowe/baidu_speech

----

1. 概述

使用百度语音API实现语音识别和TTS的功能包,可以修改或自定义参数的示例代码。在开始本教程之前需要保证安装完成两个必须的Python库pyaudiopython-vlc。这个功能包提供了在ROS中使用百度语音的解决方案,可以同时应用于英语、汉语普通话和粤语,经过多台配置电脑的测试,包括indigo和kinetic,thinkpad、acer等。

注意:

$ sudo apt-get install python-pip portaudio19-dev vlc libvlc-dev

$ sudo pip install pyaudio

$ sudo pip install python-vlc

----

2. 软硬件需求

可以运行ROS的笔记本或硬件设备,麦克风和扬声器等并正确配置。

----

3. 功能包下载并编译

这个和之前所有ROS包非常类似。

relaybot@relaybot-desktop:~/Rob_Soft/Baidu_Speech$ catkin build

----------------------------------------------------------------------------
Profile:                     default
Extending:          [cached] /home/relaybot/catkin_ws/devel:/opt/ros/kinetic
Workspace:                   /home/relaybot/Rob_Soft/Baidu_Speech
----------------------------------------------------------------------------
Source Space:       [exists] /home/relaybot/Rob_Soft/Baidu_Speech/src
Log Space:          [exists] /home/relaybot/Rob_Soft/Baidu_Speech/logs
Build Space:        [exists] /home/relaybot/Rob_Soft/Baidu_Speech/build
Devel Space:        [exists] /home/relaybot/Rob_Soft/Baidu_Speech/devel
Install Space:      [unused] /home/relaybot/Rob_Soft/Baidu_Speech/install
DESTDIR:            [unused] None
----------------------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
----------------------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
----------------------------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
----------------------------------------------------------------------------
Workspace configuration appears valid.
----------------------------------------------------------------------------
[build] Found '1' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> baidu_speech                                                     
Finished  <<< baidu_speech                [ 0.5 seconds ]                      
[build] Summary: All 1 packages succeeded!                                     
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    None.                                                     
[build] Runtime: 0.5 seconds total. 

----

4. 功能包使用

relaybot@relaybot-desktop:~/Rob_Soft/Baidu_Speech$ roslaunch baidu_speech
simple_speaker.launch   simple_voice.launch     warning_speaker.launch

分别有三个示例launch:simple_speaker.launch,simple_voice.launch,warning_speaker.launch。

4.1. 文本发音-simple_speak

$ roslaunch baidu_speech simple_speaker.launch Gender:=man

参数等具体说明参考wiki,这里使用男声,运行过程如下。

在ROS中使用中文语音交互(百度语音baidu_speech)_第1张图片

----

4.2. 语音识别-simple_voice

$ roslaunch baidu_speech simple_voice.launch

在ROS中使用中文语音交互(百度语音baidu_speech)_第2张图片

----

发布、订阅主题以及详细的参数信息请参考wiki。当然还可以使用更多复杂应用,包括用中文语音控制机器人运动等,自行探索即可。


~End~

你可能感兴趣的:(课程-人机智能交互技术-,课程-智能机器人综合实践-)