From bdb94baf6512487321b49581cfa6997eec1ac91a Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Thu, 15 Apr 2021 23:48:12 -0400 Subject: [PATCH] github prep --- config.py | 65 ------------------------------------------------------- tts.py | 23 -------------------- 2 files changed, 88 deletions(-) diff --git a/config.py b/config.py index a30d345..0c90db0 100644 --- a/config.py +++ b/config.py @@ -75,74 +75,9 @@ dbStrategy = DBStrategy.SQLite #TTS Configs class Speaker(Enum): GOOGLE_TEXT_TO_SPEECH = 1 - STREAMLABS_API = 2 currentSpeaker = Speaker.GOOGLE_TEXT_TO_SPEECH -class PollyVoices(Enum): - Aditi = "Aditi" - Amy = "Amy" - Astrid = "Astrid" - Bianca = "Bianca" - Brian = "Brian" - Camila = "Camila" - Carla = "Carla" - Carmen = "Carmen" - Celine = "Celine" - Chantal = "Chantal" - Conchita = "Conchita" - Cristiano = "Cristiano" - Dora = "Dora" - Emma = "Emma" - Enrique = "Enrique" - Ewa = "Ewa" - Filiz = "Filiz" - Geraint = "Geraint" - Giorgio = "Giorgio" - Gwyneth = "Gwyneth" - Hans = "Hans" - Ines = "Ines" - Ivy = "Ivy" - Jacek = "Jacek" - Jan = "Jan" - Joanna = "Joanna" - Joey = "Joey" - Justin = "Justin" - Karl = "Karl" - Kendra = "Kendra" - Kimberly = "Kimberly" - Lea = "Lea" - Liv = "Liv" - Lotte = "Lotte" - Lucia = "Lucia" - Lupe = "Lupe" - Mads = "Mads" - Maja = "Maja" - Marlene = "Marlene" - Mathieu = "Mathieu" - Matthew = "Matthew" - Maxim = "Maxim" - Mia = "Mia" - Miguel = "Miguel" - Mizuki = "Mizuki" - Naja = "Naja" - Nicole = "Nicole" - Penelope = "Penelope" - Raveena = "Raveena" - Ricardo = "Ricardo" - Ruben = "Ruben" - Russell = "Russell" - Salli = "Salli" - Seoyeon = "Seoyeon" - Takumi = "Takumi" - Tatyana = "Tatyana" - Vicki = "Vicki" - Vitoria = "Vitoria" - Zeina = "Zeina" - Zhiyu = "Zhiyu" - -PollyVoice = PollyVoices.Justin - #Misc Configs slurList = badwords.slurList diff --git a/tts.py b/tts.py index 6e026aa..8a793dc 100644 --- a/tts.py +++ b/tts.py @@ -9,7 +9,6 @@ from playsound import playsound import utilities_script as utility import config -streamLabsUrl = "https://streamlabs.com/polly/speak" def tts(inputText: str, *args): outpath = create_speech_file(inputText) @@ -33,29 +32,7 @@ def create_speech_gtts(input_text: str): return path -def create_speech_streamlabs(text: str): - """ - Will create a sound file for the provided text by querying and downloading a file from streamlabs - :param text: any reasonable english text - :return: returns the path of the file for the sound - """ - #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): - body = {"voice": config.PollyVoice.value, "text": text} - resp = requests.post(streamLabsUrl, data=body).json() - sound_file_url = resp["speak_url"] - if sound_file_url is not None: - sound_bytes = requests.get(sound_file_url, stream=True) - f = open(path, "+wb") - f.write(sound_bytes.content) - f.close() - return path - - speechCreationFunctions = { # this is a mapping of the Speaker enum to function pointers - config.Speaker.STREAMLABS_API: create_speech_streamlabs, config.Speaker.GOOGLE_TEXT_TO_SPEECH: create_speech_gtts }