Skip to content

Commit

Permalink
Fix #29
Browse files Browse the repository at this point in the history
- apparently I didn't really reviewed the merge request carefully enough to realize that the file naming was wrong. I can't get xTTS server running on my computer so I never get to test it.
  • Loading branch information
t41372 committed Oct 22, 2024
1 parent ce14a51 commit 3f0da6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
9 changes: 0 additions & 9 deletions tts/edgeTTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ def generate_audio(self, text, file_name_no_ext=None):
return file_name


if __name__ == "__main__":
tts = TTSEngine()
tts.speak(
"Hello World! You no, this is a very interesting phenomenoooooon that somebody is reading this stupid code",
lambda: print(">> Start"),
lambda: print(">> End"),
)


# en-US-AvaMultilingualNeural
# en-US-EmmaMultilingualNeural
# en-US-JennyNeural
14 changes: 8 additions & 6 deletions tts/xTTS.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uuid
import os
import requests
from tts.tts_interface import TTSInterface

Expand All @@ -13,13 +13,15 @@ def __init__(
self.api_url = api_url
self.speaker_wav = speaker_wav
self.language = language
self.new_audio_dir = "./cache"
self.file_extension = "wav"

def generate_audio(self, text, file_name_no_ext=None):
if file_name_no_ext is None:
# Generate a unique filename using uuid4
file_name = f"{uuid.uuid4()}.wav"
else:
file_name = file_name_no_ext
file_name = "temp"
if file_name_no_ext is not None:
file_name = f"{file_name_no_ext}.{self.file_extension}"

file_name = os.path.join(self.new_audio_dir, file_name)

# Prepare the data for the POST request
data = {
Expand Down

0 comments on commit 3f0da6f

Please sign in to comment.