| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 
 | import edge_ttsimport asyncio
 
 TEXT = ""
 
 with open('test.txt', 'rb') as f:
 data = f.read()
 TEXT = data.decode('utf-8')
 print(TEXT)
 
 voice = 'zh-CN-XiaoxiaoNeural'
 
 
 
 
 
 
 
 output = 'yuyin.mp3'
 rate = '+10%'
 volume = '+50%'
 
 
 async def my_function():
 tts = edge_tts.Communicate(text=TEXT, voice=voice, rate=rate, volume=volume)
 await tts.save(output)
 
 
 if __name__ == '__main__':
 asyncio.run(my_function())
 
 |