File size: 272 Bytes
a86a2b8
 
 
 
 
 
 
 
 
 
 
 
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