是否可以espeak
在system("");
功能中使用system("aplay 1.wav")
例如?
我喜欢在 Ubuntu OS 中的 C/C++ 代码中使用 espeak。
您不使用espeak
“like aplay
”,而是在同一个命令中将它们一起使用。
我相信你可以espeak
这样使用,但是你使用的语法不正确。
您没有指定要如何使用espeak
,但这里有几个选项。
阅读引用的单词: system("espeak --stdout 'words to speak' | aplay")
从文本文档中读取: system("espeak --stdout -t mydocument.txt | aplay")
在您帖子的评论中,您说您想使用 command system("espeak answer")
。假设answer
是一个字符串变量,你可以试试这个:
#include <string>
string answer, command;
command = "espeak --stdout '" + answer + "' | aplay";
system(command.c_str);