Tools Links Login

Example with MS Agent, text-to-speech

Microsoft Agent will speak (computerized voice) the contents of a textbox or richtextbox to you!

Original Author: Amir Malik

Inputs

the text to speak, or just paste it

Assumptions

components/objects:
Microsoft Direct Text-to-Speech control
rich text box
2 command buttons
the sp is the DirectSS control
text box for the computer voice speed

Returns

sound!

Code

' MSAGENT example by Amir Malik
' website: http://amir142.cjb.net
' e-mail : amir@infoteen.com

Private Sub cmdPaste_Click()
  TextData.Text = Clipboard.GetText
End Sub
Private Sub cmdPauseR_Click()
  If cmdPauseR.Caption = "&Pause / Stop" Then
    sp.AudioPause
    cmdPauseR.Caption = "&Resume"
  ElseIf cmdPauseR.Caption = "&Resume" Then
    sp.AudioResume
    cmdPauseR.Caption = "&Pause / Stop"
  End If
End Sub
Private Sub cmdSpeak_Click()
  sp.Speak TextData.Text
  sp.Speed = txtSpeed.Text
  Sspeak = True
End Sub
Private Sub txtSpeed_LostFocus()
  If txtSpeed.Text < 50 Then
    MsgBox "Speed is too low."
    txtSpeed.Text = "150"
  End If
  If txtSpeed.Text > 250 Then
    MsgBox "Speed is too high."
    txtSpeed.Text = "150"
  End If
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 108 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.