Skip to content

Commit

Permalink
Fixed a bug to handle the case where length(window)==hop
Browse files Browse the repository at this point in the history
  • Loading branch information
tomshlomo committed Sep 8, 2020
1 parent 0b3b262 commit 956e7a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Binary file modified example.mlx
Binary file not shown.
6 changes: 5 additions & 1 deletion istft.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@
L2 = ceil(L/hop)*hop;
window(end+1:L2) = 0; % zero pad window to be an integer multiple of hop
J = mod( (1:hop:L2)' + (0:hop-1) -1, L2 ) + 1;
denom = sum(window(J).^2, 1)';
denom = sum(reshape(window(J).^2, [], hop), 1)';
% the reshape above usually does nothing, but it is necessary in the case
% that L2==hop, since then J is a row vector, and therefore according to
% MATLAB's weird slicing rules, window(J) is a column vector.
% (In all other cases, size(window(J)) and size(J) are the same)
if nargout==2
k = max(denom)/min(denom);
end
Expand Down

0 comments on commit 956e7a0

Please sign in to comment.