zoukankan      html  css  js  c++  java
  • 开源语音代码eSpeak1.06 的学习入门

     

    1. 前文介绍eSpeak是c语言写的一个小型的、开放源码的语音合成系统,支持多种语言,这里包括汉语。

    2. 在哪下载代码  http://espeak.sourceforge.net/download.html,选择第一个,还是RISC 的?第一个吧

     

     

    3. 解压到ubuntu 里面,看下代码,似乎是运行这里的,试着编译下

     

     

     

    4. 看下工程的 readme 文件讲的什么

    src目录里面  makefile 文件编译之后生成3个文件

    1.“libspeak.so.1.xx”(其中xx是版本号)这是一个包含文本到语音引擎的共享库。文件“speaku bin.h”中描述了它的API。

    2.“espeak”二进制。这是一个小的命令行程序libespeak库。不理解

    3.“speak”二进制。这是一个命令行程序,其中包含文本到语音引擎。它不使用libespeak库。

    这个工程音频用的Portaudio 接口库,是一个音频库,可以支持linux,windows7。看意思是需要本电脑也有Portaudio的底层支持。

    如果只生成 wav文件,不需要发声 ,注释掉speech.h中的以下行  #define  USE_PORTAUDIO

     

    5. 进入src目录,直接 make ,报错

    <pre><b>tr_languages.cpp:201:43:</b> <font color="#EF2929"><b>error: </b></font>narrowing conversion of ‘<b>194</b>’ from 
    ‘<b>int</b>’ to ‘<b>char</b>’ inside { } [<font color="#EF2929"><b>-Wnarrowing</b></font>] const char string_ordinal[] = {0xc2,0xba,0<font color="#EF2929"><b>}</b></font>; // masculine ordinal character, UTF-8 <font color="#EF2929"><b>^</b></font> <b>tr_languages.cpp:201:43:</b> <font color="#EF2929"><b>error: </b></font>narrowing conversion of ‘<b>186</b>’ from
    <b>int</b>’ to ‘<b>char</b>’ inside { } [<font color="#EF2929"><b>-Wnarrowing</b></font>] Makefile:102: recipe for target &apos;tr_languages.o&apos; failed make: *** [tr_languages.o] Error 1 </pre>

    只能修改文件 char 改成 ubsigned char

    const unsigned char string_ordinal[] = {0xc2,0xba,0};  // masculine ordinal character, UTF-8

     

    6. 继续报错

    /usr/bin/ld: cannot find -lportaudio

    安装portaudio 这个语音库,下载地址

     http://files.portaudio.com/download.html

    解压:tar zxvf pa_stable_v19_20140130.tgz

    配置 ./configure

    编译 make 

    安装 make install

    7. 再进入src编译

    继续报错

    wavegen.o: In function `WavegenOpenSound() [clone .part.2]':
    wavegen.cpp:(.text+0x26e): undefined reference to `Pa_StreamActive'
    wavegen.o: In function `WavegenCloseSound()':
    wavegen.cpp:(.text+0x5a1): undefined reference to `Pa_StreamActive'
    collect2: error: ld returned 1 exit status
    Makefile:105: recipe for target 'speak' failed
    make: *** [speak] Error 1

    解决办法

    cp portaudio19.h portaudio.h
    make clean
    make

     

    8. 问题解决,编译通过,试着运行一下 espeak hello result -w result1.wav,报错

    root@qhq-virtual-machine:/home/qhq/tts/espeak-1.48.04-source/src# espeak  hello -w hello.wav
    espeak: error while loading shared libraries: libportaudio.so.2: cannot open shared object file: No such file or directory

    解决办法

    cd /etc/ld.so.conf.d
    vim localusr.conf
    # 输入内容  /usr/local/lib/
    ldconfig

    9. 运行,实际测试只能播放一个单词,两个单词的话只能播放一个。

    10.  espeak是语音合成工具。mbrola是语音文件。从text到phoneme转换由espeak完成。而从音素到sound由mbrola完成。

     sync  和 ASYNC 什么区别?

     

  • 相关阅读:
    Do the “StreamWriter.WriteLine()” function need to “lock()”?
    SQL Server Integration Services C#脚本任务示例 先看前二部分
    使用SSIS脚本任务触发事件,执行T-SQL命令并运行SMO 第二部分
    Getting started with the SSIS Script Task 第一部分
    对SQL Server的监控和报告
    在Visual Studio 2019中安装SQL Server Integration Services
    .Net ObjectContext.CreateQuery<T>(String, ObjectParameter[]) Method
    使用Redgate的SQL Monitor优化SQL Server资产监视
    将多行汇总为SQL Server数据的一行和一列
    用于SQL源的Power BI增量刷新
  • 原文地址:https://www.cnblogs.com/429512065qhq/p/14809997.html
Copyright © 2011-2022 走看看