Skip to content

Commit

Permalink
length fix
Browse files Browse the repository at this point in the history
  • Loading branch information
prophesier committed Nov 23, 2022
1 parent 4b3ef12 commit 065a523
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def run_clip(svc_model, key, acc, use_pe, use_crepe, thre, use_gt_mel, add_noise_step, project_name='', f_name=None,
file_path=None, out_path=None,**kwargs):
print(f'code version:2022-11-23')
print(f'code version:2022-11-23 v2')
use_pe = use_pe if hparams['audio_sample_rate'] == 24000 else False
if file_path is None:
raw_audio_path = f"./raw/{f_name}"
Expand All @@ -27,7 +27,7 @@ def run_clip(svc_model, key, acc, use_pe, use_crepe, thre, use_gt_mel, add_noise
infer_tool.format_wav(raw_audio_path)
wav_path = Path(raw_audio_path).with_suffix('.wav')
global chunks_dict
audio, sr = librosa.load(wav_path, mono=True)
audio, sr = librosa.load(wav_path, mono=True,sr=None)
wav_hash = infer_tool.get_md5(audio)
if wav_hash in chunks_dict.keys():
print("load chunks from temp")
Expand Down Expand Up @@ -61,7 +61,7 @@ def run_clip(svc_model, key, acc, use_pe, use_crepe, thre, use_gt_mel, add_noise
thre=thre, use_gt_mel=use_gt_mel, add_noise_step=add_noise_step)
fix_audio = np.zeros(length)
fix_audio[:] = np.mean(_audio)
fix_audio[:len(_audio)] = _audio
fix_audio[:len(_audio)] = _audio[0 if len(_audio)<len(fix_audio) else len(_audio)-len(fix_audio):]
f0_tst.extend(_f0_tst)
f0_pred.extend(_f0_pred)
audio.extend(list(fix_audio))
Expand Down

0 comments on commit 065a523

Please sign in to comment.