Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-206

Lookahead Frames

Problem

Return how many frames of lookahead a padding window covers: ceil(padding_samples / hop_length).

Return 0 when hop_length is not positive or the padding is 0.

Hint

Any partial frame still requires a full extra frame of context.

Test cases

case 1
in: [160,160]
expected: 1
case 2
in: [161,160]
expected: 2
case 3
in: [0,160]
expected: 0
case 4
in: [320,160]
expected: 2
case 5
in: [5,0]
expected: 0
Starter codePython
import math
def lookahead_frames(padding_samples, hop_length):
    # Your code here
    pass

5 test cases · run your code against them in the editor