GEN20

GEN20 — Generates functions of different windows.

Description

This subroutine generates functions of different windows. These windows are usually used for spectrum analysis or for grain envelopes.

Syntax

f # time size 20 window max [opt]

Initialization

size -- number of points in the table. Must be a power of 2 ( + 1).

window -- Type of window to generate:

  • 1 = Hamming

  • 2 = Hanning

  • 3 = Bartlett ( triangle)

  • 4 = Blackman ( 3-term)

  • 5 = Blackman - Harris ( 4-term)

  • 6 = Gaussian

  • 7 = Kaiser

  • 8 = Rectangle

  • 9 = Sync

max -- For negative p4 this will be the absolute value at window peak point. If p4 is positive or p4 is negative and p6 is missing the table will be post-rescaled to a maximum value of 1.

opt -- Optional argument required by the Gaussian window and the Kaiser window.

Examples

f       1       0       1024    20      5

This creates a function which contains a 4 - term Blackman - Harris window with maximum value of 1.

f       1       0       1024    -20     2       456

This creates a function that contains a Hanning window with a maximum value of 456.

f       1       0       1024    -20     1

This creates a function that contains a Hamming window with a maximum value of 1.

f       1       0       1024    20      7       1       2

This creates a function that contains a Kaiser window with a maximum value of 1. The extra argument specifies how "open" the window is, for example a value of 0 results in a rectangular window and a value of 10 in a Hamming like window.

f       1       0       1024    20      6       1       2

This creates a function that contains a Gaussian window with a maximum value of 1. The extra argument specifies how broad the window is, as the standard deviation of the curve; in this example the s.d. is 2. The default value is 1.

For diagrams, see Window Functions

Credits

Author: Paris Smaragdis
MIT, Cambridge
1995

Author: John ffitch
University of Bath/Codemist Ltd.
Bath, UK

New in Csound version 3.2

Optional argument to Gaussian added in 5.10