Major update

This commit is contained in:
rany
2021-06-08 18:46:08 +03:00
parent 468786e04c
commit 3fdb6507d7
4 changed files with 137 additions and 68 deletions

11
examples/input_example.py Normal file → Executable file
View File

@@ -2,17 +2,16 @@
# Example Python script that shows how to use edge-tts as a module
import asyncio
import tempfile
import edgeTTS as e
import edgeTTS
from playsound import playsound
async def main():
communicate = edgeTTS.Communicate()
ask = input("What do you want TTS to say? ")
overhead = len(e.mkssmlmsg('').encode('utf-8'))
ask = e._minimize(e.escape(e.removeIncompatibleControlChars(ask)), b" ", 2**16 - overhead)
with tempfile.NamedTemporaryFile() as fp:
for part in ask:
async for i in e.run_tts(e.mkssmlmsg(part.decode('utf-8'))):
fp.write(i)
async for i in communicate.run(ask):
if i[2] is not None:
fp.write(i[2])
playsound(fp.name)
if __name__ == "__main__":