Luftzig/elm-signal-processing/1.1.0

WindowFunctions

Different windows used for sampling when working with FFT and convolution algorithms. See: https://en.wikipedia.org/wiki/Window_function

Impulse

The impulse is the simplest window, it takes only the first value

impulse : Int -> List Float

The impulse window is a window in which the first element is 1, and all other elements are zero

Square

Square is just a list of ones (1). A centered square window is padded by zeros on both sides.

square : Int -> List Float

The square window is 1 everywhere

centeredSquare : Int -> Int -> List Float

The centered square window is 1 for width number of elements around the middle of size. If size - width is odd, than the returned window will be smaller than size by 1.

centeredSquare 3 1 --> [0, 1, 0]


centeredSquare 5 2 -> [0, 1, 1, 0]

Cosine-sum windows

These windows use the sum of cosine functions to create the window. They are very common in filtering.

blackman : Int -> List Float

returns a Blackman window of size n. See: https://en.wikipedia.org/wiki/Window_function#Blackman_window

hann : Int -> List Float

hann window is a cosine sum window with a0 parameter set to 0.5. See: https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows

hamming : Int -> List Float

hann window is a cosine sum window with a0 parameter set to 0.54. See: https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows