-2

是否可以espeaksystem("");功能中使用system("aplay 1.wav")例如?

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

4

1 回答 1

3

您不使用espeak“like aplay”,而是在同一个命令中将它们一起使用。

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

您没有指定要如何使用espeak,但这里有几个选项。

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

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

espeak参考页面链接

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

#include <string>

string answer, command;

command = "espeak --stdout '" + answer + "' | aplay";
system(command.c_str);
于 2018-05-06T11:42:10.733 回答