This commit is contained in:
unknown
2025-12-31 17:39:31 -08:00
parent f96b14b563
commit 2b06bada46
7 changed files with 14 additions and 32 deletions

View File

@@ -122,9 +122,6 @@ class Bark(TTSUtils, TTSRegistry, name='bark'):
return False
if self.engine:
final_sentence_file = os.path.join(self.session['chapters_dir_sentences'], f'{sentence_index}.{default_audio_proc_format}')
s = sentence.strip()
if len(s) < 3 or not any(c.isalnum() for c in s):
return True
if sentence == TTS_SML['break']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 seconds

View File

@@ -78,9 +78,6 @@ class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
if self.engine:
device = devices['CUDA']['proc'] if self.session['device'] in ['cuda', 'jetson'] else self.session['device']
final_sentence_file = os.path.join(self.session['chapters_dir_sentences'], f'{sentence_index}.{default_audio_proc_format}')
s = sentence.strip()
if len(s) < 3 or not any(c.isalnum() for c in s):
return True
if sentence == TTS_SML['break']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 seconds

View File

@@ -103,9 +103,6 @@ class Tacotron2(TTSUtils, TTSRegistry, name='tacotron'):
if self.engine:
device = devices['CUDA']['proc'] if self.session['device'] in ['cuda', 'jetson'] else self.session['device']
final_sentence_file = os.path.join(self.session['chapters_dir_sentences'], f'{sentence_index}.{default_audio_proc_format}')
s = sentence.strip()
if len(s) < 3 or not any(c.isalnum() for c in s):
return True
if sentence == TTS_SML['break']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 seconds

View File

@@ -86,9 +86,6 @@ class Vits(TTSUtils, TTSRegistry, name='vits'):
if self.engine:
device = devices['CUDA']['proc'] if self.session['device'] in ['cuda', 'jetson'] else self.session['device']
final_sentence_file = os.path.join(self.session['chapters_dir_sentences'], f'{sentence_index}.{default_audio_proc_format}')
s = sentence.strip()
if len(s) < 3 or not any(c.isalnum() for c in s):
return True
if sentence == TTS_SML['break']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 seconds

View File

@@ -84,9 +84,6 @@ class XTTSv2(TTSUtils, TTSRegistry, name='xtts'):
return False
if self.engine:
final_sentence_file = os.path.join(self.session['chapters_dir_sentences'], f'{sentence_index}.{default_audio_proc_format}')
s = sentence.strip()
if len(s) < 3 or not any(c.isalnum() for c in s):
return True
if sentence == TTS_SML['break']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 seconds

View File

@@ -74,9 +74,6 @@ class YourTTS(TTSUtils, TTSRegistry, name='yourtts'):
return False
if self.engine:
final_sentence_file = os.path.join(self.session['chapters_dir_sentences'], f'{sentence_index}.{default_audio_proc_format}')
s = sentence.strip()
if len(s) < 3 or not any(c.isalnum() for c in s):
return True
if sentence == TTS_SML['break']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 seconds

View File

@@ -1697,20 +1697,20 @@ def convert_chapters2audio(id:str)->bool:
msg = f'**Recovering missing file sentence {sentence_number}'
print(msg)
sentence = sentence.strip()
success = tts_manager.convert_sentence2audio(sentence_number, sentence) if sentence else True
if success:
total_progress = (t.n + 1) / total_iterations
if session['is_gui_process']:
progress_bar(progress=total_progress, desc=ebook_name)
is_sentence = sentence.strip() not in TTS_SML.values()
percentage = total_progress * 100
t.set_description(f"{percentage:.2f}%")
msg = f' : {sentence}' if is_sentence else f' : {sentence}'
print(msg)
else:
return False
if sentence.strip() not in TTS_SML.values():
sentence_number += 1
if len(sentence) > 2 an any(c.isalnum() for c in sentence):
success = tts_manager.convert_sentence2audio(sentence_number, sentence) if sentence else True
if success:
total_progress = (t.n + 1) / total_iterations
if session['is_gui_process']:
progress_bar(progress=total_progress, desc=ebook_name)
is_sentence = sentence.strip() not in TTS_SML.values()
percentage = total_progress * 100
t.set_description(f"{percentage:.2f}%")
msg = f' : {sentence}' if is_sentence else f' : {sentence}'
print(msg)
else:
return False
sentence_number = i + 1
t.update(1)
end = sentence_number - 1 if sentence_number > 1 else sentence_number
msg = f'End of Block {chapter_num}'