Debug F0 interpolate
This commit is contained in:
parent
322b082df1
commit
b4c8eab5af
|
@ -22,6 +22,13 @@ class DioF0Predictor(F0Predictor):
|
|||
nzindex = nzindex.astype(np.float32)
|
||||
time_org = self.hop_length / self.sampling_rate * nzindex
|
||||
time_frame = np.arange(f0.shape[0]) * self.hop_length / self.sampling_rate
|
||||
|
||||
if data.shape[0] <= 0:
|
||||
return np.zeros(f0.shape[0], dtype=np.float32),np.zeros(f0.shape[0], dtype=np.float32)
|
||||
|
||||
if data.shape[0] == 1:
|
||||
return np.ones(f0.shape[0], dtype=np.float32) * f0[0],np.ones(f0.shape[0], dtype=np.float32)
|
||||
|
||||
f0 = np.interp(time_frame, time_org, data, left=data[0], right=data[-1])
|
||||
|
||||
return f0,vuv_vector
|
||||
|
|
|
@ -22,10 +22,16 @@ class HarvestF0Predictor(F0Predictor):
|
|||
nzindex = nzindex.astype(np.float32)
|
||||
time_org = self.hop_length / self.sampling_rate * nzindex
|
||||
time_frame = np.arange(f0.shape[0]) * self.hop_length / self.sampling_rate
|
||||
|
||||
if data.shape[0] <= 0:
|
||||
return np.zeros(f0.shape[0], dtype=np.float32),np.zeros(f0.shape[0], dtype=np.float32)
|
||||
|
||||
if data.shape[0] == 1:
|
||||
return np.ones(f0.shape[0], dtype=np.float32) * f0[0],np.ones(f0.shape[0], dtype=np.float32)
|
||||
|
||||
f0 = np.interp(time_frame, time_org, data, left=data[0], right=data[-1])
|
||||
|
||||
return f0,vuv_vector
|
||||
|
||||
def resize_f0(self,x, target_len):
|
||||
source = np.array(x)
|
||||
source[source<0.001] = np.nan
|
||||
|
|
|
@ -23,9 +23,17 @@ class PMF0Predictor(F0Predictor):
|
|||
nzindex = nzindex.astype(np.float32)
|
||||
time_org = self.hop_length / self.sampling_rate * nzindex
|
||||
time_frame = np.arange(f0.shape[0]) * self.hop_length / self.sampling_rate
|
||||
|
||||
if data.shape[0] <= 0:
|
||||
return np.zeros(f0.shape[0], dtype=np.float32),np.zeros(f0.shape[0], dtype=np.float32)
|
||||
|
||||
if data.shape[0] == 1:
|
||||
return np.ones(f0.shape[0], dtype=np.float32) * f0[0],np.ones(f0.shape[0], dtype=np.float32)
|
||||
|
||||
f0 = np.interp(time_frame, time_org, data, left=data[0], right=data[-1])
|
||||
|
||||
return f0,vuv_vector
|
||||
|
||||
|
||||
def compute_f0(self,wav,p_len=None):
|
||||
x = wav
|
||||
|
|
Loading…
Reference in New Issue