Text To Speech library (desktop only)

Discussion in 'Additional Libraries' started by Louis, Oct 27, 2007.

  1. Louis

    Louis Active Member Licensed User

    Hi. I am trying to wrap the Microsoft SAPI so it will work with Basic4ppc. The DLL builds fine and I see all methods, but when I run it on the desktop I get an error saying that the speech.dll wrapper is trying to read from protected memory, but if I use native C++ the Speech.dll lib works fine. Please help! All source code is attached below for the desktop only. Thanks.
     
  2. Cableguy

    Cableguy Expert Licensed User

    Sorry...
    I cannot help, but is this dll device compatible?

    I was looking for something like this for a while...
     
  3. agraham

    agraham Expert Licensed User

    Louis - I am afraid that your source is a bit screwed up and I don't know that dll does so I can't help with that.

    However try the following. As with all my stuff it needs .NET 2.0 and I can't be sure that it will work on your machines but it works on my laptop under XP and my desktop under Vista.

    Technical note : The source code needs an interop library to access the COM object "Microsoft Speech Object Library". The Interop library included is automatically generated by VS2005 when you add the COM reference to the project. I have included the source in case anyone wants to make a stab at a .NET 1.1 version but I don't know if this is possible.

    EDIT: - I've just found out that the voice selection is broken - I only have one voice installed on my main machine so I could't test it there. I have fixed it but I'll wait for some feedback to see if this library is of any use to people before posting it.
     
    Last edited: Oct 27, 2007
  4. Erel

    Erel Administrator Staff Member Licensed User

    Attached is the .Net 1.1 version of this library (desktop only).
    Speak1 - Asynchronous speaking.
    Speak2 - Synchronous speaking (blocking).

    You should add SAPI.dll to your project.
    Interop.SpeechLib.dll should be in the same folder of your code.

    A small example is also included.
     
  5. agraham

    agraham Expert Licensed User

    Final (?) version 1.1 of SpeechLibDesktop compiled under .NET 2.0

    Source code and help file included. Sync and Async speaking with voice selection and some useful events. Sample app included.

    @Erel & dzt et al. I guess this source won't compile directly under .NET 1.1 as I use the later C# 2 syntax to add events - I guess you can figure out how to fix that yourselves!


    Edited by Erel: The attached file is compiled with .Net 1.1. Thank you agraham for this great library :sign0188:
     

    Attached Files:

  6. colin9876

    colin9876 Active Member Licensed User

    Hey, this is great but can it not run on the PocketPC? Is there a hardware barrier to speach on a PDA?

    Im new to this forum but it seems a shame to be developing things 'for desktop only' because the whole beauty of this Basic4ppc product is that one can develop and run on the PocketPC without going near a desktop?
     
  7. agraham

    agraham Expert Licensed User

    It's not hardware but software limitations. Microsoft didn't put the speech API into Windows Mobile because of memory and processor power limitations. As far as I know there is only one speech library for Pocket PC. It is called FLite and I haven't made it work properly. Even when it does the speech quality apparently is c**p because of said limitations.
     
  8. bparent

    bparent Member Licensed User

    Speech Desktop error

    Whenever I try to run this I get the following error using the included example:

    "Cannot load file or assembly Interop.SpeechLib or one of its dependencies. Cannot locate file"

    I have the Interop.SpeechLib.dll in the Windows directory, Basic4ppc/librarires directory, with the speechtext.sbp file.

    What am I doing wrong?
     
  9. Louis

    Louis Active Member Licensed User

    Hi. The Interop.Speech.dll that you moved to your Windows folder should be in the same folder as the rest of the Basic4ppc Libraries. When you decide you want to distribute your applications, all dlls should be distributed in the same folder as your source code or compiled application. This includes the Interop.Speech.dll. HTH.
     
  10. bparent

    bparent Member Licensed User

    Speech Desktop error - fixed

    That did it. Thanks. Thought the dll needed to be in the windows directory per earlier comment in thread. Actually, also thought I had put all the dll's with the source code in trying different things, but had not included the Interop.Speech.dll.

     
  11. Zenerdiode

    Zenerdiode Active Member Licensed User

    The supplied SpeechLib.cs is not allowing merging with the .exe. Was it provided for a different reason? I apologise I don't know much about the inner workings of the dll's yet.
     
  12. agraham

    agraham Expert Licensed User

    It is actually the dll that is compiled with an incorrect assembly name. This didn't matter in the days before merging but it does now. I'm afraid I haven't time to revisit this at the moment, and as you need a separate interop library you can't have a single exe solution anyway.

    EDIT :- This reason, hurriedly concocted before I rushed off for a dentist appontment is wrong! There are two reasons it won't compile. One is that the scource filename should be SpeechLibDesktop.cs. The other (I think) is that a reference at compile time is needed to Interop.SpeechLib.dll and Basic4ppc doesn't know this.
     
    Last edited: Nov 12, 2008
  13. rgately

    rgately Member Licensed User

    Hi,
    I have added the SpeechLibDesktop object to my test app. It works fine on my Windows XP notebook except that SayAsync behaves the same as SaySync.

    What is the possibility of someone adding a few more features to the library, such as:

    - get the name of the voice
    - stop speaking and/or pause speaking
    - resume speaking

    Bob
     
  14. agraham

    agraham Expert Licensed User

    Are you sure? Look at the word counter. For a SaySync voice it only updates when speech ends, for an SayAsync voice it updates in real time during speech.

    I've added these to a new version of the library except for Stop which doesn't seem possible. However I have put in a Skip sentence method which skips forwards or backwards. I guess you could do a forwards skip of a large number to end speech. I have noticed that skip backwards while the last sentence is being spoken seems to end speech rather than skipping back, it works OK on earlier sentences so this may be a "feature" of the speech engine.

    The new version is http://www.basic4ppc.com/forum/additional-libraries/3809-desktop-text-speech-library.html

    @Everyone please regard this thread closed and post any queries in the new thread.
     
Loading...