File size: 272 Bytes
a22eb82
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import os

def text2speech(txt, audio_path):
    print(txt)
    cmd = f'tts --text "{txt}" --out_path {audio_path}'
    print(cmd)
    try:
        os.system(cmd)
        return audio_path
    except:
        print("Error: Failed convert txt to audio")
        return None