Listato 1. Impostare la risposta vocale

Imports SpeechLib

Partial Class _Default Inherits System.Web.UI.Page

  Dim voce As New SpVoice()

  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    If UCase(TextBox1.Text) <> "ARRIVED" Then
      voce.Speak("WRONG!")
      lblEsito.Text = "WRONG! The word is <strong>ARRIVED</strong>"
      lblEsito.ForeColor = Drawing.Color.Red
    Else
      voce.Speak("CORRECT!")
      lblEsito.Text = "CORRECT"
      lblEsito.ForeColor = Drawing.Color.Red
    End If
  End Sub
End Class

Listato 2. Selezione dello speaker

Imports SpeechLib

Partial Class voci
  Inherits System.Web.UI.Page

  Private ObjTok As ISpeechObjectToken
  Dim voce As New SpVoice()

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
      Dim strVoci As String
      voce = New SpVoice
      For Each ObjTok In voce.GetVoices
        strVoci = ObjTok.GetDescription
        ListBox1.Items.Add(strVoci)
      Next
    End If
  End Sub

  Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
    voce.Voice = voce.GetVoices().Item(ListBox1.SelectedIndex)
    voce.Speak(voce.Voice.GetDescription)
  End Sub
End Class