5 Replies - 349 Views - Last Post: 28 September 2012 - 12:18 PM Rate Topic: -----

#1 Fraysa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-September 12

Question || If in the next 10 seconds x is recognized.. Speech reco.

Posted 27 September 2012 - 10:38 PM

Hi all.

I created a basic speech recognition program, but I want to make it so once it recognizes the word "Apple", it will enter a mode where
if in the next 10 seconds a certain command is recognized - like "internet" or "log off" - it will do that command, otherwise
after the 10 seconds it will stop this mode and back to the normal mode where it only recognizes the word apple.


This is a piece of my code (Googling examples for speech recognition

Private Sub OnRecognition(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechRecognitionType, ByVal Result As ISpeechRecoResult) Handles RecoContext.Recognition
        Dim strText As String
        strText = Result.PhraseInfo.GetText
        Select Case strText
              Case "Apple"
                     [B][In the next 10 seconds, Check for other commands][/B]
                            (case "internet")
                                  Process.Start("http://www.google.com/")
                     [B][After 10 seconds are over, exit this 'check'][/B]



I tried everything, I'm a newbie, so I have no idea how to do that.

Is This A Good Question/Topic? 0
  • +

Replies To: Question || If in the next 10 seconds x is recognized.. Speech reco.

#2 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Question || If in the next 10 seconds x is recognized.. Speech reco.

Posted 28 September 2012 - 12:51 AM

Why don't you post what you have tried, and we can guide you.

Quote

I tried everything...
Such topics tend to be a "Gimme Teh Codez" like.

Anyway: you can add something like Enum with primaryCommand, secondaryCommand,... and modify RecoContext.Recognition event (or write a new one) to pass the command state type to OnRecognition method that will respond according to that in Select Case statement. Than you need a timer to switch this states...
Was This Post Helpful? 0
  • +
  • -

#3 Fraysa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-September 12

Re: Question || If in the next 10 seconds x is recognized.. Speech reco.

Posted 28 September 2012 - 03:23 AM

I tried everything means from my knowledge - which is not enough, I'm just a newbie. I tried googling help, asking, but no avail. I'm not asking for giving me the code, I'm against it as well - after all, I'm here to learn, I just need a little bit of help. From what you said - I didn't understand a lot.
Was This Post Helpful? 0
  • +
  • -

#4 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Question || If in the next 10 seconds x is recognized.. Speech reco.

Posted 28 September 2012 - 04:37 AM

OK, but will you be so kind to actually show some of your tries to solve the problem? If anyone is to help you, he/she has to have some basic understanding of where you are with your knowledge and understanding, to be able to help you, so you can follow his/hers advice. As you noticed, there is no point in writing something like I did in my previous post, just to find out that someone (I'm not saying that for you, because I don't know), that one doesn't understand how to rise events, create and use enumerations,...
There's no point in explaining how to make a lasagna, if you never cooked an egg for example (I'm trying to make a more real world example comparison).
Was This Post Helpful? 0
  • +
  • -

#5 Fraysa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-September 12

Re: Question || If in the next 10 seconds x is recognized.. Speech reco.

Posted 28 September 2012 - 10:38 AM

Well, I did it by making a variable called "canActivate", which is set to false. WHen I detect the word apple, canActivate = true, and I turn timer1 on which as 10,000 interval. When the timer is working canActivate works, which means that you can check after the word apple is said. when it ticks, I turn it off and turn canActivate off as well.
Was This Post Helpful? 0
  • +
  • -

#6 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Question || If in the next 10 seconds x is recognized.. Speech reco.

Posted 28 September 2012 - 12:18 PM

This is pseudo-code (kind of):

Public canActivate = False

Sub OnRecognition()
strText = Result.ToString()

Select Case strText
Case "Apple"
... do something
canActivate = True
myTimer.Start()
Case "Orange"
... do something else
canActivate = True
myTimer.Start()
.
.
.
End Select


If canActivate = True Then
Select Case strText
Case "Internet"
... go to the internet
Case "Log Off"
... cook something
.
.
.
End Select
End If
End Sub


Sub myTimer_Tick() Handles myTimer.Tick
canActivate = False
myTimer.Stop()
End Sub



Something like this will work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1