kevinwang676 commited on
Commit
470fc50
·
verified ·
1 Parent(s): 08f2e08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -131,16 +131,16 @@ def trim_audio(intervals, input_file_path, output_file_path):
131
  segment = audio[start_time*1000:end_time*1000]
132
  output_file_path_i = f"{output_file_path}_{i}.wav"
133
 
134
- if len(segment) < 3000:
135
- # Calculate how many times to repeat the audio to make it at least 2 seconds long
136
- repeat_count = (3000 // len(segment)) + 2
137
  # Repeat the audio
138
  longer_audio = segment * repeat_count
139
  # Save the extended audio
140
- print(f"Audio was less than 3 seconds. Extended to {len(longer_audio)} milliseconds.")
141
  longer_audio.export(output_file_path_i, format='wav')
142
  else:
143
- print("Audio is already 3 seconds or longer.")
144
  segment.export(output_file_path_i, format='wav')
145
 
146
  import re
 
131
  segment = audio[start_time*1000:end_time*1000]
132
  output_file_path_i = f"{output_file_path}_{i}.wav"
133
 
134
+ if len(segment) < 5000:
135
+ # Calculate how many times to repeat the audio to make it at least 5 seconds long
136
+ repeat_count = (5000 // len(segment)) + 2
137
  # Repeat the audio
138
  longer_audio = segment * repeat_count
139
  # Save the extended audio
140
+ print(f"Audio was less than 5 seconds. Extended to {len(longer_audio)} milliseconds.")
141
  longer_audio.export(output_file_path_i, format='wav')
142
  else:
143
+ print("Audio is already 5 seconds or longer.")
144
  segment.export(output_file_path_i, format='wav')
145
 
146
  import re