(x, frame_length, hop_length, axis=-1)
| 43 | |
| 44 | |
| 45 | def extract_frames(x, frame_length, hop_length, axis=-1): |
| 46 | assert ( |
| 47 | x.shape[axis] >= frame_length |
| 48 | ), f"Input length should be <= frame_length: Got {x.shape[axis]} < {frame_length}" |
| 49 | assert hop_length >= 1, f"Invalid hop_length: {hop_length}" |
| 50 | n_frames = 1 + (x.shape[axis] - frame_length) // hop_length |
| 51 | x_frames = np.zeros((frame_length, n_frames), dtype=np.float32) |
| 52 | for j in range(n_frames): |
| 53 | x_frames[:, j] = x[j * hop_length : j * hop_length + frame_length] |
| 54 | return x_frames |
| 55 | |
| 56 | |
| 57 | def nonsilent_region(y, top_db, ref, frame_length, hop_length): |
no outgoing calls
no test coverage detected