Introduction
After some play on system's speech library "System.Speech" we can control some
system application and locking through speech with minimize modulation or
without any pre voice recording.
Concept behind the approach
Here we mainly concentrate on "SpeechRecognitionEngine" and "GrammarBuilder".
Normally this engine would recognize the word only when we pronounce the word
with correct modulation. So we have to pronounce the word with accurate
modulation. So here we have avoid this by a simple logic that try to match the
result value. So it avoid some voice modulation problem in a better way.
C# code behind the approach
using System.Speech.Recognition;
using System.Speech.Synthesis;
[DllImport("user32")]
public static extern void LockWorkStation();
private SpeechRecognitionEngine recognizer;
private void initialization()
{
// Create grammar that makes a sentence as required
GrammarBuilder grammarBuilder = new GrammarBuilder();
grammarBuilder.Append(new Choices("system"));
grammarBuilder.Append(new Choices("shutdown", "restart", "lock"));
// Create a instance of SpeechRecognitionEngine
recognizer = new SpeechRecognitionEngine();
recognizer.RequestRecognizerUpdate();
//Load grammar in SpeechRecognitionEngine
recognizer.LoadGrammar(new Grammar(grammarBuilder));
//Hook SpeechRecognized, for words detected with correct modulation
recognizer.SpeechRecognized += _recognizer_SpeechRecognized;
//Hook SpeechRecognized, for words detected with incorrect modulation

Vasanth KrishnanPosted Feb 18, 2014, 4:22 AM
hi selva, this is really amazing. Good work...