JackBarn JackBarn - 10 months ago 107
C# Question

SpeechRecognition recognizes background noise as speech

I'm using MSDN's

in my program. The problem is that it recognizes background noise as speech.

For example, If snap my fingers, tap the table, or move my chair, it picks that up as speech.

Why in the world dose it recognize background noise as speech.

Me snapping my fingers dose not sound the same as me saying "Notepad"!!!

Here is the code

using System;
using System.Threading;
using System.Speech;
using System.Speech.Synthesis;
using System.Speech.Recognition;

namespace SpeachTest
public class MainClass
static void Main()
MainClass main = new MainClass();
SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));
Choices choiceList = new Choices();
choiceList.Add(new string[]{"Open", "Close", "Then", "Volume", "Up", "Firefox", "Notepad", "Steam","turn", "the", "now" } );

GrammarBuilder builder = new GrammarBuilder();
Grammar grammar = new Grammar(new GrammarBuilder(builder,0, 10) );

sre.SpeechRecognized += main.sreRecognizedEvent;
sre.SpeechDetected += main.sreDetectEvent;
sre.SpeechRecognitionRejected += main.sreRejectEvent;
sre.RecognizeCompleted += main.sreCompleteEvent;

sre.InitialSilenceTimeout = TimeSpan.FromSeconds(0);
sre.BabbleTimeout = TimeSpan.FromSeconds(0);
sre.EndSilenceTimeout = TimeSpan.FromSeconds(0);
sre.EndSilenceTimeoutAmbiguous = TimeSpan.FromSeconds(0);



void sreRecognizedEvent(Object sender, SpeechRecognizedEventArgs e){
Console.Write("Reconized ~ " + e.Result.Text + " ~ with confidence " + e.Result.Confidence);

void sreDetectEvent(Object sender, SpeechDetectedEventArgs e){
Console.WriteLine("Detected some type of input");

void sreRejectEvent(Object sender, SpeechRecognitionRejectedEventArgs e){
Console.WriteLine("Rejected Input ~ " + e.Result.Text) ;

void sreCompleteEvent(Object sender, System.Speech.Recognition.RecognizeCompletedEventArgs e){
Console.WriteLine("Completed Recongnization");


Answer Source

Turns out my microphone sensitivity was too high. very, very high to be exact. It was at 100, meaning that it would pick up the smallest sounds(such as background noise).

My guess is that those small sounds would be amplified to such a high degree that the SpeechRecognitionEngine would have difficulty differentiating it form actual speech.

Turning the sensitivity down to around 20 or 30 did the trick. enter image description hereA more appropriate sensitivity

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download