mirror of
https://github.com/DrewThomasson/ebook2audiobook.git
synced 2026-01-10 06:18:02 -05:00
...
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
28
lib/core.py
28
lib/core.py
@@ -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}'
|
||||
|
||||
Reference in New Issue
Block a user