Spaces:
Runtime error
Runtime error
Update inference/style_transfer.py
Browse files
inference/style_transfer.py
CHANGED
@@ -315,9 +315,9 @@ def trim_audio(target_file_path, start_point_in_second=0, duration_in_second=30,
|
|
315 |
if cur_wav_length < duration_in_second*sample_rate:
|
316 |
return
|
317 |
if cur_wav_length-start_point_in_second*sample_rate < duration_in_second*sample_rate:
|
318 |
-
trimmed_audio = load_wav_segment(target_file_path, start_point=start_point_in_second*sample_rate, axis=1)
|
319 |
else:
|
320 |
-
trimmed_audio = load_wav_segment(target_file_path, start_point=start_point_in_second*sample_rate, duration=duration_in_second*sample_rate, axis=1)
|
321 |
sf.write(target_file_path, trimmed_audio, sample_rate, 'PCM_16')
|
322 |
|
323 |
|
|
|
315 |
if cur_wav_length < duration_in_second*sample_rate:
|
316 |
return
|
317 |
if cur_wav_length-start_point_in_second*sample_rate < duration_in_second*sample_rate:
|
318 |
+
trimmed_audio = load_wav_segment(target_file_path, start_point=int(start_point_in_second*sample_rate), axis=1)
|
319 |
else:
|
320 |
+
trimmed_audio = load_wav_segment(target_file_path, start_point=int(start_point_in_second*sample_rate), duration=int(duration_in_second*sample_rate), axis=1)
|
321 |
sf.write(target_file_path, trimmed_audio, sample_rate, 'PCM_16')
|
322 |
|
323 |
|