RobCaamano commited on
Commit
1688ca1
1 Parent(s): 467dff6
Files changed (1) hide show
  1. tts.py +5 -5
tts.py CHANGED
@@ -43,16 +43,16 @@ def generate_speech(text, speaker_voice_map, output_file):
43
  temp_file_path = f"./audio/temp/temp_output_part_{len(temp_files)}.wav"
44
  temp_files.append(temp_file_path)
45
 
46
- tts_speed = 1.0
47
  tts.tts_to_file(text=sentence, file_path=temp_file_path, speaker_wav=speaker_wav, language="es", speed=tts_speed)
48
 
49
  segment_audio = AudioSegment.from_wav(temp_file_path)
50
 
51
  if segment_audio.duration_seconds * 1000 > segment_duration:
52
- while tts_speed < 2.0 and segment_audio.duration_seconds * 1000 > segment_duration:
53
- tts_speed += 0.5
54
- tts.tts_to_file(text=sentence, file_path=temp_file_path, speaker_wav=speaker_wav, language="es", speed=tts_speed)
55
- segment_audio = AudioSegment.from_wav(temp_file_path)
56
 
57
  if segment_audio.duration_seconds * 1000 > segment_duration:
58
  required_speed = segment_duration / (segment_audio.duration_seconds * 1000)
 
43
  temp_file_path = f"./audio/temp/temp_output_part_{len(temp_files)}.wav"
44
  temp_files.append(temp_file_path)
45
 
46
+ tts_speed = 2.0 # original 1.0
47
  tts.tts_to_file(text=sentence, file_path=temp_file_path, speaker_wav=speaker_wav, language="es", speed=tts_speed)
48
 
49
  segment_audio = AudioSegment.from_wav(temp_file_path)
50
 
51
  if segment_audio.duration_seconds * 1000 > segment_duration:
52
+ #while tts_speed < 2.0 and segment_audio.duration_seconds * 1000 > segment_duration:
53
+ # tts_speed += 0.5
54
+ # tts.tts_to_file(text=sentence, file_path=temp_file_path, speaker_wav=speaker_wav, language="es", speed=tts_speed)
55
+ # segment_audio = AudioSegment.from_wav(temp_file_path)
56
 
57
  if segment_audio.duration_seconds * 1000 > segment_duration:
58
  required_speed = segment_duration / (segment_audio.duration_seconds * 1000)