Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Kiect SDK V1.8 C# 2010...I have to do a code that will listen to my voice and pr

ID: 654373 • Letter: K

Question

Kiect SDK V1.8 C# 2010...I have to do a code that will listen to my voice and press a specific key. I got the code for that correct now i need to do the same thing but using hand gestures..Please help.. I am getting the folowing errors........


Error   5   The name 'isMoveLeftGestureActive' does not exist in the current context   
Error   6   The name 'isMoveLeftGestureActive' does not exist in the current context   
Error   7   The name 'isMoveLeftGestureActive' does not exist in the current context   
Error   1   The name 'isMoveRightGestureActive' does not exist in the current context
Error   2   The name 'isMoveRightGestureActive' does not exist in the current context   
Error   3   The name 'isMoveRightGestureActive' does not exist in the current context
Error   8   The name 'isStopGestureActive' does not exist in the current context   
Error   9   The name 'isStopGestureActive' does not exist in the current context

namespace Speech using System; using System. IO using System.Linq; using System. Threading: using Microsoft.Kinect; using Microsoft.Speech.AudioFormat; using Microsoft.Speech.Recognition; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Diagnostics; public class Program public static void Main(string[] args) // obtain a KinectSensor if any are available KinectSensor sensor = (from sensorToCheck in KinectSensor.KinectSensors where sensorToCheck·Status-KinectStatus .connected select sensorToCheck) . FirstorDefault(); if (sensor null) Console.WriteLine( No Kinect sensors are attached to this computer or none of the ones that areln"+ "attached are "Connected". In"+ "Attach the KinectSensor and restart this application.In"+ Make sure the Power Adapter of the Kinect sensor is plugged in In"+ "Press any key to continue. "); // Give a chance for user to see console output before it is dismissed Console.ReadKey(true); return; } // end if (sensor == null) sensor.Start(); // Obtain the KinectAudioSource to do audio capture KinectAudioSource source = sensor . AudioSource; source. EchoCancellationMode = EchoCancellationMode.None; // No AEC for this sample source . AutomaticGainContro!Enabled false; // Important to turn this off for speech recognition

Explanation / Answer

Actually this is part of speech recognition system, i think it will help you using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Speech.Recognition; using System.Speech.Synthesis; using System.IO; using System.Xml; namespace J.A.R.V.I.S { public partial class Form1 : Form { SpeechRecognitionEngine _recognizer = new SpeechRecognitionEngine(); SpeechSynthesizer JARVIS = new SpeechSynthesizer(); string QEvent; string ProcWindow; double timer = 10; int count = 1; Random rnd = new Random(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { _recognizer.SetInputToDefaultAudioDevice(); _recognizer.LoadGrammar(new DictationGrammar()); _recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(File.ReadAllLines(@"C:UserschayeDocumentsCommands.txt"))))); _recognizer.SpeechRecognized += new EventHandler(_recognizer_SpeechRecognized); _recognizer.RecognizeAsync(RecognizeMode.Multiple); } void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { int ranNum = rnd.Next(1, 10); string speech = e.Result.Text; switch (speech) { //GREETINGS case "hello": case "hello jarvis": if (ranNum < 6) { JARVIS.Speak("Hello sir"); } else if (ranNum > 5) { JARVIS.Speak("Hi"); } break; case "goodbye": case "goodbye jarvis": case "close": case "close jarvis": JARVIS.Speak("Until next time"); Close(); break; case "jarvis": if (ranNum < 5) { QEvent = ""; JARVIS.Speak("Yes sir"); } else if (ranNum > 4) { QEvent = ""; JARVIS.Speak("Yes?"); } break; //WEBSITES case "open youtube": System.Diagnostics.Process.Start("http://www.youtube.com"); break; case "open google": System.Diagnostics.Process.Start("http://www.google.com"); break; //SHELL COMMANDS case "open program": System.Diagnostics.Process.Start("file location"); JARVIS.Speak("Loading"); break; case "open Word": System.Diagnostics.Process.Start(@"C:Program FilesMicrosoft OfficeOffice15WINWORD.EXE"); JARVIS.Speak("Loading"); break; //CLOSE PROGRAMS case "close program": ProcWindow = "process name"; StopWindow(); break; case "close Skype": ProcWindow = "Skype"; StopWindow(); break; //CONDITION OF DAY case "what time is it": DateTime now = DateTime.Now; string time = now.GetDateTimeFormats('t')[0]; JARVIS.Speak(time); break; case "what day is it": JARVIS.Speak(DateTime.Today.ToString("dddd")); break; case "whats the date": case "whats todays date": JARVIS.Speak(DateTime.Today.ToString("dd-MM-yyyy")); break; //OTHER COMMANDS case "go fullscreen": FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; TopMost = true; JARVIS.Speak("expanding"); break; case "exit fullscreen": FormBorderStyle = FormBorderStyle.Sizable; WindowState = FormWindowState.Normal; TopMost = false; break; case "switch window": SendKeys.Send("%{TAB " + count + "}"); count += 1; break; case "reset": count = 1; timer = 11; lblTimer.Visible = false; ShutdownTimer.Enabled = false; lstCommands.Visible = false; break; case "out of the way": if (WindowState == FormWindowState.Normal || WindowState == FormWindowState.Maximized) { WindowState = FormWindowState.Minimized; JARVIS.Speak("My apologies"); } break; case "come back": if (WindowState == FormWindowState.Minimized) { JARVIS.Speak("Alright?"); WindowState = FormWindowState.Normal; } break; case "show commands": string[] commands = (File.ReadAllLines(@"txt file location")); JARVIS.Speak("Very well"); lstCommands.Items.Clear(); lstCommands.SelectionMode = SelectionMode.None; lstCommands.Visible = true; foreach (string command in commands) { lstCommands.Items.Add(command); } break; case "hide listbox": lstCommands.Visible = false; break; //SHUTDOWN RESTART LOG OFF case "shutdown": if (ShutdownTimer.Enabled == false) { QEvent = "shutdown"; JARVIS.Speak("I will shutdown shortly"); lblTimer.Visible = true; ShutdownTimer.Enabled = true; } break; case "log off": if (ShutdownTimer.Enabled == false) { QEvent = "logoff"; JARVIS.Speak("Logging off"); lblTimer.Visible = true; ShutdownTimer.Enabled = true; } break; case "restart": if (ShutdownTimer.Enabled == false) { QEvent = "restart"; JARVIS.Speak("I'll be back shortly"); lblTimer.Visible = true; ShutdownTimer.Enabled = true; } break; case "abort": if (ShutdownTimer.Enabled == true) { QEvent = "abort"; } break; case "speed up": if (ShutdownTimer.Enabled == true) { ShutdownTimer.Interval = ShutdownTimer.Interval / 10; } break; case "slow down": if (ShutdownTimer.Enabled == true) { ShutdownTimer.Interval = ShutdownTimer.Interval * 10; } break; } } private void ShutdownTimer_Tick(object sender, EventArgs e) { if (timer == 0) { lblTimer.Visible = false; ComputerTermination(); ShutdownTimer.Enabled = false; } else if (QEvent == "abort") { timer = 10; lblTimer.Visible = false; ShutdownTimer.Enabled = false; } else { timer = timer - .01; lblTimer.Text = timer.ToString(); } } private void ComputerTermination() { switch (QEvent) { case "shutdown": System.Diagnostics.Process.Start("shutdown", "-s"); break; case "logoff": System.Diagnostics.Process.Start("shutdown", "-l"); break; case "restart": System.Diagnostics.Process.Start("shutdown", "-r"); break; } } private void StopWindow() { System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName(ProcWindow); foreach (System.Diagnostics.Process proc in procs) { proc.CloseMainWindow(); } } } }