View Source NxAudio.Commons.Windows (nx_audio v0.3.0)

NX Implementation of common window functions.

Summary

Functions

Creates a Hann window of size window_length.

Creates a Kaiser window of size window_length.

Functions

haan(opts)

Creates a Hann window of size window_length.

Args: window_length: Length of the window. Must be positive integer.
periodic: If true, returns a periodic window for use with FFT. Defaults to true.

Returns: A 1-D tensor of size (window_length,) containing the window

Examples

iex> Hann.create(window_length: 4)
#Nx.Tensor
  f32[4]
  [0.0, 0.5, 0.5, 0.0]
>

kaiser(opts)

Creates a Kaiser window of size window_length.

The Kaiser window is a taper formed by using a Bessel function.

Args: window_length: Length of the window. Must be positive integer. beta: Shape parameter for the window. As beta increases, the window becomes more focused in frequency domain.

    When beta = 0, the window becomes rectangular. Defaults to 12.0.

periodic: If true, returns a periodic window for use with FFT. Defaults to true.

Returns: A 1-D tensor of size (window_length,) containing the window

Examples

iex> Windows.kaiser(window_length: 4, beta: 12.0)
#Nx.Tensor<
  f32[4]
  [0.0, 0.5, 0.5, 0.0]
>