locked
speechLib not working on asp.net page RRS feed

  • Question

  • I am trying to speak a firstname greeting to my users when they visit my web page, but I get:

     

    COMException (0x8004503a): Exception from HRESULT: 0x8004503A]
       SpeechLib.ISpeechVoice.Speak(

    Here is my code:

    Imports SpeechLib
    
    Public Class t2
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            Dim Voice As New SpVoice
    
            Voice.Speak("Hi John")
    
        End Sub
    

    It works fine when I run it on my dev machine, but when I upload it to the Windows 2008 x64 R2 server, I get the error above.
    Any ideas?

     


    • Edited by tuv0 Monday, September 26, 2011 6:11 PM
    Monday, September 26, 2011 6:06 PM

All replies

  • speechlib work on server side not client side so you should create wave file and play it in user web page 
    this code may help you 
     protected void Button1_Click(object sender, EventArgs e)
        {
          SpVoice v = new SpVoice();
          SpeechLib.SpFileStream speechStream = new SpeechLib.SpFileStream();
          speechStream .Open(Server.MapPath("~/test.wav"), SpeechLib.SpeechStreamFileMode.SSFMCreateForWrite, false);
          v.AudioOutputStream = speechStream;
          v.Volume = 100;
          v.Rate = -1;
          //// speak "hello world" or any string else 
          v.Speak("hello world", SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);
          Response.Write("<EMBED src='test.wav' hidden=true volume='100' type=audio/x-wav LOOP='FALSE' AUTOSTART='TRUE'></EMBED>");
          v = null;
          speechStream.Close();
          speechStream = null;
            /// user need to set up QuickTime to make browser play sound 
        }
    • Edited by microspace Sunday, October 2, 2011 5:23 PM
    Sunday, October 2, 2011 5:22 PM
  •  VB.net code :


        Protected Sub Page_Load(ByVal sender As ObjectByVal As EventArgs)
            
    Dim As SpVoice = New SpVoice
            
    Dim speechStream As SpeechLib.SpFileStream = New SpeechLib.SpFileStream
            speechStream.Open(Server.MapPath(
    "~/test.wav"), SpeechLib.SpeechStreamFileMode.SSFMCreateForWrite, false)
            v.AudioOutputStream 
    speechStream
            v.Volume 
    100
            
    v.Rate -1
            
    '''/ speak "hello world" or any string else 
            
    v.Speak("hello world", SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault)
            Response.Write(
    "<EMBED src='test.wav' hidden=true volume='100' type=audio/x-wav LOOP='FALSE' AUTOSTART='TRUE'></EMBED>")
            v 
    Nothing
            speechStream.Close
            speechStream 
    Nothing
            
    ''' user need to set up QuickTime to make browser play sound 
        
    End Sub

    Sunday, October 2, 2011 5:38 PM