| \ fast fourier transform |
\ fast fourier transform |
| |
|
| \ Copyright (C) 2005 Free Software Foundation, Inc. |
\ Copyright (C) 2005,2007 Free Software Foundation, Inc. |
| |
|
| \ This file is part of Gforth. |
\ This file is part of Gforth. |
| |
|
| BEGIN 2dup > WHILE dup 2* swap fft-step |
BEGIN 2dup > WHILE dup 2* swap fft-step |
| REPEAT 2drop drop ; |
REPEAT 2drop drop ; |
| |
|
| : normalize ( -- ) #points dup s>f 1/f |
: fftscale ( r -- ) |
| 0 DO I values dup z@ 2 fpick zscale z! LOOP fdrop ; |
#points 0 DO I values dup z@ 2 fpick zscale z! LOOP fdrop ; |
| |
: normalize ( -- ) #points s>f 1/f fftscale ; |
| |
|
| : fft ( -- ) #points true (fft ; |
: fft ( -- ) #points true (fft ; |
| : rfft ( -- ) #points false (fft ; |
: rfft ( -- ) #points false (fft ; |
| |
|
| |
: hamming ( -- ) #points 0 DO |
| |
I values dup z@ pi I #points fm*/ fsin f**2 f2* zscale z! |
| |
LOOP ; |