How to make seperate choices, one for google search, one for youtube search, one for opening things, and one for random conversation. I have this so far.
public partial class Form1 : Form
{
SpeechRecognitionEngine _recognizer = new SpeechRecognitionEngine();
SpeechSynthesizer JARVIS = new SpeechSynthesizer();
string QEvent;
public Form1()
{
InitializeComponent();
_recognizer.SetInputToDefaultAudioDevice();
Choices services = new Choices(new string[] { "restaurants", "hotels", "gas stations" });
Choices cities = new Choices(new string[] { "Seattle", "Boston", "Dallas", "Paris", "London", "Los Angeles", "New York" });
GrammarBuilder findServices = new GrammarBuilder("Find");
findServices.Append(services);
findServices.Append("near");
findServices.Append(cities);
findServices.Append("in");
// Create a Grammar object from the GrammarBuilder and load it to the recognizer.
Grammar servicesGrammar = new Grammar(findServices);
_recognizer.LoadGrammarAsync(servicesGrammar);
_recognizer.SpeechRecognized +=
new EventHandler<SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized);
// Configure the input to the speech recognizer.
_recognizer.SetInputToDefaultAudioDevice();
// Start asynchronous, continuous speech recognition.
_recognizer.RecognizeAsync(RecognizeMode.Multiple);
}
void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
JARVIS.Speak("Searching for" + e.Result.Text);
Process.Start("http://google.com/search?q=" + e.Result.Text);
}
but I want, when I say "Find hotels near Dallas" I don't want it to open Youtube and other way around. So when I say the title of the song it will open youtube, when i search it will open google and when I say something (to the program) it will responde
back. How to make that because for far I only got how to open google search!?