How To Make Voice Command Programs In Visual Basic 6.0

0530

How To Make Voice Command Programs In Visual Basic 6.0 Average ratng: 3,2/5 6028reviews

Program Visual Basic Dengan Database on this page. Twenty-first century allows users to talk to their computers. Speech recognition converts human speech into digital data that computers can recognize. Several commercial, such as Dragon NaturallySpeaking and MacSpeech, allow users to perform a variety of speech recognition tasks. Using software built into Microsoft’s Visual Studio environment, you can create your own voice command programs using the latest version of Visual Basic. Launch Microsoft Visual Studio and click “New Project” to open the “New Project” window.

Programs In Visual BasicHow To Write Programs In Visual Basic

Click “Visual Basic” to highlight it, and then double-click “Windows Forms Application” to create a new Windows forms project. Code files will appear on the right side of the user interface in the Solution Navigator panel. An empty form named “Form1” will also appear on the user interface. Click “Project,” and then click “Add Reference” to display the “Add Reference” pop-up window. Type “Speech” (without the quotes) in the text box and press “Enter.” The name “System.Speech” will appear in the search results. Click “Add” to add it to your project, and then click “Close” to close the “Add Reference” window. Double-click the title bar of the empty form named “Form1.” This causes Visual Studio to open a code window and display the following code: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub This method, named “Form1_Load,” executes when the application starts and loads the form.

Add the following code before the “End Sub” statement shown in the previous step: Dim engine As New Speech.Recognition.SpeechRecognitionEngine Dim dictionGrammar As New Speech.Recognition.DictationGrammar Dim recognitionResult As Speech.Recognition.RecognitionResult Dim timeSpan As New TimeSpan(0, 0, 10) engine.SetInputToDefaultAudioDevice() engine.LoadGrammar(dictionGrammar) recognitionResult = engine.Recognize(timeSpan) For Each word As RecognizedWordUnit In recognitionResult.Words MessageBox.Show(word.Text) Next The first four lines initialize the Microsoft speech recognition engine. Line five sets the engine’s audio input parameters. Line six tells Visual Basic to use the standard speech recognition dictionary that Windows uses. The line that begins with “recognitionResult” starts the speech recognition engine.

This entry was posted on 5/30/2018.