Skip to content

Commit 6727955

Browse files
authored
Merge pull request #79 from boeddeker/master
sample_index_to_stft_frame_index: Support numpy
2 parents 699fc9d + 3003589 commit 6727955

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

paderbox/transform/module_stft.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,9 @@ def sample_index_to_stft_frame_index(sample, window_length, shift, fading='full'
375375
pad_width //= 2
376376
sample += pad_width
377377

378-
if ((window_length - shift) // 2) > sample:
379-
frame = 0
380-
else:
381-
frame = (sample - (window_length - shift) // 2) // shift
378+
frame = (sample - (window_length - shift) // 2) // shift
379+
380+
frame = (frame > 0) * frame
382381

383382
return frame
384383

0 commit comments

Comments
 (0)