• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

vb.net microsoft voice platform help

Joined
Dec 22, 2007
Messages
184 (0.03/day)
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
writing an auto dication application using the microsoft voice platform 11 (Speech SDK): have a few questions on it. the application has a start and stop button which should start and stop the voice engine from listening.

Question 1: when I click the start button, the microsoft speech recognition UI pops up alongside the application - is there a way to keep this from happening and completely control the speech functionality through MY application?

Question 2: the start and stop buttons do not start and stop anything despite these line of code:
Code:
Grammar.DictationSetState(SpeechRuleState.SGDSActive)
and:
Code:
Grammar.DictationSetState(SpeechRuleState.SGDSInactive)

You still have to use the speech engine UI to start and stop listening, any idea on how to actually call it to start listenning through a vb.net button?

Full code is here:
Code:
Imports System
Imports System.Data
Imports System.Deployment
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Xml
Imports System.Speech
Imports SpeechLib

Public Class Form1
    Dim WithEvents RecoContext As SpSharedRecoContext
    Dim Grammar As ISpeechRecoGrammar
    Dim CharCount As Integer
    Dim var_TextInsetion As Boolean = True
    Dim var_ReadBack As Boolean = False

    Private Sub Button_Start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Start.Click
        If (RecoContext Is Nothing) Then
            RecoContext = New SpSharedRecoContext
            Grammar = RecoContext.CreateGrammar(1)
            Grammar.DictationLoad()
        End If
        Grammar.DictationSetState(SpeechRuleState.SGDSActive)
        Button_Start.Enabled = False
        Button_Stop.Enabled = True

    End Sub

    Private Sub Button_Stop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Stop.Click

        Grammar.DictationSetState(SpeechRuleState.SGDSInactive) 'Turns off the Recognition. It will go dormant.

        Button_Start.Enabled = True
        Button_Stop.Enabled = False
    End Sub

    Private Sub OnHypo(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal Result As ISpeechRecoResult) Handles RecoContext.Hypothesis
        Button_Stop.Enabled = False
        Label_Phrase.Text = "Dictating..."
    End Sub



    Private Sub OnReco(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechRecognitionType, ByVal Result As ISpeechRecoResult) Handles RecoContext.Recognition
        'create text string from recognized speech
        Dim recoResult As String = Result.PhraseInfo.GetText
        Label_Phrase.Text = recoResult & " "
        CharCount = CharCount + 1 + Len(recoResult)
        If var_TextInsetion = True Then
            SendKeys.Send(recoResult & " ")
        End If
        Button_Stop.Enabled = True
        If var_ReadBack = True Then
            If recoResult = "Backspace" Or recoResult.StartsWith("Select") Then
            Else
                Dim synth
                synth = CreateObject("SAPI.spvoice")
                synth.Speak(recoResult)
            End If
        End If
    End Sub


    Private Sub CheckBox_TextInsertion_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox_TextInsertion.CheckedChanged
        If CheckBox_TextInsertion.CheckState = CheckState.Checked Then
            var_TextInsetion = True
        Else
            var_TextInsetion = False
        End If
    End Sub

    Private Sub CheckBox_ReadBack_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox_ReadBack.CheckedChanged
        If CheckBox_ReadBack.CheckState = CheckState.Checked Then
            var_ReadBack = True
        Else
            var_ReadBack = False
        End If
    End Sub
End Class
 
Last edited:
Joined
Dec 22, 2007
Messages
184 (0.03/day)
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
Any ideas? Or does anyone know anywhere I could ask that is familiar with this SDK?
 

Mindweaver

Moderato®™
Staff member
Joined
Apr 16, 2009
Messages
8,193 (1.50/day)
Location
Charleston, SC
System Name Tower of Power / Sechs
Processor i7 14700K / i7 5820k @ 4.5ghz
Motherboard ASUS ROG Strix Z690-A Gaming WiFi D4 / X99S GAMING 7
Cooling CM MasterLiquid ML360 Mirror ARGB Close-Loop AIO / CORSAIR Hydro Series H100i Extreme
Memory CORSAIR Vengeance LPX 32GB (2 x 16GB) DDR4 3600 / G.Skill DDR4 2800 16GB 4x4GB
Video Card(s) ASUS TUF Gaming GeForce RTX 4070 Ti / ASUS TUF Gaming GeForce RTX 3070 V2 OC Edition
Storage 4x Samsung 980 Pro 1TB M.2, 2x Crucial 1TB SSD / Samsung 870 PRO 500GB M.2
Display(s) Samsung 32" Odyssy G5 Gaming 144hz 1440p, ViewSonic 32" 72hz 1440p / 2x ViewSonic 32" 72hz 1440p
Case Phantek "400A" / Phanteks “Enthoo Pro series”
Audio Device(s) Realtek ALC4080 / Azalia Realtek ALC1150
Power Supply Corsair RM Series RM750 / Corsair CXM CX600M
Mouse Glorious Gaming Model D Wireless / Razer DeathAdder Chroma
Keyboard Glorious GMMK with box-white switches / Keychron K6 pro with blue swithes
VR HMD Quest 3 (128gb) + Rift S + HTC Vive + DK1
Software Windows 11 Pro x64 / Windows 10 Pro x64
Benchmark Scores Yes
I've not used the Speech SDK. I would be interested to see some screen shots of the Speech engine UI popup. So, if I understand what you are saying.. You created a button that calls the Speech engine UI popup event? You should be able to do something like take the start button on the speech engine UI and (I don't know what it's called this is just an example) bt_start.performclick inside your button click event.
 
Last edited:
Top