Re: accessible_output2 to a audio file in python

The following is the most minimalistic example of what I think you want and probably what BGT does. In production you may want 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

The original is as follows:


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()
-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Lucas1853 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector

Reply via email to