2020-07-07 12:21:03

hey all, is it posible to save the speech produced by accessible_output2 in a file?
thankyou

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2020-07-07 15:39:09

This can't be done with any of the libraries that speak through screen readers.

My Blog
Twitter: @ajhicks1992

2020-07-07 17:08:47

If you're absolutely sure you're using SAPI, I think you can access the com object and do it from there. As Camlorn said though, none of the screenreader libraries can do this on Windows, and I'm not sure about those that are specific to Mac or Linux.

2020-07-07 17:28:50

They can't do it on Mac either.  And I'm pretty sure the same applies to Linux.  If you want this you have to use actual TTS engines, not screen reader hackery.

My Blog
Twitter: @ajhicks1992

2020-07-07 18:15:14

thanks for your reply. i want to do wwith SAPI then can any one give me a very small example please?

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2020-07-07 18:17:22

@5
I doubt it.  That's not easy to do.  Are you just looking for a way to make some audio files that contain speech, or are you hoping to record gameplay or something?  You can make speech-containing audio files with espeak, and I know there's some programs floating around that can also write Sapi to a file, but what you're asking for is a rare thing to want to do.

My Blog
Twitter: @ajhicks1992

2020-07-07 20:47:11

@6 no, I saw a lot of online audiogames with bgt uses that, in SBYW, for examble, someone could send a TTs message, you'll hear the message in his TTS and in his position

2020-07-07 21:03:02

@7
I'm not saying it's impossible.  I'm saying that I doubt we have anyone who knows how to write the code offhand and it's probably not a small example if we did.  BGT probably offers the function, I could probably work out how to write the function in a couple hours, but that's more time than I'm willing to put into this thread.

My Blog
Twitter: @ajhicks1992

2020-07-07 22:27:08

The following is the most minimalistic example of what I think you want and probably what BGT does. In production it would be smart to output to a SpMemoryStream, get the data with GetData() and trim the silence.
I didn't even bother importing accessible_output2 since it really wasn't necessary. If you would like to maintain currently set attributes of a sapi5 instance (rate/pitch/voice), however, set sapi to the object attribute.

sapi = win32com.client.Dispatch("sapi.SpVoice")

becomes

from accessible_output2.outputs.sapi5 import SAPI5
s = SAPI5()
# set stuff
sapi = s.object

import win32com.client


sapi = win32com.client.Dispatch("sapi.SpVoice")
stream = win32com.client.Dispatch("sapi.SpFileStream")
# SSFMCreateForWrite = 3
stream.Open("test.wav", 3, False)
sapi.AudioOutputStream = stream
sapi.Speak("test")
stream.Close()