Skip to content

Commit

Permalink
improve slience cut
Browse files Browse the repository at this point in the history
  • Loading branch information
prophesier authored Nov 30, 2022
1 parent d785ba9 commit e4149f8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,15 @@ def run_clip(svc_model, key, acc, use_pe, use_crepe, thre, use_gt_mel, add_noise
f0_tst = []
f0_pred = []
audio = []
epsilon = 0.00002
for (slice_tag, data) in audio_data:
print(slice_tag, len(data))
print(f'#=====segment start, {round(len(data) / audio_sr, 3)}s======')
length = int(np.ceil(len(data) / audio_sr * hparams['audio_sample_rate']))
raw_path = io.BytesIO()
soundfile.write(raw_path, data, audio_sr, format="wav")
if hparams['debug']:
print(np.mean(data), np.var(data))
raw_path.seek(0)
if np.var(data) < epsilon:
if slice_tag:
print('jump empty segment')
_f0_tst, _f0_pred, _audio = (
np.zeros(int(np.ceil(length / hparams['hop_size']))), np.zeros(int(np.ceil(length / hparams['hop_size']))),
Expand Down

0 comments on commit e4149f8

Please sign in to comment.