rany2/edge-tts

After updating to 6.1.16, requests are unresponsive for a long time, regardless of whether in CN or not

Closed this issue · 1 comments

`import time
import edge_tts

text = "Transformers is a popular franchise that originated from a line of toys created by Hasbro."
voice_name = "en-US-MichelleNeural"
voice_file = "output.mp3"

def tts():
start = time.perf_counter()
communicate = edge_tts.Communicate(text, voice_name)
sub_maker = edge_tts.SubMaker()
with open(voice_file, "wb") as file:
for chunk in communicate.stream_sync():
if chunk["type"] == "audio":
file.write(chunk["data"])
elif chunk["type"] == "WordBoundary":
sub_maker.create_sub((chunk["offset"], chunk["duration"]), chunk["text"])
print(f"Finished in {time.perf_counter() - start:.2f} seconds")
return sub_maker

maker = tts()`

Version 6.1.15 can still be used on non-Chinese servers. However, after updating to 6.1.16, requests are unresponsive for a long time, regardless of whether you are in China or not. @rany2 R

rany2 commented

I can't reproduce. They look the same to me.

(venv) ➜  edge-tts git:(master) ✗ while :; do python3 test.py; done 
Finished in 2.90 seconds (edge-tts 6.1.15)
Finished in 12.57 seconds (edge-tts 6.1.15)
Finished in 0.97 seconds (edge-tts 6.1.15)
Finished in 1.17 seconds (edge-tts 6.1.15)
Finished in 1.22 seconds (edge-tts 6.1.15)
Finished in 0.92 seconds (edge-tts 6.1.15)
Finished in 0.94 seconds (edge-tts 6.1.15)
Finished in 1.13 seconds (edge-tts 6.1.15)
Finished in 1.12 seconds (edge-tts 6.1.15)
Finished in 1.06 seconds (edge-tts 6.1.15)
Finished in 1.74 seconds (edge-tts 6.1.15)
Finished in 1.72 seconds (edge-tts 6.1.15)
Finished in 1.26 seconds (edge-tts 6.1.15)
Finished in 1.16 seconds (edge-tts 6.1.15)
Finished in 1.17 seconds (edge-tts 6.1.15)
^C
(venv) ➜  edge-tts git:(master) ✗ while :; do python3 test.py; done 
Finished in 2.35 seconds (edge-tts 6.1.17)
Finished in 1.14 seconds (edge-tts 6.1.17)
Finished in 11.12 seconds (edge-tts 6.1.17)
Finished in 1.73 seconds (edge-tts 6.1.17)
Finished in 2.01 seconds (edge-tts 6.1.17)
Finished in 1.45 seconds (edge-tts 6.1.17)
Finished in 1.27 seconds (edge-tts 6.1.17)
Finished in 1.21 seconds (edge-tts 6.1.17)
Finished in 1.23 seconds (edge-tts 6.1.17)
Finished in 0.99 seconds (edge-tts 6.1.17)
Finished in 1.02 seconds (edge-tts 6.1.17)
Finished in 1.03 seconds (edge-tts 6.1.17)
Finished in 1.98 seconds (edge-tts 6.1.17)
Finished in 1.35 seconds (edge-tts 6.1.17)
Finished in 4.97 seconds (edge-tts 6.1.17)
Finished in 1.45 seconds (edge-tts 6.1.17)
Finished in 2.22 seconds (edge-tts 6.1.17)
Finished in 0.87 seconds (edge-tts 6.1.17)
Finished in 0.97 seconds (edge-tts 6.1.17)
^C^C