SAPI problem with long input text
-
Friday, August 17, 2012 9:21 PM
In a program I am working on, there is a text field which the user can have read aloud to them. We are doing this through use of SAPI (5.4 I believe).
Now, in mos reasonable situations it works fine, but as in any case where you have a user defined input, you will occasionally get a user who provides input well outside of your initial design parameters. Specifically, we have discovered that the ISpVoice::Speak has problems with input strings of 2^20 characters or more. (Yes, I realize this is a thoroughly ridiculous input, but as TTS is naturally a streaming process, there really shouldn't be a reason to fail.)
If the string is passed in directly it simply returns failure (E_INVALIDARG specifically). But if the string is written out to a file, and then Speak is called on that file (with SPF_IS_FILENAME) then it will read it just fine. However, if you have it sending its output to a wav file instead of the speakers, then the file becomes corrupted (VLC can still play it, but VLC can play even very heavily corrupted files, so that only tells us that the audio data is there.)
Has anyone else encountered this behavior? And if so, what did you do about it?
- Moved by Jesse JiangMicrosoft Contingent Staff Tuesday, August 21, 2012 8:46 AM (From:Visual C++ General)
All Replies
-
Friday, August 17, 2012 9:38 PM
Show your code. I'd like to see if you set up the string correctly as a proper BSTR.If the string is passed in directly it simply returns failure (E_INVALIDARG specifically).
-
Friday, August 17, 2012 9:52 PM
Thank you for taking an interest. Unfortunately I can't simply post the code (I don't have permission). However, I would like to point out that (2^20) -1 wchars (including the null terminator) works perfectly, but (2^20) breaks. If it were not being properly set up, then the shorter strings would not work either.
It actually took me a while to figure out that it was a length related issue since the failure result appeared to be indicating something else must be wrong.
-
Saturday, August 18, 2012 3:49 AM
Thank you for taking an interest. Unfortunately I can't simply post the code (I don't have permission). However, I would like to point out that (2^20) -1 wchars (including the null terminator) works perfectly, but (2^20) breaks. If it were not being properly set up, then the shorter strings would not work either.
I can't spot coding errors unless you post the 4 or 10 lines of code you use to set up the call to ISpVoice::Speak(). A coding error can very well be length dependent.
If you don't want to copy/paste the original code, then why not create a completely self-contained new code that compiles and reproduces the problem. That would be even better.- Edited by Brian MuthMVP Saturday, August 18, 2012 3:51 AM
-
Tuesday, August 21, 2012 9:09 AM
Hi Joe,
Welcome to the MSDN forum.
Based on your description, I’d like to move your thread to Windows Desktop SDK for better support.
Thanks for your understanding.
Regards,
Elegentin Xie [MSFT]
MSDN Community Support | Feedback to us


