MCPcopy Create free account
hub / github.com/NVIDIA/DALI / extract_frames

Function extract_frames

dali/test/python/test_audio_utils_librosa_ref.py:45–54  ·  view source on GitHub ↗
(x, frame_length, hop_length, axis=-1)

Source from the content-addressed store, hash-verified

43
44
45def 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
57def nonsilent_region(y, top_db, ref, frame_length, hop_length):

Callers 2

nonsilent_regionFunction · 0.70
stftFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected