0

I am writing an interactive program in which it takes speech input from the user for a specific list of commands.

The list of commands will be stored locally in a graph and based on the usage their weight will be modified.

The speech input is taken and processed into text and then it's executed by bash scripts.

I am thinking what I should use to interact (synchronize) between the speech recognition engine and then the list and the bash program.

I am using C++ and Bash on a Unix system.

I thought of mutex but the problem is what if the user gives multiple inputs then I'll have to buffer it and then process it sequentially and that will make the system slower.

The bash script is used to call the system utility commands as requested by the user. Should I only use C++ or Bash too?

I am thinking of storing the graph in a binary format. Is this the best way to store the graph?

Please suggest alternatives.

2

You don't seem to picture the design of your system very clearly yet. So a bit of advice:

  • Make it as simple as possible.
  • Write down several scenarios of interaction between the user and your program. Be careful to include cases when the user changes his mind in the middle of saying a command, and other scenarios when things go wrong.
  • Don't proceed until you have a clear picture of interactions with the user, common special cases like the 'cancel word', etc.
  • Stay away from mutexes and other hairy stuff. (I'd advise to stay away from C++ too, but probably your speech engine has a C++ interface.)
  • If in doubt about concurrent access, use a database. It does all the locking for you, and is a well-tested piece of software. See SQLite for the simplest solution.
0

I hope I'm understanding the problem correctly, but one solution I've seen is to have the receiving program implemented as a local server, listening on a specific port (for security, have it only accept localhost connections). I don't think there would be much in the way of performance lag. This leaves the idea that someone might send voice commands from their smartphone (though, in all likelihood, this will stay on the local machine) The local-port system was one way that one of my college professors had several students work on individual parts of a problem using different languages of their choice (and certain parts could be run on different machines)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.