0

我正在尝试使用 Festival TTS 来运行 g++ 上给出的示例(我使用的是安装了 Ubuntu 的虚拟机),但我得到的不是声音,而是尖锐的声音。我编辑了 /usr/share/festival/festival.scm 并放在最后:

(Parameter.set 'Audio_Required_Format 'aiff)
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Command "paplay $FILE --client-name=Festival --stream-name=Speech")

这是示例脚本:

#include <stdio.h>
#include <festival/festival.h>
int main(int argc, char **argv)
{
    EST_Wave wave;
    int heap_size = 210000;  // default scheme heap size
    int load_init_files = 1; // we want the festival init files loaded

    festival_initialize(load_init_files,heap_size);

    // Say simple file
    // festival_say_file("/etc/motd");
    festival_say_file("testo.txt");
    festival_eval_command("(voice_ked_diphone)");
    // Say some text;
    festival_say_text("hello world");

    // Convert to a waveform
    festival_text_to_wave("hello world",wave);
    wave.save("/tmp/wave.wav","riff");

    // festival_say_file puts the system in async mode so we better
    // wait for the spooler to reach the last waveform before exiting
    // This isn't necessary if only festival_say_text is being used (and
    // your own wave playing stuff)
    festival_wait_for_spooler();

    return 0;
}

我从终端编译他没有问题,使用:

 g++ hello.cpp -I/usr/include/festival -I/usr/include/speech_tools -I/usr/include/boost -lFestival -lestools -lestbase -leststring -lncurses

但是当我./a.out从终端运行输出时,我得到的只是刺耳的声音。我尝试直接在终端上使用 Festival,它工作正常,但我无法通过脚本使其工作。

4

0 回答 0