gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 05:38:19 25 4
gpt4 key购买 nike

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

我喜欢在 Ubuntu 操作系统内的 C/C++ 代码中使用 espeak。

最佳答案

你不使用espeak“像aplay”,你在同一个命令中一起使用它们。

我相信您可以通过这种方式使用espeak,但您使用的语法不正确。

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

阅读引用的单词: system("espeak --stdout '要说的话' | 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);

关于c++ - 是否可以在系统 "espeak"中使用 ("");功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50197069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com