window

Functions

int main(int argc, char *argv[])

window [ option ] [ infile ]

  • -l int

    • input length \((1 \le L_1)\)

  • -L int

    • output length \((1 \le L_2)\)

  • -n int

    • normalization type

      • 0 none

      • 1 power

      • 2 magnitude

  • -w int

    • window type

      • 0 Blackman

      • 1 Hamming

      • 2 Hanning

      • 3 Bartlett

      • 4 Trapezoidal

      • 5 Rectangular

  • infile str

    • double-type data sequence

  • stdout

    • double-type windowed data sequence

The below example performs spectral analysis with Blackman window.

frame -l 400 -p 80 data.d | window -l 400 -L 512 | spec -l 512 > data.spec
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

frame

class DataWindowing

Apply a window function.

The input is the \(L_1\)-length data:

\[ \begin{array}{cccc} x(0), & x(1), & \ldots, & x(L_1-1), \end{array} \]
and the output is the \(L_2\)-th length data:
\[ \begin{array}{cccc} x'(0), & x'(1), & \ldots, & x'(L_2-1). \end{array} \]
where
\[\begin{split} x'(l) = \left\{ \begin{array}{cc} x(l)w(l), & l < L_1 \\ 0. & L_1 \le l \end{array} \right. \end{split}\]
and \(w(\cdot)\) is a window.

The window \(w(\cdot)\) is normalized depending on the given normalization type. There are two types of normalization:

\[ \sum_{l=0}^{L_1} w^2(l) = 1 \]
and
\[ \sum_{l=0}^{L_1} w(l) = 1. \]

Public Types

enum NormalizationType

Normalization type.

Values:

enumerator kNone
enumerator kPower
enumerator kMagnitude
enumerator kNumNormalizationTypes

Public Functions

DataWindowing(WindowInterface *window, int output_length, NormalizationType normalization_type)
Parameters:
  • window[in] \(L_1\)-length window to be used.

  • output_length[in] Output length, \(L_2\).

  • normalization_type[in] Type of normalization.

inline int GetInputLength() const
Returns:

Input length.

inline int GetOutputLength() const
Returns:

Output length.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const std::vector<double> &data, std::vector<double> *windowed_data) const
Parameters:
  • data[in] \(L_1\)-length input data.

  • windowed_data[out] \(L_2\)-length output data.