Linux操作系统下portaudio+espeak 安装及C++测试
(2014-06-07 21:16:03)
标签:
itlinuxespeak |
分类: ROS |
espeak 语言安装教程路径:http://www.eguidedog.net/doc_espeak.php
一、下载espeak:下载网址http://espeak.sourceforge.net/test/latest.html
二、解压软件包:
$unzip package-name
(一般下载在当前工作目录下的Downloads目录下)
三、安装
由于软件没有安装文件,一种方法是需要自己手动建立符号链接:
$sudo ln -s /espeak-data /usr/share/espeak-data
$sudo ln -s /speak /usr/bin/espeak
说明:是指espeak解压后所在路径
另一种方法是 打开解压文件目录,转src目录下中 make 和make install
$ cd Downloads/espeak/src
$ make
$ make install
在make的时候一般都会报错如下:(因为没有安装portaudio,所以先安装portaudio)
/usr/lib/gcc/i586-suse-linux/4.5/../../../../i586-suse-linux/bin/ld: cannot find -lportaudio
collect2: ld returned 1 exit status
四、portaudio 安装
下载地址:http://www.portaudio.com/download.html
最好是下载V18版本pa_snapshot_v18.tgz ,因为V19版本过高,需要兼容,设置起来比较麻烦。
portaudio 下载包一般下载在tmp目录下,所以:
$ cd tmp/
$tar xvf pa_snapshot_v18.tgz
$ cd portaudio
$ ./configure -prefix=/usr
$ make
$sudo make install (注意权限问题)。
回到 espeak src make make install 就可以了。
五、测试
$espeak "hello world“
$espeak -vzh "什么”
六 espeak C++ 测试
代码:
#include < espeak/speak_lib.h > //
包括espeak的头文件
#include < string.h >
#include < unistd.h >
int main(int argc, char **argv)
{
char word[]
= "保持这个姿势, 我很快就来...";
espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, NULL,
0); //
初始化
espeak_SetVoiceByName("zh+f2");
// 设置音源为中文女声
espeak_Synth(word, strlen(word) + 1, 0, POS_CHARACTER, 0,
espeakCHARS_UTF8, NULL,
NULL);
// 发音
sleep(3);
// 等一段时间,否则程序会立即退出,听不到发音
espeak_Terminate(); // 回收资源
}
七、编译:
$ g++ test.c -o test -lespeak
$./test
博客地址是:http://blog.sina.com.cn/u/3285404150
一、下载espeak:下载网址http://espeak.sourceforge.net/test/latest.html
二、解压软件包:
三、安装
在make的时候一般都会报错如下:(因为没有安装portaudio,所以先安装portaudio)
/usr/lib/gcc/i586-suse-linux/4.5/../../../../i586-suse-linux/bin/ld: cannot find -lportaudio
collect2: ld returned 1 exit status
四、portaudio 安装
下载地址:http://www.portaudio.com/download.html
最好是下载V18版本pa_snapshot_v18.tgz ,因为V19版本过高,需要兼容,设置起来比较麻烦。
$ cd tmp/
$tar xvf pa_snapshot_v18.tgz
$ cd portaudio
$ ./configure -prefix=/usr
$ make
$sudo make install
回到 espeak
五、测试
$espeak "hello world“
$espeak -vzh "什么”
六 espeak
代码:
#include < espeak/speak_lib.h >
#include < string.h >
#include < unistd.h >
int main(int argc, char **argv)
{
}
七、编译:
$ g++ test.c -o test -lespeak
$./test
----------------------------------------------------------------
欢迎大家转载我的文章。
转载请注明:转自听雨轩_Mrfu博客地址是:http://blog.sina.com.cn/u/3285404150

加载中…