Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27422

VS 2010 speech recognition

$
0
0
Hi

I'm creating a voice control program and this is the first speech recognition program I have made. I have a problem in that if the user says "Jarvis what is (X)" then the program will run system.diagnostics.process.start ("http://www.google.com/(X). I know how to do all this normally but when it comes to voice control I don't know how to make the variable (X) be the search term . The code is something like this

case is = "JARVIS WHAT IS (X)
jarvis.speak "checking now sir"
system.diagnostics.process.start (http://www.google.com/(X)
jarvis.speak "here we are sir"


so my question is how do I make the search term be what is spoken. the proram is able to recognise speech aswell, here are the first few lines

Imports System.Speech.Recognition
Imports System.Speech.Recognition.SrgsGrammar
Imports System.Runtime.InteropServices 'For Monitor Command
Imports System.IO
Imports System.Reflection


Public Class Form1
'This object represents the Speech recognition engine
Private recognizer As SpeechRecognizer
Dim QuestionEvent As String
Dim Jarvis = CreateObject("Sapi.spvoice")


Public Sub New()


InitializeComponent() ' This call is required by the Windows Form Designer.


recognizer = New SpeechRecognizer() ' Add any initialization after the InitializeComponent() call.


AddHandler recognizer.SpeechDetected, AddressOf recognizer_SpeechDetected 'this event is raised when the user begins to speak


AddHandler recognizer.SpeechRecognitionRejected, AddressOf recognizer_SpeechRecognitionRejected 'this is raised when spoken words are not recognized as compliant to our grammar rules


AddHandler recognizer.SpeechRecognized, AddressOf recognizer_SpeechRecognized 'this is raised when the application correctly recognizes spoken words


Dim grammar As New GrammarBuilder()
grammar.Append(New Choices(System.IO.File.ReadAllLines("C:\Documents and Settings\IT\My Documents\Commands_txt.txt")))


recognizer.LoadGrammar(New Grammar(grammar))

Viewing all articles
Browse latest Browse all 27422

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>