<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'sapi 5.1 in vb.net problem!! voice program' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'sapi 5.1 in vb.net problem!! voice program' posted on the 'VB.NET' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Wed, 23 May 2012 06:37:42 -0700</pubDate>
    <lastBuildDate>Wed, 23 May 2012 06:37:42 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>sapi 5.1 in vb.net problem!! voice program</title>
      <link>http://www.programmersheaven.com/mb/VBNET/408954/408954/sapi-51-in-vbnet-problem-voice-program/</link>
      <description>hello to everyone.. i having a problem with my program.. it seem like it wont detect a voice.. my program is all about ordering a food in the restaurant via voice commands.. i used notepad instead of xml.. can you help me?? thank you in very much.. your reply is very much appriciated..&lt;br /&gt;
&lt;br /&gt;
here's my code..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Public gmode As Integer&lt;br /&gt;
    Public gRestoreGrammar As Boolean&lt;br /&gt;
    Public additional As Boolean&lt;br /&gt;
&lt;br /&gt;
    Private Sub AxDirectSR1_PhraseFinish(ByVal flags As Long, ByVal beginhi As Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As String, ByVal results As Long)&lt;br /&gt;
        If (parsed = "") Then&lt;br /&gt;
            AxDirectSR1.Deactivate()&lt;br /&gt;
            If (Rnd() &amp;gt; 0.5) Then&lt;br /&gt;
                AxDirectSS1.Speak("kindly repeat your order again sir.")&lt;br /&gt;
            Else&lt;br /&gt;
                AxDirectSS1.Speak("please follow the menu.")&lt;br /&gt;
            End If&lt;br /&gt;
        Else&lt;br /&gt;
            If (parsed = "ok") Then&lt;br /&gt;
                AxDirectSR1.Deactivate()&lt;br /&gt;
                If (additional = False) Then&lt;br /&gt;
                    gmode = 2&lt;br /&gt;
                    AxDirectSS1.Speak("Would like to have drinks?")&lt;br /&gt;
&lt;br /&gt;
                Else&lt;br /&gt;
                    gmode = 3&lt;br /&gt;
                    AxDirectSS1.Speak("would that be all sir?")&lt;br /&gt;
                End If&lt;br /&gt;
            ElseIf (parsed = "cancel") Then&lt;br /&gt;
                Dim Item As String&lt;br /&gt;
                Item = ListBox1.Items.Count - 1&lt;br /&gt;
                If (Item &amp;gt;= 0) Then&lt;br /&gt;
                    ListBox1.Items.Remove(ListBox1.Items.Count - 1)&lt;br /&gt;
                    AxDirectSR1.Deactivate()&lt;br /&gt;
                    AxDirectSS1.Speak("your order cancel")&lt;br /&gt;
                End If&lt;br /&gt;
            ElseIf (parsed = "no") Then&lt;br /&gt;
                If (gmode = 2) Then&lt;br /&gt;
                    gmode = 3&lt;br /&gt;
                    additional = True&lt;br /&gt;
                    AxDirectSR1.Deactivate()&lt;br /&gt;
                    AxDirectSS1.Speak("verifying your order")&lt;br /&gt;
                ElseIf (gmode = 3) Then&lt;br /&gt;
                    gmode = 0&lt;br /&gt;
                    gRestoreGrammar = True&lt;br /&gt;
                    AxDirectSR1.Deactivate()&lt;br /&gt;
                    AxDirectSS1.Speak("you can continue your order")&lt;br /&gt;
                Else&lt;br /&gt;
                    gmode = 0&lt;br /&gt;
                    gRestoreGrammar = True&lt;br /&gt;
                End If&lt;br /&gt;
            ElseIf (parsed = "yes") Then&lt;br /&gt;
&lt;br /&gt;
                If (gmode = 2) Then&lt;br /&gt;
                    'form2.Show()&lt;br /&gt;
                    gmode = 3&lt;br /&gt;
                    AxDirectSR1.Deactivate()&lt;br /&gt;
                    AxDirectSS1.Speak("would that be all")&lt;br /&gt;
&lt;br /&gt;
                ElseIf (gmode = 3) Then&lt;br /&gt;
                    Dim total As Integer&lt;br /&gt;
                    total = 0&lt;br /&gt;
                    For i = 0 To ListBox1.Items.Count - 1&lt;br /&gt;
                        total = total + Val(ListBox1.Items(i))&lt;br /&gt;
                    Next i&lt;br /&gt;
                    ListBox1.Items.Add("---total is: $" + Format(total, "###0.00"))&lt;br /&gt;
                    gmode = 1&lt;br /&gt;
                    gRestoreGrammar = True&lt;br /&gt;
&lt;br /&gt;
                    AxDirectSR1.Deactivate()&lt;br /&gt;
&lt;br /&gt;
                    AxDirectSS1.Speak("Your total will be $" + Format(total, "###0.00") + " at the next window please.")&lt;br /&gt;
                End If&lt;br /&gt;
            Else&lt;br /&gt;
                AxDirectSR1.Deactivate()&lt;br /&gt;
                ListBox1.Items.Add(parsed)&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
&lt;br /&gt;
        ListBox1.SelectedIndex = ListBox1.Items.Count - 1&lt;br /&gt;
        AxDirectSS1.Speak(Phrase)&lt;br /&gt;
&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub DirectSS1_AudioStop(ByVal hi As Long, ByVal lo As Long)&lt;br /&gt;
        If (gmode = 1) Then&lt;br /&gt;
            ListBox1.Items.Clear()&lt;br /&gt;
            gmode = 0&lt;br /&gt;
            AxDirectSS1.Speak("Hi! May I take your order?")&lt;br /&gt;
        Else&lt;br /&gt;
            If (gmode = 2) Or (gmode = 3) Then&lt;br /&gt;
                'HighLightOrder (False)&lt;br /&gt;
                AxDirectSR1.GrammarFromFile("C:\Documents and Settings\kaex21\My Documents\Visual Studio 2008\Projects\Project1\WindowsApplication6\Windows
Application6\yesno.txt")&lt;br /&gt;
&lt;br /&gt;
            ElseIf (gRestoreGrammar) Then&lt;br /&gt;
                'HighLightOrder (True)&lt;br /&gt;
                AxDirectSR1.GrammarFromFile("C:\Documents and Settings\kaex21\My Documents\Visual Studio 2008\Projects\Project1\WindowsApplication6\Windows
Application6\menu.txt")&lt;br /&gt;
                gRestoreGrammar = False&lt;br /&gt;
&lt;br /&gt;
            End If&lt;br /&gt;
            REM we had to turn off listening before talking, so now that we are done talking we&lt;br /&gt;
            REM should start listening again&lt;br /&gt;
            AxDirectSR1.Activate()&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
   &lt;br /&gt;
    Private Sub main_Terminate()&lt;br /&gt;
        AxDirectSR1.Deactivate()&lt;br /&gt;
    End Sub&lt;br /&gt;
  Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;
        gmode = 0&lt;br /&gt;
        gRestoreGrammar = False&lt;br /&gt;
&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick&lt;br /&gt;
        On Error GoTo GeneralFail&lt;br /&gt;
        REM we just use this function once, on the first callback, then the timer isn't needed anymore&lt;br /&gt;
        Timer1.Enabled = False&lt;br /&gt;
        Dim engine As String&lt;br /&gt;
        REM Initialize the recognizer. We want command and control, so find and select that engine (or best match)&lt;br /&gt;
        AxDirectSR1.Initialized = 1&lt;br /&gt;
&lt;br /&gt;
        engine = AxDirectSR1.Find("MfgName=Microsoft;Grammars=1")&lt;br /&gt;
        AxDirectSR1.Select(engine)&lt;br /&gt;
&lt;br /&gt;
        REM Burger.txt is our uncompiled grammar. Compile and load it now.&lt;br /&gt;
        'HighLightOrder(True)&lt;br /&gt;
        'AxDirectSR1.GrammarFromFile(app.path + "\menu.txt")&lt;br /&gt;
        AxDirectSR1.GrammarFromFile("C:\Documents and Settings\kaex21\My Documents\Visual Studio 2008\Projects\Project1\WindowsApplication6\Windows
Application6\menu.txt")&lt;br /&gt;
        REM Now load the synthesizer, find and select any female voice from microsoft&lt;br /&gt;
        Dim voice As String&lt;br /&gt;
        voice = AxDirectSS1.Find("MfgName=Microsoft;Gender=2")&lt;br /&gt;
        AxDirectSS1.Select(voice)&lt;br /&gt;
&lt;br /&gt;
        REM Start the voice interface...control goes to DirectSS1_AudioStop after this is said, gMode=0&lt;br /&gt;
        AxDirectSS1.Speak("Welcome to kaex restaurant, sit back and enjoy as you take your order.")&lt;br /&gt;
&lt;br /&gt;
        REM sometimes the vb environment comes to front while we're loading, so take the screen back&lt;br /&gt;
        Me.Show()&lt;br /&gt;
        GoTo done&lt;br /&gt;
GeneralFail:&lt;br /&gt;
        MsgBox("Unable to start using text to speech or recognition.")&lt;br /&gt;
done:&lt;br /&gt;
    End Sub&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/408954/408954/sapi-51-in-vbnet-problem-voice-program/</guid>
      <pubDate>Sat, 07 Nov 2009 00:16:33 -0700</pubDate>
      <category>VB.NET</category>
    </item>
  </channel>
</rss>
