コード例 #1
0
ファイル: main.cpp プロジェクト: Aries3D/ProjectAries
std::string decode()
{
  std::string er = "error";

	std::string fileLoc = "audio.raw"; 	//this is the location of the file we will be comparing against our langauge model

	std::string outputString;  //holds the decoded string

	if(listen.init()>0)
	{
		std::cerr<<"error on init"<<std::endl;
		return er;
	}
  
  listen.setKeyphrase();

  std::string keyword;

  while(keyword != "aries")
  {
    audio.recordAudio(2000000);
    keyword = listen.rawToString(fileLoc.c_str());
    remove ("audio.raw");
  }

  listen.unsetKeyphrase();

  audio.playback("sounds/beep.wav");

  audio.recordAudio(4000000);
  outputString = listen.rawToString(fileLoc.c_str());   //process the .raw file and store the string
  remove ("audio.raw");

  return outputString;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: Aries3D/ProjectAries
int main()
{
  std::string outputString;
  std::string speakString;

  audio.playback("sounds/beep.wav");

  while(outputString != "shutdown")
  {
   outputString = decode(); 

   if(outputString == "explain") audio.festival("I am a beta version of a software engine that is meant to add voice functionality to other code. My advantage over siri and other such programs is that I specialize in specific vocabulary. This makes me fast, accurate and moduler.");

   else if(outputString != "shutdown") 
    {
      speakString = action(outputString);

      audio.festival(speakString);
    }
  }

  audio.festival("Thank you, and goodbye");

	/*
	 *  The above sequance is very basic and linear. Ideas to increase the responsiveness of the program
	 *  is to create a thread that is always checking for new raw files and creates new threads appropriately
	 *  to carry out the various commands.
	 *
	 *  Also to minimize processor usage, have the device enter a "sleep mode" during times of low use, such as
	 *  during sleeping or school hours, or have it only begin recording after a specific gesture, "ok".
   *
	 */


	return 0;
}