Skip to content

Instantly share code, notes, and snippets.

@jfsantos
Last active December 14, 2015 21:04
Show Gist options
  • Save jfsantos/5b51264247db92942bd5 to your computer and use it in GitHub Desktop.
Save jfsantos/5b51264247db92942bd5 to your computer and use it in GitHub Desktop.
signal = require "signal"
complex = require "signal.complex"
function istft(X, win, hop)
local x = torch.zeros((X:size(1)-1)*hop + win)
framesamp = X:size(2)
hopsamp = hop
for n=1,X:size(1) do
i = 1 + (n-1)*hopsamp
print(i, i + framesamp - 1)
x[{{i, i + framesamp - 1}}] = x[{{i, i + framesamp - 1}}] + complex.real(signal.ifft(X[n]))
end
return x
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment