Windows TTS Tweak

Changed the ogg to mp3 for now until I make a detect os function if it doesnt work on other systems.
This commit is contained in:
Alex Orid 2020-09-21 03:48:11 -04:00
parent 1e4ef223e1
commit 937504816d

4
tts.py
View File

@ -34,7 +34,9 @@ def create_speech_streamlabs(text: str):
:param text: any reasonable english text :param text: any reasonable english text
:return: returns the path of the file for the sound :return: returns the path of the file for the sound
""" """
path = os.path.join(get_tts_dir(), create_file_name(text, "ogg")) #Normally this is set to OGG, For now it is mp3 in order to work on Windows via playsound
#Not sure if this approach will work as mp3 on Linux/Mac
path = os.path.join(get_tts_dir(), create_file_name(text, "mp3"))
if not os.path.exists(path): if not os.path.exists(path):
body = {"voice": config.streamlabsVoice.value, "text": text} body = {"voice": config.streamlabsVoice.value, "text": text}
resp = requests.post(streamLabsUrl, data=body).json() resp = requests.post(streamLabsUrl, data=body).json()