NxAudio.Commons.Windows (nx_audio v0.3.1)

View Source

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(n, opts \\ [])

Creates a Kaiser window of size window_length.

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

Options

  • :is_periodic - If true, produces a periodic window, otherwise produces a symmetric window. Defaults to true
  • :type - the output type for the window. Defaults to {:f, 32}
  • :beta - Shape parameter for the window. As beta increases, the window becomes more focused in frequency domain. Defaults to 12.0.
  • :eps - Epsilon value to avoid division by zero. Defaults to 1.0e-7.
  • :axis_name - the axis name. Defaults to nil