Can I add voice recognition to my program?



Read and add posts to the Visual Basic 6.0 Forums

Download some of my programs and OCXs

Read the Tips here

The old style forum is still available here




From: asif blaa
Date: Friday 05 October 2001 9:57 PM
Subject: <No subject>
Question: hi
i would like to know if and how i can put voice recognition in my vb program.
the program works with forms and i want to change from one form to another displaying info on pages 

thanks for your help
mi5hq ( joke )

You can add voice recognition and text to speech to your program using the Microsoft Speech SDK (software developer kit).  You can download version 4.0a from here:

SAPI4SDKSUITE.exe - 40,001 Kb

Version 5.1:

Speech SDK 5.1 (68 MB)

Once you have downloaded the SDK, you will need to do 'training' so that the accuracy of the voice recognition is increased. 

Microsoft Speech Recognition Training Wizard (from version 4.0a)
Microsoft Speech Recognition Training Wizard (from version 4.0a)

The SDK comes with example programs (some made with Visual Basic) that you can look at and study the source code for:

Dictation Pad (Visual Basic Version)
Dictation Pad (Visual Basic Version)

As you can see from the above picture, I need some more training!

There are three ActiveX controls that come with the SDK (version 4.0a):

The ActiveX Controls
The ActiveX Controls

These ActiveX controls are all that are needed to use Voice Commands, Voice Dictation and Voice Text (Text to Speech) in Visual Basic 6.0.

Archived Comments

From: pavan
Date: Saturday, February 26, 2011 at 11:26:37
Comments: This site is the best for the information of vb programming.
best of luck...
From: vijay
Date: Saturday, December 27, 2008 at 18:35:56
Comments: this is good to see
From: Al
Date: Saturday, November 1, 2008 at 00:27:35
Comments: While SAPI is a great program, it is used for speech recognition rather than voice recognition... It only converts speech to text, without recognizing who the speaker is.
From: Johnson
Date: Tuesday, May 13, 2008 at 19:34:26
Comments: Very good information ya
From: paul
Date: Wednesday, November 28, 2007 at 08:28:51
Comments: Wow this forum is a big help tnx to all of you well i am student who wants to create a program that will recognize voice so i think this can really help me... =]
From: sabita
Date: Saturday, November 24, 2007 at 07:48:35
Comments: this is best site i found ,what i am searching for since hours its nice
From: Bharathi
Date: Saturday, July 7, 2007 at 13:02:19
Comments: plz give some more instructions..then only this can b understood easily......plz attach some more details abt the project.
From: Umesh Kr. Sharma
Date: Saturday, September 30, 2006 at 13:37:34
Comments: Excellent ....!
From: Riyas
Date: Monday, December 12, 2005 at 20:11:10
Comments: Good Information, Thanks, I'll make a try...
From: bala
Date: Tuesday, August 30, 2005 at 14:24:33
Comments: It is very nice. I hope it will useful for me. I will work on this. Will give u the reply.
From: Daniel
Date: Saturday, August 6, 2005 at 19:08:08
Comments: Very nice site...I found what i was looking for...
but I have a question and i'll be so happy if someone could help me...

I made my software with speech and now i have to make the setup package...what libraries i have to include in the setup package? thank you so much..bye Daniel

From: Karthik
Date: Saturday, August 6, 2005 at 03:15:31
Comments: good but attach the project with this project. it helps to check very easy.
From: Alex
Date: Thursday, July 14, 2005 at 16:47:49
Comments: I have installed Microsoft Speech Recognition 4.0(SAPI4SDKSUITE.exe) in my windows 98. I followed a lot of tutorials including above tips but still there is no response when i run the program. I think the DirectSR_PhraseFinish procedure is simply ignore or bypass when it run. And second thing i discover; when i open setting>control panel>speech in speech window there is a button for training but when i click this button there is nothing change, there is no window appear (as above window). Is it normal? There anybody who can help to solve my problem?
From: Pimms
Date: Monday, January 31, 2005 at 20:16:31
Comments: Very good program but a bit vauge on the details on the website!
From: zain
Date: Tuesday, December 21, 2004 at 20:10:35
Comments: very good site
From: ashu
Date: Saturday, October 30, 2004 at 12:45:02
Comments: very nice but there should be more detail but simple program
From: B.B. Singh
Date: Monday, October 11, 2004 at 08:39:15
Comments: this site is ver helpful for us and i look it perday
From: palash singha roy
Date: Friday, August 13, 2004 at 08:58:29
Comments: very good example for vb developer
From: Naing Tun Win
Date: Wednesday, July 14, 2004 at 09:34:15
Comments: I m a IT student and crazy about programing <vb>
I like this site so much
From: Tony
Date: Tuesday, July 13, 2004 at 19:24:45
Comments: This is amazing!  I am only 16 and i've only just taken my first VB.Net cert.  Therefore, being unexperienced, I thought it might be difficult to find any VB compatible voice recognition software that would be easy to use. So I decided I would check it out anyways, and man it's so simple, but so useful. Thank you so very much!
From: Jasmine
Date: Friday, June 25, 2004 at 16:33:47
Comments: Great! This looks promising and thanks.
From: umesh k.c.
Date: Monday, May 17, 2004 at 13:07:20
Comments: after i was ur project i like ur it very very much.
Your porject has helped me a lot on  my project too.
keep it up man.
From: tom contrafatto
Date: Friday, May 14, 2004 at 00:51:17
Comments: i will try this out thanks!
From: rani
Date: Wednesday, March 31, 2004 at 07:51:11
Comments: this is realy very help ful forum
From: marc
Date: Saturday, February 14, 2004 at 02:40:23
Comments: i'm really sorry but, X10? what is X10?
Reply: X10 is a way of controlling household devices by sending signals through the power cables.  The X10 homepages are here: and  Another explanation can be found here:

What is X10?

I haven't looked into whether it can be used with Visual Basic 6.0 or not though.

From: Fraser Dickson
Date: Tuesday, February 3, 2004 at 19:31:57
Comments: i have similar coding to the short example on this page but how do i unload a form when using sdk control i crash when i try unload a form
From: Marc
Date: Wednesday, January 28, 2004 at 18:22:53
Comments: i'm thinking of doing a thesis using voice recognition. it's quite simple, i think, using voice commands to switch lights in houses.. do you think it's possible?
Reply: If you able to control the lights using a technology such as X10 with Visual Basic 6.0, then what you want to do should be possible.
From: ronnie
Date: Wednesday, January 21, 2004 at 16:32:56
Comments: i want to know wheteher i can use more than one directsr to activate traindlg and aboutdlg.i am midway in my project and helpless.please respond and help
From: thomas
Date: Saturday, December 6, 2003 at 00:56:44
Comments: i am downloading the sdk 5.1 -- hopefully il learn how to use it - if any1 can send me an example of very simple voice recognition that'd be cool -- thanks
From: Nikola
Date: Friday, November 21, 2003 at 01:15:06
Comments: Hi...I am making a speech recognition program whcih recognises words which i only program it to. E.g. If a guys says Yuko or Hello it will only print (Y) or (H) not the whole word and it will add +1 to (Y) or (H). Thisprogram is suppose to be a Automatic Judo score board where The core boeard will recognise terms used by refrees in judo matches and apply it. 
Please Help.


From: Radha
Date: Tuesday, November 4, 2003 at 08:40:12
Comments: I am from India and i am developing the s/w for security system for multi story building where through telephone security people will call the  people(who are staying in the flats)and i want to add voice and video conferencing features in that through computers.

can anyone help me???

From: nash
Date: Wednesday, October 22, 2003 at 15:25:07
Comments: i can't get it to work! this is what my code looks like:

Option Explicit

'-------------------------------api declares-----------------------------------
Private Declare Function ShellExecute Lib "shell32.dll" _
        Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
        ByVal lpFile As String, ByVal lpParameters As String, _
        ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
    Select Case Command1.Caption
    Case "Disable"
        Command1.Caption = "Enable"
        Label1 = "Disabled"
    Case "Enable"
        Command1.Caption = "Disable"
        Label1 = "Ready"
    End Select
End Sub

Private Sub DirectSR1_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)

        MsgBox "in the phrasefinish"

        Dim sFile As String
noth As Long

        MsgBox Phrase, , "The Phrase is: "

        Select Case Phrase

        Case "Notepad"
            sFile = "\system32\notepad.exe"
            noth = ShellExecute(0, "OPEN", Environ("SystemRoot") & sFile, "", "", 1)
        Case "Volume"
            sFile = "\system32\sndvol32.exe"
            noth = ShellExecute(0, "OPEN", Environ("SystemRoot") & sFile, "", "", 1)

        Case "Media Player:"
            sFile = "C:\Program Files\Windows Media Player\mplayer2.exe"

            noth = ShellExecute(0, "OPEN", sFile, "", "", 1)

        End Select

Phrase <> "" Then
                    Label1.Caption = "Matched word is " & Phrase
                    Label1.Caption = "No word matched"
                End If
End Sub

Private Sub Form_Load()
Dim totaldata As String
  'define configuration
  '[Grammer], set language to english (1033)
  '[<Start>], define the words we are looking for

  totaldata = "[Grammar]" & vbCrLf & _
                "langid = 1033" & vbCrLf & _
                "type=cfg" & vbCrLf & _
                "[<Start>]" & vbCrLf & _
                "<start>=Notepad" & vbCrLf & _
                "<start>=Volume" & vbCrLf & _
                "<start>=Media Player" & vbCrLf

  DirectSR1.GrammarFromString (totaldata)
End Sub

it's got a label (label1) and a command button (command1) present on the form but for some reason it just never enters the phrase finish event...technically this code SHOULD work...does anyone know if maybe i've done something wrong with the settings of my project??

From: Rahul
Date: Wednesday, October 22, 2003 at 07:24:41
Comments: hi,
i want to know whether this would help in doing a program to recognize a particular user, instead of using the method of username,password to login?
ie,will it be able to recoginize the actual voice of the particular user or can just get the text from whatever is spoken.
From: Allen Willliamson
Date: Tuesday, October 21, 2003 at 18:41:42
Comments: I need to monitor the microphone input level.   When a voice is detected on the microphone, I need to start the recording of that voice.   Is there any examples of code in VB6 that will allow me to accomplish this task?
From: MrKhalid
Date: Tuesday, October 14, 2003 at 12:23:32
Comments: Hi,

Using Visual Basic

How can I use the Voice-Recognition functionality to check the user's voice as a password?
Is it possible??


From: Blood-Butt
Date: Wednesday, September 24, 2003 at 17:58:55
Comments: ive installed the speech program (V5.1) but how come i dont have the components for using this in the Project>Components... tab?  Can ne one help me plz?
Reply: With version 5.1, you need to set a reference to the Microsoft Speech Object Library in order to be able to use it.  Version 4 had items in the Components list, but not 5.1.  See the sample projects for how to use the Library.
From: sachin patidar
Date: Thursday, September 11, 2003 at 06:26:18
Comments: hi
  i am working a project on sppech recognition system in vb can you give me some idea about coding.
              thank you
From: Bhasker
Date: Sunday, August 31, 2003 at 10:27:51
Comments: im planning a parallel port project... with voice actiavted commands to light up th leds n the pc relay card... so basically its a port controlling thing... what are the other nice options i have...  i want to use voice recognition with vb .Can someone pls gimme the min . req for voice recognition. during design stage.any other bright ideas or for more info onthe project /details pls reply to my email..thnx ..
keep clicking,
From: ht
Date: Wednesday, August 27, 2003 at 12:03:02
Comments: hello. I'm curently plan to do my a project using voice recognition software. Does anyone here that can give me an idea on how to do it? Thanks.
From: vincent chia
Date: Tuesday, August 19, 2003 at 10:07:03
Comments: How to change LanguageID programmatically?
From: Khaled
Date: Sunday, August 3, 2003 at 11:46:42
Comments: This website is absolutely great. And thanks to all those people who are helping others by sharing their knowledge. I am a senior in college and going to graduate next semester. I was surfing the net to look for some help like, how to send email from visual basic, and how to build a voice recognization application. I have looked almost everyone's comments above, I hope everyone has solved their problems. But if anyone can solve my problem please do let me know by responding on this site or by email. I not a very good programmer but I am trying my best to learn how to program. Please, if anyone knows how to solve the problems I have mentioned above, do let me know.Your help will be always appreciated. Like someone said, when you share money, the lesser it gets, when you share knowledge the bigger it gets. God Bless you all.
From: sandeep
Date: Thursday, July 31, 2003 at 09:00:45
Comments: If u people are having the source code of any voice recognisation projects based on linux please send me immediately..............................
From: venkat
Date: Tuesday, July 29, 2003 at 12:48:36
Comments: This is really excellent. It is many day dream to my self thank you very much.
From: Amanuel Adane
Date: Monday, July 14, 2003 at 12:48:30
Comments: I think Mailini can help me with my problem.
Please dear Martin, send me his email address or any codes which can help me integrate voice command into my app.

I'd really be gratefull.

From: Amanuel Adane
Date: Sunday, July 13, 2003 at 22:52:08
Comments: Guess this is a life saviour page for those of us who plan to add voice command feature in our project app.
I'd really be grateful if someone can send me source code on how to integrate voice command step by step.
Am downloading SDK version 4


From: zach
Date: Thursday, July 10, 2003 at 02:56:11
Comments: This is really helpfull.  I already have all the files needed, would it be possible to get just the example program to figure out how to use it please?  Thanks, it would be really appreciated!!!
Reply: If you have downloaded the SDKs, they should include demo projects and programs.
From: dinesh
Date: Tuesday, July 1, 2003 at 12:08:53
Comments: it's very good project plz send to me the project code of speech recognization on linux operating system
From: Abhishekk
Date: Friday, June 20, 2003 at 13:13:30
Comments: Hi evverybody,
I am designing an"speech commanded MP3 player"in vb and
require that system must respond to my commands & control various buttons such as: play
                                 fwd,pause etc
I would be really thankful if anybody could help me out in my project.
From: Lou
Date: Thursday, June 12, 2003 at 07:39:25
Comments: im new in voice command/recognition being added to a VB application. where can i find the documentation about this. can you give me sample codes (an easy one) so that i can start with it. anyone can send. thanks..
From: Michael
Date: Monday, June 9, 2003 at 18:54:37

I am posting a small sample of Speech Recogntion, this was just the early stages of a program i am building that will completely automate my computer to voice commands, it took a little trial and error but i hope it helps ppl with thier own speech recongtion programs.



Private Sub Form_Load()
Dim retval As Integer

DirectSR.GrammarFromString "[Grammar]" + vbNewLine + _
                          "type=cfg" + vbNewLine + _
                          "[<start>]" + vbNewLine + _
                          "<start>=Web Browser" + vbNewLine + _
                          "<start>=Notepad" + vbNewLine + _
                          "<start>=Visual Basic" + vbNewLine + _
                          "<start>=Calculator" + vbNewLine

End Sub

Private Sub DirectSR_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)
txtCommand.Text = Phrase

Select Case Phrase
    Case Is = "Launch Notepad"
    retval = Shell("C:\WINDOWS\notepad.exe")
    Case Is = "Launch Web Browser"
    retval = Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
    Case Is = "Launch Visual Basic"
    retval = Shell("C:\Program Files\Microsoft Visual Studio\VB98\VB6.exe")
    Case Is = "Launch Calculator"
    retval = Shell("C:\WINDOWS\calc.exe")

End Select
End Sub

From: Sam Quiring
Date: Saturday, May 31, 2003 at 20:26:39
Comments: You guys should check out SpeechStudio (  It lets you easily add
voice recognition and text-to-speech to VB programs.
From: Fiona
Date: Friday, May 30, 2003 at 13:15:26
Comments: I've downloaded version 4 of the above but am interested to know what the differences in versions are?
Reply: This page details the features both versions.
From: Amol Virnodkar
Date: Wednesday, May 21, 2003 at 12:11:51
Comments: I am doing my project on voice recognition please send me the code in vb to understand about adding voice recogntion in vb. Also whether we can interact with DOS using this facility and speak command and type it at command line in DOS environment by running at back end the vb code. Please help me out.
From: Oscar
Date: Friday, May 16, 2003 at 13:23:42
Comments: Where can I find documentation of text recognition  in Visual Basic v6.0
From: abdo
Date: Monday, May 12, 2003 at 13:05:22
Comments: pleas give us some more exemple of it with programs thank you
From: malini
Date: Wednesday, May 7, 2003 at 19:27:37
Comments: hi people..this is gr8 ...all u guys seems to be very helpful ...well i work for a medical firm here in indiana,usa. and we have a appliaction which is done in visual basic and with mouse click events(command button)..i would love to change that application into a voice recognisation application..where instead of pressing the buttons in the form at run time you could talk to it and make the event occur......for example my form if i have a command button A which occurs an event when pressed...i just wanna say "press buttom A" and by application should voice recognise what i said and should press Button A ...u know what i mean .....example i wanna navigate menus in vb using voice reog...
u just have to say it and it triggers the event or presses the button


say "menu" --->it shows the sub menu below it

and now when i say "copy" it should recognise the word or command and should do the copy function....and so on

this is my request for all the good people here to help me out with your ideas and suggestions and little source code will be greatly appreciated..


From: Suhas De
Date: Wednesday, May 7, 2003 at 18:40:12
Comments: I have implemented MS Character Agent and MS Speech SDK, it tries to recognise voice commands, but problem is, not all commands are recognized, and involves huge amount of coding. I hope the SDKs' listed above will help.
From: Amol Virnodkar
Date: Saturday, May 3, 2003 at 06:12:39
Comments: I am doing a project on voice commanding please tell me that where I get details regarding the Speech API in VB for speech recognition.
From: ashish
Date: Thursday, April 24, 2003 at 09:06:39
Comments: R/S
    I get project in vb to communicate with voice chat
in LAN. So plz send me code and connaction with ine client to other.
From: neha marwaha
Date: Thursday, April 17, 2003 at 20:15:25
Comments: i have made a visual basic i want to integrate voice into it asuch that whatever query(limited) i have i speak it out in words & the system should be able to respond me back accordingly. please tell step by step. i have already downloaded sdk5.1 & installed on my system.thanks
From: Loop
Date: Thursday, April 17, 2003 at 07:17:59
Comments: hey, where is the training, i cant seem to find that.
From: brahadesh
Date: Saturday, March 29, 2003 at 12:18:52
Comments: please tell me how to change the voice in voice to text control

Here is a procedure that will add the voices into a ComboBox or a ListBox:

Sub ListVoices(Lst As Object, Lips As Object)
engine = Lips.Find("Mfg=Microsoft;Gender=1")
Lips.Select engine
For i = 1 To Lips.CountEngines
    ModeName = Lips.ModeName(i)
    Lst.AddItem ModeName
Next i
Lst.ListIndex = Lips.CurrentMode - 1
End Sub

Use this code to change the voice when the ComboBox or ListBox selection changes:

Private Sub Combo1_Click()
TextToSpeech1.CurrentMode = Combo1.ListIndex + 1
End Sub
From: jamie
Date: Saturday, March 29, 2003 at 01:09:37
Comments: if anyone wants sample code for vb to write speech recognition apps using VR 4.0 SDK then let me know. I have written several apps that control external software aswell. A knowledge of api calls is very important for that, but for internal prog commands its easy
From: Christian
Date: Thursday, March 27, 2003 at 08:39:43
Comments: Can you pls send me sample codes for Microsoft Voice command Control in VB6?
From: walter
Date: Tuesday, March 18, 2003 at 08:42:12
Comments: the screenshot is quite implressive. but i really want to know how to code the operation itself.havin dictating a certain name/word then it shall be displayed in the given textbox of a certain form.i really need help.thanks
From: ivy
Date: Tuesday, February 25, 2003 at 17:06:35
Comments: i m trying to intergrate the Voice recogniton part into an application that uses the Text-to-speech as well..can u show me step by step how to do the voice recognition part and sample codes of the that part..?? do i need to download the microsoft SDK??...TQ!!
Reply: You will need one of the SDKs listed above.
From: David MIDI
Date: Monday, February 10, 2003 at 09:24:31
Comments: Please, give an example of <voice recognition> and a link of Dictaction Pad. :)
Reply: Please download one of the SDKs listed above, which include examples including a Dictation Pad.
From: Wayne McCaslin
Date: <Unknown>
Comments: You guys are great .Helping people is an art that we can not loose site of , MY HAT IS OFF TO YOU GENTLEMAN.

     Im a professional H.V.A.C. Service Technician, & would return such kindness if you were to need HEATING & AIRCONDITIONING SERVICE !!!


From: khaled attia
Date: Thursday, January 30, 2003 at 14:08:00
Comments: thank you for help but i need voice recognition for arabic language wit my visual basic programe
From: Muthu
Date: Sunday, January 26, 2003 at 06:52:07
Comments: Can any one help me to add voice recognition in vb so as to carry out my project work. plz explain me with an example
From: Muralidhar Reddy
Date: Sunday, December 22, 2002 at 17:26:43
Comments: I would like to program on voice related controls
how can i get good knowledge on that controls
please suggest me
From: vinodh
Date: Sunday, December 22, 2002 at 08:09:16
Comments: dear martin,

        My name is vinodh,i'm from india,martin,there is an exbition in our school,i'm participating in it,i had palnned 2 exibit voice recog software (created through VB),i have vb-6 loaded in my pc and voice recog engine is not loaded in it,i have 2 download from net but it was more than 3o m.b,does it voice recog will be in vb7 also send me some dashing visual basic project with source code,plezzzzzzz

From: Abdul khaleel qibran
Date: November 23, 2002 at 11:34:02
Comments: how to implement voice recognition in visual basic. I need the code to develop my application. I tried with microsoft direct speech recognition. but it is not working. help me please.
From: Keenen
Date: Monday, November 11, 2002 at 22:47:56
Comments: What is going on man, Im freaking lost Help me man Ahh Shit by
From: Dan
Date: Wednesday, November 6, 2002 at 17:23:35
Comments: My question is, can you make MSVoice SDK play through the phone speaker on a computer?
IE To make automated phone calls to clients.
From: Paul
Date: Wednesday, October 30, 2002 at 22:21:23
Comments: good but some simple form code would help aswell

Martin Allen 1999 - 2012.  Last updated Monday 09 January 2012 09:37:04 PM -0000.