是否可以使用" espeak"在系统中("");功能?

时间:2018-05-06 06:59:47

标签: c++ linux function system espeak

是否可以在espeak函数中使用system("");,例如system("aplay 1.wav")

我喜欢在Ubuntu OS中的C / C ++代码中使用espeak。

1 个答案:

答案 0 :(得分:3)

您不使用espeakaplay”,您可以在同一命令中一起使用它们。

我相信您可以这样使用espeak,但您使用的语法不正确。

您没有指定使用espeak的方式,但这里有几个选项。

阅读引用的字词: system("espeak --stdout 'words to speak' | aplay")

从文本文档中读取: system("espeak --stdout -t mydocument.txt | aplay")

espeak reference page link

在您的帖子的评论中,您说您想使用命令system("espeak answer")。假设answer是一个字符串变量,你可以试试这个:

#include <string>

string answer, command;

command = "espeak --stdout '" + answer + "' | aplay";
system(command.c_str);
相关问题