Adding Speech for EPL games using VB.net

This post describes how to add a speech to PC games like EPL , football etc . The tools we are using here are Visual Studio 2005 . The libraries we using here are Microsoft speech library .
First you need to import the Microsoft speech library to your project . We provide a video for you that can help you in coding . We also provide the source code as we are explaining in the video . this is very simple . Try it and please put your valuable comments . the video is uploaded here .



The source code is below
--------------------------------------------------------------------------------------------------------------

Imports SpeechLib
Public Class Form1


    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' My.Computer.Audio.Play(CurDir() & "\8point1.wav", AudioPlayMode.Background)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim spch As String
        spch = TextBox1.Text
        Dim spk As New SpeechLib.SpVoice
        spk.Speak(spch)
    
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        My.Computer.Audio.Stop()
    End Sub
End Class
----------------------------------------------------------------------------------------------------

Here in the source code we first import the speech library .
The we create a  string spch in which to this string we are accepting the value from the text box .
then we create a object of the Speech library as spk
using the in build speak function we can do this speech .
Thank you .

Enhanced by Zemanta

No comments:

Post a Comment