2021-02-20 21:40:27

I'm on Windows 10 and any SAPI voices that I use sometimes block the program for maybe half a second before or while they're speaking. The only games where this doesn't seem to be happening are Entombed and A Hero's Call.
Is there any way I can stop this happening for my own programs? Maybe there's a flag I can pass to the SPVoice Speak method or something?

2021-02-20 22:41:59

I'm reasonably sure the answer is no; you'll probably need to run speech in a background thread.  maybe someone knows something I don't.

My Blog
Twitter: @ajhicks1992

2021-02-20 23:48:07

A Hero's Call passes text to a speech thread, which in turn calls the SAPI or Tolk APIs so that the main game thread never has to wait.
I did that because SAPI was laggy, but if I recall correctly it was in terms of single digit milliseconds, not half a second, so you may want to debug it more to see if there is something else you can fix.
You are passing the async flag when speaking text, right?
As I look at that code I also see a comment I left myself about passing null instead of an empty string when using the PurgeBeforeSpeak flag to cancel speech without having something new to speak.
I was getting big delays when passing that flag and passing an empty string instead of null, though NULL is probably the obvious choice if you are in C/C++.
This was all using the SPVoice COM object through C#, and tested on Windows 7, not Windows 10.
Hope some of that is helpful to you.

~ Ian Reed
Visit BlindGamers.com to rate blind accessible games and see how others have rated them.
Try my free JGT addon, the easy way to play Japanese games in English.
Or try the free games I've created.

2021-02-22 20:55:46

I am indeed using the async flag. When I say that SAPI is laggy, I mean that it sometimes delays speaking noticeably when it starts speaking (this is especially noticeable in a when scrolling through menus) and sometimes when it's nearly done speaking and I try to get it to speak something else, it doesn't seem to stop speaking the old text even though I am using the perge befor speak flag.
This is much less noticeable if I raise the rate of the voice, but it's still there.
I'll try using null instead of an empty string when interrupting, but I don't think my code interrupts SAPI at any point.
This isn't just my own program though. It's also in Aprone's games, like Lunimals, Paw prints and Castaways.

2021-02-23 01:09:18

Yes, this is called Sapi is lame and all the voices except the OneCore ones are latent as hell.  You're probably not going to be able to fix it without processing the audio yourself or something like that.

Switch to Sapi in NVDA.  Tab around.  Same problem.

My Blog
Twitter: @ajhicks1992

2021-02-23 05:56:21

@5, that depends on the SAPI voice though. There are some SAPI voices with no latency or a latency that isn't detectable by the user.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2021-02-23 16:53:52

@6
I did say OneCore works, or should at any rate.

My Blog
Twitter: @ajhicks1992

2021-02-23 17:20:13

@keithwipf1, is the lag you are talking about different than the lag Camlorn is talking about with NVDA and SAPI?
If so, can you share a small example of your own code that has the issue?
Preferrably a small project that is ready to build, test, and tweak, with just the SAPI code demonstrating the issue.
I understand that other games have the issue as well, but since you said A Hero's Call does not have the issue I would like to see if I can figure out what is different and causing it in some games but not others.
You can email it to me at [email protected] if you like.

~ Ian Reed
Visit BlindGamers.com to rate blind accessible games and see how others have rated them.
Try my free JGT addon, the easy way to play Japanese games in English.
Or try the free games I've created.