Hann Window Generator
Overview
The Hann window, also known as the Cosine Bell, is named after the Austrian meteorologist Julius von Hann. The Hann window is a taper formed with a cosine raised above zero. It is used as one of many windowing functions for smoothing values. The The Hann window taper belongs to both the cosine-sum and sine-power families. Unlike the Hamming window, the Hann window’s end points touch zero.
The formula for the Hann window is:
w(n) = 0.5*(1 - cos(2pin/(N-1)))
Aside from its common use as a window function, the Q DSP library also utilizes the hann window generator for modulating the audio signal and generating complex envelopes.
Declaration
struct hann_gen
{
hann_gen(duration width, float sps);
float operator()();
void config(duration width, float sps;
void reset();
void midpoint();
};
Expressions
hann_gen
is a model of Generator
. In addition to valid expressions for Generator
, hann_gen
allows these expressions.
Notation
g
-
Object of type
hann_gen
. w
-
Object of type
duration
. sps
-
Floating point value representing samples per second.
Ramp Generators
Two subclasses of hann_gen
are specialized for ramp generation:
-
The Hann upward ramp generator generates a rising curve with the shape of the first half of a Hann window taper.
-
The Hann downward ramp generator generates a falling curve with the shape of the second half of a Hann window taper.