Skip to content

Commit 3003589

Browse files
committed
sample_index_to_stft_frame_index: Support numpy
1 parent 9e23472 commit 3003589

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)