 |
|
 |
Can I add code to this program to use it as an phone answering machine?
cafz@charter.net
|
|
|
|
 |
|
 |
Have a look a the TAPI SDK.
QRZ? de WAØTTN
|
|
|
|
 |
|
 |
Hi just to comment that in order to build and run the app in VS2005 aditionally to the comment of adding include and lib directories of SAPI 5.1 SDK commented the following line in Text2Speech.rc
//1 RT_MANIFEST "res\\Text2Speech.manifest"
|
|
|
|
 |
|
 |
I really love those uncomplicated classes. Just a call to CSpeech::Speak... Thank you for that simple class!!
|
|
|
|
 |
|
 |
This is fun and great!! I really like something similar class for my C# programs...
_____________________________
...and justice for all
APe
|
|
|
|
 |
|
|
 |
|
 |
I recommend that you don't get caught up in the whining, snivelling cacophany from non-MFC advocates, they are a bunch of panty-wastes. Let them slog on without the tools that the rest of us have enough brains and stones to use.
If you must dabble in their realm, at least include the MFC dependant code that we will be delighted to use.
Thanks for your work.
MFC Man
|
|
|
|
 |
|
 |
Any suggestion for implementing this class to work on other languages ?
TIA
|
|
|
|
 |
|
 |
I'm not an expert on SAPI (Microsoft's Speech Engine) but I think there would have to be a difference in SAPI in order to interpret non-english speech. Maybe it supports other lanuages already. I don't know if it does but I have no doubt that it will support non-English eventually.
|
|
|
|
 |
|
 |
I submitted an updated CSpeech class, demo project and html text which will be there in 3 working days.
There's a mistake on the html page regarding the way to build the multithreaded WIN32 project after including CSpeech to the project. I said something about using the MFC build setting in the Configuration Properties|General page. That is incorrect.
If _beginthreadex is undefined at link time after you added the CSpeech class to your project, go to the Code Generation property page and choose one of the multi-threaded items in the "Runtime Library" list.
|
|
|
|
 |
|
 |
Your comment "As far as I know, the CSpeech class needs to be built using MFC. I am not certain of this. I am not going to say that it will work in a non-MFC build because I haven't tried to do that...The CSpeech needs to use the CStringList (collection), CString classes and TRACE macro." raises a question. If the class needs CStringList, CString, and TRACE(), wouldn't that mean that MFC is a requirement not simply a recommendation?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
 |
|
 |
I've updated the class source files so that they no longer need MFC. MFC will hopefully, not be an issue after the update gets posted.
I submitted the update yesterday so it should be online within a day or three.
I hope MFC is no longer needed. I tried to cut everything loose including the CStrings. If anyone finds a problem please let me know. I seldom work with non-MFC projects.
|
|
|
|
 |
|
 |
Hello there! I have been working with the Speech SDK for a long time now (more than 4 years). I have a few suggestions that you might want to consider as well as some possible problems...
o I believe that the ISpVoice::Speak(...) can take a flag value of SPF_ASYNC which will cause the call to become asynchronous; it will return immediately after queuing the speech request. So you do not really need a worker thread dedicated to this (the speech engine has its own threads for this).
o In your CSpeech::Speak(...) function - you can save on overhead by using a stack allocated TCHAR buffer and formatting into it rather than using a CString object.
o You need to manually close the m_hThread handle after the thread ends if you created the thread with _beginthreadex(...). (Also, removing that call and the CString mentioned above, as well as its list, will eliminate MFC as a dependency.)
o I would create a simple wrapper class to handle entering the critical section on construction and leaving it on destruction. That will allow you to ensure that critical section access is exception safe; if an exception occurs, it will not cause the CS to remain locked.
o I would move all of the initialization and creation of interfaces, handles, etc. into another function like Initialize(...) that can be called manually. That will allow your class to better report on any errors encountered during initialization (return error codes). It is also generally not a good idea to throw up message boxes (especially using AfxMessageBox like that) because they block the execution of the application.
o You need to manually close the m_hThread handle after the thread ends if you created the thread with _beginthreadex(...).
o You can use the ATL conversion macros to do on-demand conversion of strings from ANSI to Unicode as required. Although you have to watch out for stack space when using them.
o When you allocate using new [], you should deallocate using delete [] (in the CSpeech::ThreadProc(...) function).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
 |
|
 |
Hi James,
I really appreciate the info. I didn't even realize that I forgot
to CloseHandle. I just recently had a handle leak in another program
and had to learn this the hard way. Now I just need to find a way to remember.
I tried the ASYNC mode of speech without using a notify handler and SAPI did not
speak in the correct order. But it wasn't much trouble to do it myself. There's
probably a way to fix the problem of the messages being out of order. But I don't
know SAPI well enough.
I want to remove the dependancy on MFC. Will try to get that done asap.
Thanks.
Dave
|
|
|
|
 |
|
 |
James R. Twine wrote:
o When you allocate using new [], you should deallocate using delete [] (in the CSpeech::ThreadProc(...) function).
I just looked into this. Now I know. I've been using new / delete for a while but never knew
about the delete [].
James R. Twine wrote:
o I would create a simple wrapper class to handle entering the critical section on construction and leaving it on destruction. That will allow you to ensure that critical section access is exception safe; if an exception occurs, it will not cause the CS to remain locked.
It used to use CCritSec and CAutoLock but when I pulled it out of a Directshow
project, I had to remove these in order to untie it from Directshow. But you're right,
it could use better error handling. I'll update it with my own CAutoLock eventually.
|
|
|
|
 |
|
 |
Now you've got me looking at the code more carefully. I found another
bug, will fix it in ASAP:
The lpFormat string length is being calculated wrong in order to get
a buffer size. I'll just delete the length calc and use the max buffer size
all the time.
I'm sure there's more bugs in there.
BTW: I want to remove the message box error handler but what is the
best way to indicate an error from the constructor? Throw an exception?
Maybe I could just ignore the error and let the caller get an error code
when they call Speak?
|
|
|
|
 |
|
 |
Basically, you do not return errors from constructors. Exceptions cause the object to then be cleaned-up (under most cases), and destructors will be callsed for any objects that have been "fully constructed" at the time the exception was thrown.
As I mentioned above, I would move the initialization code into a dedicated function that returns a status code. By not returning a status code, you take away the ability of the code to (1) detect a problem and (2) recover from it.
I would move away from using dynamically allocated memory for your format buffer. The buffer is going to be rather small in most cases, and the stack is pretty large under Win32 (defaults to 1MB), so taking a stack-allocated buffer of 8K, 16K, 32K is nothing, really. I would also use _sntprintf(...) to format into it, so that you eliminate the possibility of a buffer overrun there.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
 |
|
 |
i tried to build the source code but i get a sapi.h file not found.
|
|
|
|
 |
|
 |
Sorry for the trouble. I should've put this link into the article.
You need to download and install the Microsoft Speech SDK 5.1 for this project to build. It's true with all software that uses the Speech API. This one's no exception.
http://www.microsoft.com/downloads/info.aspx?na=46&p=4&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=5e86ec97-40a7-453f-b0ee-6583171b4530&genscs=&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fspeechSDK%2fSDK%2f5.1%2fWXP%2fEN-US%2fSpeechSDK51.exe
http://www.microsoft.com/downloads/details.aspx?FamilyID=5e86ec97-40a7-453f-b0ee-6583171b4530&DisplayLang=en
I hope those two long links still work after I paste them. If not, go to Microsoft's web site and search for Speech SDK 5.1.
Dave
|
|
|
|
 |
|
|
 |
|
 |
You must installed MS Speech SDK.
A. Riazi
|
|
|
|
 |
|
 |
I have installed Microsoft Speech SDK 5.1, but still not working. Do I have to install SASDK 1.1?
|
|
|
|
 |
|
 |
Did you add the Include/Lib directories of Speech SDK to Visual Studio? If not, do this:
Tools -> Options -> Directories -> Include
and add include folder of Speech SDK also do this for Lib folder.
A. Riazi
|
|
|
|
 |
|
 |
great, it is working now! thanks
|
|
|
|
 |