mirror of
https://github.com/YuzuZensai/spleeter.git
synced 2026-01-31 14:58:23 +00:00
align the padding in librosa to what is now done in tf backend
This commit is contained in:
@@ -123,7 +123,7 @@ class Separator(object):
|
||||
data = np.asfortranarray(data)
|
||||
N = self._params["frame_length"]
|
||||
H = self._params["frame_step"]
|
||||
F = int(N/2) + 1
|
||||
|
||||
win = hann(N, sym=False)
|
||||
fstft = istft if inverse else stft
|
||||
win_len_arg = {"win_length": None,
|
||||
@@ -131,12 +131,10 @@ class Separator(object):
|
||||
n_channels = data.shape[-1]
|
||||
out = []
|
||||
for c in range(n_channels):
|
||||
d = np.concatenate((np.zeros((F, 1)), data[:, :, c].T, np.zeros(
|
||||
(F, 1))), axis=1) if inverse else data[:, c]
|
||||
d = np.concatenate((np.zeros((N, )), data[:, c], np.zeros((N, )))) if not inverse else data[:, :, c].T
|
||||
s = fstft(d, hop_length=H, window=win, center=False, **win_len_arg)
|
||||
if inverse:
|
||||
s = s[H:]
|
||||
s = s[:length]
|
||||
s = s[N:N+length]
|
||||
s = np.expand_dims(s.T, 2-inverse)
|
||||
out.append(s)
|
||||
if len(out) == 1:
|
||||
|
||||
Reference in New Issue
Block a user