Various windowing functions. An interactive graph with more intuition than the textual documentation can give can be found here
More...
|
template<FloatType SampleType> |
SampleType | sine (SampleType n, SampleType N) |
|
template<FloatType SampleType> |
SampleType | tukey (SampleType n, SampleType NumPoints, SampleType alpha) |
|
template<FloatType SampleType> |
SampleType | blackmanHarris (SampleType n, SampleType N) |
|
template<FloatType SampleType> |
SampleType | cosineSum (SampleType n, SampleType N, SampleType alpha) |
|
template<FloatType SampleType> |
SampleType | hann (SampleType n, SampleType N) |
|
template<FloatType SampleType> |
SampleType | hamming (SampleType n, SampleType N) |
|
Various windowing functions. An interactive graph with more intuition than the textual documentation can give can be found here
◆ WindowType
Represents a type of window function, for use in classes and functions which take the window type as a template argument.
Enumerator |
---|
Sine | |
Tukey | |
BlackmanHarris | |
CosineSum | |
Hann | |
Hamming | |
◆ blackmanHarris()
template<FloatType SampleType>
SampleType marvin::math::windows::blackmanHarris |
( |
SampleType | n, |
|
|
SampleType | N ) |
|
nodiscard |
A Blackman-Harris window. Very similar to a hamming / hann window, but reduces sidelobes at the cost of extra sinc terms.
- Parameters
-
n | The current index into the window. |
N | The total number of points in the window. n will be normalised by this. |
- Returns
- A point
n/N
of the way along the Blackman-Harris window.
◆ cosineSum()
template<FloatType SampleType>
SampleType marvin::math::windows::cosineSum |
( |
SampleType | n, |
|
|
SampleType | N, |
|
|
SampleType | alpha ) |
|
nodiscard |
Generalised form of cosine sum family windows, used by both hann and hamming.
Implemented as w[n] = a - (1-a) cos(2pi n/N)
.
As the alpha parameter affects the boundaries of the window, you're probably better of using hann
or hamming
instead.
- Parameters
-
n | The current index into the window. |
N | The total number of points in the window. n will be normalised by this. |
alpha | Affects the level of the start and end points - a value of 0.5 will set w[0] and w[1] to 0, anything below 0.5 will drop the start and end points below 0, and anything above 0.5 will raise the start and end points above 0. |
- Returns
- A point
n/N
of the way along the window.
◆ hamming()
template<FloatType SampleType>
SampleType marvin::math::windows::hamming |
( |
SampleType | n, |
|
|
SampleType | N ) |
|
nodiscard |
A specific case of a cosine sum window with an alpha of 25/46. Does not go to zero, but cancels the first sidelobe.
- Parameters
-
n | The current index into the window. |
N | The total number of points in the window. n will be normalised by this. |
- Returns
- A point
n/N
of the way along the window.
◆ hann()
template<FloatType SampleType>
SampleType marvin::math::windows::hann |
( |
SampleType | n, |
|
|
SampleType | N ) |
|
nodiscard |
A specific case of a cosine sum window with an alpha of 0.5, which goes to 0 at its boundaries, with about -18dB/8ve sidelobe rolloff in the frequency domain.
- Parameters
-
n | The current index into the window. |
N | The total number of points in the window. n will be normalised by this. |
- Returns
- A point
n/N
of the way along the window.
◆ sine()
template<FloatType SampleType>
SampleType marvin::math::windows::sine |
( |
SampleType | n, |
|
|
SampleType | N ) |
|
nodiscard |
A Sine window starting at 0, as opposed to the cosine equivalent starting at -1.
- Parameters
-
n | The current index into the window. |
N | The total number of points in the window - n will be normalised by this. |
- Returns
- A point n/N of the way along a sine window.
◆ tukey()
template<FloatType SampleType>
SampleType marvin::math::windows::tukey |
( |
SampleType | n, |
|
|
SampleType | NumPoints, |
|
|
SampleType | alpha ) |
|
nodiscard |
A Tukey window. The response of the window is determined by the value of alpha - at alpha = 0
, the resulting window is identical to a rectangular window. At alpha = 1
, the resulting window is identical to a hann window.
- Parameters
-
n | The current index into the window. |
N | The total number of points in the window - n will be normalised by this. |
alpha | The "shape" param of the windowing function, between 0 and 1. |
- Returns
- A point n/N of the way along a tukey window, with a shape determined by
alpha
.