kxxt / aspeak

A simple text-to-speech client for Azure TTS API.
MIT License
494 stars 57 forks source link

Example #52

Closed renanrox closed 1 year ago

renanrox commented 1 year ago

Hello!

i really need some examples of how to user aspeak 4.1 with python, i used to have 3.1 working, but i upgraded and got lost on the new 4 version,

can someone please make a examplo of how to make output a mp3 file based on an input.txt file

thanks in advance

kxxt commented 1 year ago

v4.0 is a breaking change. Please look at

kxxt commented 1 year ago

For using aspeak v4 with python. See https://github.com/kxxt/aspeak#python

A minimal example:

text = "Hello World"
from aspeak import SpeechService, AudioFormat
srv = SpeechService(AudioFormat("mp3"))
srv.connect()
srv.synthesize_text(text, output="out.mp3")

Note that aspeak no longer automatically reconnects so you might need to reconnect manually.

renanrox commented 1 year ago

For using aspeak v4 with python. See https://github.com/kxxt/aspeak#python

A minimal example:

text = "Hello World"
from aspeak import SpeechService, AudioFormat
srv = SpeechService(AudioFormat("mp3"))
srv.connect()
srv.synthesize_text(text, output="out.mp3")

Note that aspeak no longer automatically reconnects so you might need to reconnect manually.

dont get the reconnects manually.

now my script gives me an error about connect:

srv.connect()

OSError: Websocket error

not sure about whats happening,

thx in advance