librosa.filters.get_window

librosa.filters.get_window(window, Nx, *, fftbins=True)[source]

Compute a window function.

This is a wrapper for scipy.signal.get_window that additionally supports callable or pre-computed windows.

Parameters:
windowstring, tuple, number, callable, or list-like

The window specification:

  • If string, it’s the name of the window function (e.g., ‘hann’)

  • If tuple, it’s the name of the window function and any parameters (e.g., (‘kaiser’, 4.0))

  • If numeric, it is treated as the beta parameter of the ‘kaiser’ window, as in scipy.signal.get_window.

  • If callable, it’s a function that accepts one integer argument (the window length)

  • If list-like, it’s a pre-computed window of the correct length Nx

Nxint > 0

The length of the window

fftbinsbool, optional

If True (default), create a periodic window for use with FFT If False, create a symmetric window for filter design applications.

Returns:
get_windownp.ndarray

A window of length Nx and type window

Raises:
ParameterError

If window is supplied as a vector of length != n_fft, or is otherwise mis-specified.

Notes

This function caches at level 10.