max_duration = self.onset[-1] + self.duration[-1]
n = int(math.ceil(bin_sr * max_duration))
x = np.arange(n)
// Calculate final number of samples after re-sampling
num = int(np.round((sampling_rate / bin_sr) * n))
resampled = {}
for f_name in self.features:
values = self.data[f_name]
ts = np.zeros(n, dtype=values.dtype)
start = 0
for i, val in enumerate(values):
_onset = int(start + onsets[i])
_offset = int(_onset + durations[i])
ts[_onset:_offset] = val
// What does first sample correspond to? Only one
f = interp1d(x, ts, kind=kind)
x_new = np.linspace(0, n - 1, num=num)
resampled[f_name] = f(x_new)
new_dur = 1 / sampling_rate
new_onsets = np.arange(0, math.ceil(max_duration), new_dur)