mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-23 21:45:00 +03:00
delete padding
This commit is contained in:
parent
b1d361aaae
commit
816798e8b5
@ -54,8 +54,6 @@ class CrepeOnnxPitchExtractor(PitchExtractor):
|
||||
f0[pd < 0.1] = 0
|
||||
f0 = f0.squeeze()
|
||||
|
||||
f0 = np.pad(f0, (start_frame, n_frames - f0.shape[0] - start_frame), 'constant', constant_values=(0, 0))
|
||||
|
||||
f0 *= pow(2, f0_up_key / 12)
|
||||
pitchf[-f0.shape[0]:] = f0[:pitchf.shape[0]]
|
||||
f0bak = pitchf.copy()
|
||||
|
@ -47,10 +47,6 @@ class CrepePitchExtractor(PitchExtractor):
|
||||
f0[pd < 0.1] = 0
|
||||
f0 = f0.squeeze()
|
||||
|
||||
f0 = torch.nn.functional.pad(
|
||||
f0, (start_frame, n_frames - f0.shape[0] - start_frame)
|
||||
)
|
||||
|
||||
f0 *= pow(2, f0_up_key / 12)
|
||||
pitchf[-f0.shape[0]:] = f0.detach().cpu().numpy()[:pitchf.shape[0]]
|
||||
f0bak = pitchf.copy()
|
||||
|
@ -17,7 +17,7 @@ class DioPitchExtractor(PitchExtractor):
|
||||
start_frame = int(silence_front * sr / window)
|
||||
real_silence_front = start_frame * window / sr
|
||||
|
||||
silence_front_offset = int(np.round(real_silence_front * sr))
|
||||
silence_front_offset = max(min(int(np.round(real_silence_front * sr)), len(audio) - 3000), 0)
|
||||
audio = audio[silence_front_offset:]
|
||||
|
||||
f0_min = 50
|
||||
@ -34,7 +34,6 @@ class DioPitchExtractor(PitchExtractor):
|
||||
frame_period=10,
|
||||
)
|
||||
f0 = pyworld.stonemask(audio.astype(np.double), _f0, t, sr)
|
||||
# f0 = np.pad(f0.astype("float"), (start_frame, n_frames - len(f0) - start_frame))
|
||||
|
||||
f0 *= pow(2, f0_up_key / 12)
|
||||
pitchf[-f0.shape[0]:] = f0[:pitchf.shape[0]]
|
||||
|
@ -35,8 +35,6 @@ class HarvestPitchExtractor(PitchExtractor):
|
||||
f0 = pyworld.stonemask(audio.astype(np.double), f0, t, sr)
|
||||
f0 = signal.medfilt(f0, 3)
|
||||
|
||||
# f0 = np.pad(f0.astype("float"), (start_frame, n_frames - len(f0) - start_frame))
|
||||
|
||||
f0 *= pow(2, f0_up_key / 12)
|
||||
pitchf[-f0.shape[0]:] = f0[:pitchf.shape[0]]
|
||||
f0bak = pitchf.copy()
|
||||
|
Loading…
Reference in New Issue
Block a user