# `NxSignal.Windows`
[🔗](https://github.com/elixir-nx/nx_signal/blob/v0.4.0/nx-signal/lib/nx_signal/windows.ex#L1)

Common window functions.

# `bartlett`

Bartlett triangular window.

See also: `triangular/1`

## Options

  * `:type` - the output type for the window. Defaults to `{:f, 32}`
  * `:name` - the axis name. Defaults to `nil`

## Examples

    iex> NxSignal.Windows.bartlett(3)
    #Nx.Tensor<
      f32[3]
      [0.0, 0.6666667, 0.6666666]
    >

# `blackman`

Blackman window.

## 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}`
  * `:name` - the axis name. Defaults to `nil`

## Examples

    iex> NxSignal.Windows.blackman(5, is_periodic: false)
    #Nx.Tensor<
      f32[5]
      [-1.4901161e-8, 0.34000003, 0.99999994, 0.34000003, -1.4901161e-8]
    >

    iex> NxSignal.Windows.blackman(5, is_periodic: true)
    #Nx.Tensor<
      f32[5]
      [-1.4901161e-8, 0.20077012, 0.84922993, 0.84922993, 0.20077012]
    >

    iex> NxSignal.Windows.blackman(6, is_periodic: true, type: {:f, 32})
    #Nx.Tensor<
      f32[6]
      [-1.4901161e-8, 0.13, 0.63, 0.99999994, 0.63, 0.13]
    >

# `hamming`

Hamming window.

## 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}`
  * `:name` - the axis name. Defaults to `nil`

## Examples

    iex> NxSignal.Windows.hamming(5, is_periodic: true)
    #Nx.Tensor<
      f32[5]
      [0.08000001, 0.3978522, 0.9121479, 0.9121479, 0.3978522]
    >
    iex> NxSignal.Windows.hamming(5, is_periodic: false)
    #Nx.Tensor<
      f32[5]
      [0.08000001, 0.54, 1.0, 0.54, 0.08000001]
    >

# `hann`

Hann window.

## 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}`
  * `:name` - the axis name. Defaults to `nil`

## Examples

    iex> NxSignal.Windows.hann(5, is_periodic: false)
    #Nx.Tensor<
      f32[5]
      [0.0, 0.5, 1.0, 0.5, 0.0]
    >
    iex> NxSignal.Windows.hann(5, is_periodic: true)
    #Nx.Tensor<
      f32[5]
      [0.0, 0.34549153, 0.90450853, 0.90450853, 0.34549153]
    >

# `kaiser`

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`

## Examples
    iex> NxSignal.Windows.kaiser(4, beta: 12.0, is_periodic: true)
    #Nx.Tensor<
      f32[4]
      [5.277619e-5, 0.21566667, 1.0, 0.21566667]
    >

    iex> NxSignal.Windows.kaiser(5, beta: 12.0, is_periodic: true)
    #Nx.Tensor<
      f32[5]
      [5.277619e-5, 0.10171464, 0.792937, 0.792937, 0.10171464]
    >

    iex> NxSignal.Windows.kaiser(4, beta: 12.0, is_periodic: false)
    #Nx.Tensor<
      f32[4]
      [5.277619e-5, 0.5188395, 0.5188395, 5.277619e-5]
    >

# `rectangular`

Rectangular window.

Useful for when no window function should be applied.

## Options

  * `:type` - the output type. Defaults to `s64`

## Examples

    iex> NxSignal.Windows.rectangular(5)
    #Nx.Tensor<
      s64[5]
      [1, 1, 1, 1, 1]
    >

    iex> NxSignal.Windows.rectangular(5, type: :f32)
    #Nx.Tensor<
      f32[5]
      [1.0, 1.0, 1.0, 1.0, 1.0]
    >

# `triangular`

Triangular window.

See also: `bartlett/1`

## Options

  * `:n` - The window length. Mandatory option.
  * `:type` - the output type for the window. Defaults to `{:f, 32}`
  * `:name` - the axis name. Defaults to `nil`

## Examples

    iex> NxSignal.Windows.triangular(3)
    #Nx.Tensor<
      f32[3]
      [0.5, 1.0, 0.5]
    >

---

*Consult [api-reference.md](api-reference.md) for complete listing*
