window

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package window generates weights for time-domain samples. Hann, Hamming, and Blackman construct windows, and Window.Apply multiplies a sample slice by its window weights in place.

Index

Constants

This section is empty.

Variables

View Source
var (
	Blackman8    = blackman8
	Blackman16   = blackman16
	Blackman32   = blackman32
	Blackman64   = blackman64
	Blackman128  = blackman128
	Blackman256  = blackman256
	Blackman512  = blackman512
	Blackman1024 = blackman1024
	Blackman2048 = blackman2048
	Blackman4096 = blackman4096
	Blackman8192 = blackman8192
)

Precomputed Blackman windows for common transform sizes. Treat the coefficients as read-only.

View Source
var (
	Hamming8    = hamming8
	Hamming16   = hamming16
	Hamming32   = hamming32
	Hamming64   = hamming64
	Hamming128  = hamming128
	Hamming256  = hamming256
	Hamming512  = hamming512
	Hamming1024 = hamming1024
	Hamming2048 = hamming2048
	Hamming4096 = hamming4096
	Hamming8192 = hamming8192
)

Precomputed Hamming windows for common transform sizes. Treat the coefficients as read-only.

View Source
var (
	Hann8    = hann8
	Hann16   = hann16
	Hann32   = hann32
	Hann64   = hann64
	Hann128  = hann128
	Hann256  = hann256
	Hann512  = hann512
	Hann1024 = hann1024
	Hann2048 = hann2048
	Hann4096 = hann4096
	Hann8192 = hann8192
)

Precomputed Hann windows for common transform sizes. Treat the coefficients as read-only.

Functions

This section is empty.

Types

type GeneratorFunc

type GeneratorFunc func(int) Window

GeneratorFunc is a type of function that generates a Window based on an input size.

func (GeneratorFunc) Generate

func (w GeneratorFunc) Generate(size int) Window

Generate calls the GeneratorFunc itself, with the input int `size`.

type Window

type Window []float64

Window is a custom type for a slice of float64, that repesents a Window that shapes input signal.

func Blackman

func Blackman(i int) Window

Blackman returns an L-point Blackman window Reference: http://www.mathworks.com/help/signal/ref/blackman.html

func Hamming

func Hamming(i int) Window

Hamming returns an L-point symmetric Hamming window. Reference: http://www.mathworks.com/help/signal/ref/hamming.html

func Hann

func Hann(i int) Window

Hann returns an L-point Hann window. Reference: http://www.mathworks.com/help/signal/ref/hann.html

func New

func New(w GeneratorFunc, size int) Window

New creates a new Window from the input GeneratorFunc and size

The size should be a power of two supported in the fft package's BlockSize.

In case the input size `int` is not a power of two, it will fallback to the next available block size, with a series of bit-shifting operations on the input size to derive the closest element in the (private) blockSizes slice of ints.

func (Window) Apply

func (w Window) Apply(value []float64)

Apply will go through the input slice of float64 values, and apply the window to it by multiplying the value by the ratio in the respective element in the Window.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL