-3

Is it possible to use espeak in system(""); function like system("aplay 1.wav") for example?

I like to use espeak in my C/C++ code inside Ubuntu OS.

Hasani
  • 3,543
  • 14
  • 65
  • 125

1 Answers1

2

You don’t use espeak “like aplay”, you use them together in the same command.

I believe you can use espeak in this way, but the syntax you use is incorrect.

You didn’t specify how you wanted to use espeak, but here are a couple options.

Read quoted words: system("espeak --stdout 'words to speak' | aplay")

Read from text document: system("espeak --stdout -t mydocument.txt | aplay")

espeak reference page link

In the comments of your post you said you wanted to use the command system("espeak answer"). Assuming answer is a string variable you can try this:

#include <string>

string answer, command;

command = "espeak --stdout '" + answer + "' | aplay";
system(command.c_str);
PR06GR4MM3R
  • 397
  • 2
  • 13