Completed autoplay at command line
Added additional requirement. Lowered the repetition on the start-up warning when its taking a while for the model to load.
This commit is contained in:
1 parent
bb028af694
commit
a094d4f9da
4 files changed
+21
-3
No files matched your search
@@ -12,3 +12,4 @@ importlib-metadata>=4.8.1
|
||||
packaging>=23.2
|
||||
pydantic>=1.10.13
|
||||
sounddevice>=0.4.6
|
||||
python-multipart>=0.0.6
|
||||
@@ -12,3 +12,4 @@ importlib-metadata>=4.8.1
|
||||
packaging>=23.2
|
||||
pydantic>=1.10.13
|
||||
sounddevice>=0.4.6
|
||||
python-multipart>=0.0.6
|
||||
@@ -252,7 +252,7 @@ else:
|
||||
timeout = 120 # Adjust the timeout as needed
|
||||
|
||||
# Introduce a delay before starting the check loop
|
||||
time.sleep(25) # Wait 25 secs before checking if the tts_server.py has started up.
|
||||
time.sleep(26) # Wait 26 secs before checking if the tts_server.py has started up.
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < timeout:
|
||||
try:
|
||||
@@ -264,7 +264,7 @@ while time.time() - start_time < timeout:
|
||||
print(
|
||||
f"[{params['branding']}Startup] \033[91mWarning\033[0m TTS Subprocess has NOT started up yet, Will keep trying for 120 seconds maximum. Please wait."
|
||||
)
|
||||
time.sleep(1)
|
||||
time.sleep(4)
|
||||
else:
|
||||
print(
|
||||
f"[{params['branding']}Startup] Startup timed out. Check the server logs for more information."
|
||||
|
||||
+17
-1
@@ -674,7 +674,21 @@ import re
|
||||
import uuid
|
||||
import numpy as np
|
||||
import soundfile as sf
|
||||
import sounddevice as sd
|
||||
import sys
|
||||
|
||||
# Check for PortAudio library on Linux
|
||||
try:
|
||||
import sounddevice as sd
|
||||
sounddevice_installed=True
|
||||
except OSError:
|
||||
print(f"[{params['branding']}Startup] \033[91mInfo\033[0m PortAudio library not found. If you wish to play TTS in standalone mode through the API suite")
|
||||
print(f"[{params['branding']}Startup] \033[91mInfo\033[0m please install PortAudio. This will not affect any other features or use of Alltalk.")
|
||||
print(f"[{params['branding']}Startup] \033[91mInfo\033[0m If you don't know what the API suite is, then this message is nothing to worry about.")
|
||||
sounddevice_installed=False
|
||||
if sys.platform.startswith('linux'):
|
||||
print(f"[{params['branding']}Startup] \033[91mInfo\033[0m On Linux, you can use the following command to install PortAudio:")
|
||||
print(f"[{params['branding']}Startup] \033[91mInfo\033[0m sudo apt-get install portaudio19-dev")
|
||||
|
||||
from typing import Union, Dict
|
||||
from pydantic import BaseModel, ValidationError, Field
|
||||
|
||||
@@ -880,6 +894,8 @@ async def tts_generate(
|
||||
else:
|
||||
cleaned_string = text_input
|
||||
await generate_audio(cleaned_string, character_voice_gen, language, output_file_path)
|
||||
if sounddevice_installed == False:
|
||||
autoplay = False
|
||||
if autoplay:
|
||||
play_audio(output_file_path, autoplay_volume)
|
||||
return JSONResponse(content={"status": "generate-success", "output_file_path": str(output_file_path), "output_file_url": str(output_file_url)}, status_code=200)
|
||||
|
||||
Reference in new issue
Block a user