FFT Calculation
sv = fao:ft(wa, [wo], [wi])
svt = fao:ft(wa, [wo], wit)
Calculate a Fourier style multiply-and-sum with the wave array being repeated as the values of fao
are iterated.
Parameter | Type | Description |
---|---|---|
wa |
object | Fourier wave array object |
wo |
integer | Offset into the wave array (default = 0). Use true to offset by 1/4 wave = cosine. |
wit |
integer | Table of increments. Negative values represent cosines, positive values represent sine (ie 1/4 wave offset, and 0 offset respectively) |
Returns | Type | Description |
---|---|---|
sv |
number | Sum of all values |
svt |
table | Table of results |
This is a building block of FFT, not the whole process.
It allows calculation of certain harmonics, or of compound wave arrays (where the harmonics have been pre-summed).
Using the wit
table of increments allows DFT calculations in one call.
e.g.
local wa = float.array(256)
wa:sin()
local svt = fao:ft(wa, nil, {1,-1,2,-2,4,-4,8,-8})
Calculates, for fao
, sin(x), cos(x), sin(2x), cos(2x), sin(4x), cos(4x), sin(8x), and cos(8x).