Skip to content

Commit

Permalink
Fix remove_silent_frames and stft indexing (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
philgzl authored May 1, 2023
1 parent 9ff1cfa commit 84b1bd8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pystoi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def stft(x, win_size, fft_size, overlap=4):
hop = int(win_size / overlap)
w = np.hanning(win_size + 2)[1: -1] # = matlab.hanning(win_size)
stft_out = np.array([np.fft.rfft(w * x[i:i + win_size], n=fft_size)
for i in range(0, len(x) - win_size, hop)])
for i in range(0, len(x) - win_size + 1, hop)])
return stft_out


Expand Down Expand Up @@ -146,9 +146,9 @@ def remove_silent_frames(x, y, dyn_range, framelen, hop):
w = np.hanning(framelen + 2)[1:-1]

x_frames = np.array(
[w * x[i:i + framelen] for i in range(0, len(x) - framelen, hop)])
[w * x[i:i + framelen] for i in range(0, len(x) - framelen + 1, hop)])
y_frames = np.array(
[w * y[i:i + framelen] for i in range(0, len(x) - framelen, hop)])
[w * y[i:i + framelen] for i in range(0, len(x) - framelen + 1, hop)])

# Compute energies in dB
x_energies = 20 * np.log10(np.linalg.norm(x_frames, axis=1) + EPS)
Expand Down

0 comments on commit 84b1bd8

Please sign in to comment.