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

Function get_window

dali/test/python/test_audio_utils_librosa_ref.py:151–166  ·  view source on GitHub ↗
(window, Nx, *, fftbins=True)

Source from the content-addressed store, hash-verified

149
150
151def get_window(window, Nx, *, fftbins=True):
152 if callable(window):
153 return window(Nx)
154
155 elif isinstance(window, (str, tuple)) or np.isscalar(window):
156 # TODO: if we add custom window functions in librosa, call them here
157
158 return scipy.signal.get_window(window, Nx, fftbins=fftbins)
159
160 elif isinstance(window, (np.ndarray, list)):
161 if len(window) == Nx:
162 return np.asarray(window)
163
164 raise RuntimeError("Window size mismatch: " "{:d} != {:d}".format(len(window), Nx))
165 else:
166 raise RuntimeError("Invalid window specification: {}".format(window))
167
168
169def stft(

Callers 1

stftFunction · 0.85

Calls 1

windowFunction · 0.85

Tested by

no test coverage detected