More Audio enhancements

This commit is contained in:
ebolam
2023-09-27 13:58:06 -04:00
parent bb5830222d
commit 8944f69e4b
3 changed files with 8 additions and 3 deletions

View File

@@ -7923,9 +7923,11 @@ def UI_2_audio():
start_time = time.time()
while not os.path.exists(filename) and time.time()-start_time < 60: #Waiting up to 60 seconds for the file to be generated
time.sleep(0.1)
if os.path.exists(filename):
return send_file(
filename,
mimetype="audio/ogg")
show_error_notification("Error generating audio chunk", f"Something happened. Maybe check the log?")
#==================================================================#

View File

@@ -2058,6 +2058,7 @@ class KoboldStoryRegister(object):
if action_id is None:
action_id = self.action_count
logger.info("Got request to generate audio for {}".format(action_id))
if self.tts_model is None:
language = 'en'
model_id = 'v3_en'
@@ -2071,6 +2072,7 @@ class KoboldStoryRegister(object):
filename = os.path.join(self._koboldai_vars.save_paths.generated_audio, f"{action_id}.ogg")
filename_slow = os.path.join(self._koboldai_vars.save_paths.generated_audio, f"{action_id}_slow.ogg")
logger.info("Got request to generate audio for {}".format(filename))
if overwrite or not os.path.exists(filename):
if action_id == -1:
self.make_audio_queue.put((self._koboldai_vars.prompt, filename))

View File

@@ -109,6 +109,7 @@
<span class="tts_controls hidden var_sync_alt_story_gen_audio">
<button type="button" class="btn action_button" style="width: 30px; padding: 0px;" onclick='play_pause_tts()' aria-label="play"><span id="play_tts" class="material-icons-outlined" style="font-size: 1.4em;">play_arrow</span></button>
<button type="button" class="btn action_button" style="width: 30px; padding: 0px;" onclick='stop_tts()' aria-label="play"><span id="stop_tts" class="material-icons-outlined" style="font-size: 1.4em;">stop</span></button>
<button type="button" class="btn action_button" style="width: 30px; padding: 0px;" onclick='download_tts()' aria-label="play"><span id="stop_tts" class="material-icons-outlined" style="font-size: 1.4em;">download</span></button>
</span>
<button type="button" class="btn action_button submit var_sync_alt_system_aibusy" system_aibusy=False id="btnsubmit" onclick="storySubmit();" context-menu="submit-button">Submit</button>
<button type="button" class="btn action_button submited var_sync_alt_system_aibusy" system_aibusy=False id="btnsent"><img id="thinking" src="static/thinking.gif" class="force_center" onclick="socket.emit('abort','');"></button>