n_fft = basis.shape[1]
if hop_length is not None and n_fft < 2 * hop_length:
n_fft = int(2.0 ** (np.ceil(np.log2(2 * hop_length))))
// normalize by inverse length to compensate for phase invariance
basis *= lengths.reshape((-1, 1)) / n_fft
// FFT and retain only the non-negative frequencies
fft_basis = fft.fft(basis, n=n_fft, axis=1)[:, :(n_fft // 2)+1]
// normalize as in Parseval"s relation, and sparsify the basis
fft_basis = util.sparsify_rows(fft_basis / n_fft, quantile=sparsity)
return fft_basis, n_fft, lengths
After Change
// Filters are padded up to the nearest integral power of 2
n_fft = basis.shape[1]
if hop_length is not None and n_fft < 2.0**(1 + np.ceil(np.log2(hop_length))):
n_fft = int(2.0 ** (1 + np.ceil(np.log2(hop_length))))
// normalize by inverse length to compensate for phase invariance