[fpc-pascal] Good FFT example anywhere?

Bo Berglund bo.berglund at gmail.com
Sun Apr 9 20:24:21 CEST 2017


On Sun, 9 Apr 2017 08:01:07 -0700 (MST), fredvs
<fiens at hotmail.com> wrote:

>Hello.
>
>> I was using attached unit some 7 years ago for various speech processing
>> purposes.
>
>+ @Martin
>
>Can those units be used for sound samples (array of float32 or array ot
>integer 32/16) ?
>

The unit declares the fft procedure like this:

(*---------------------------------------------------------------------------
procedure fft

Calculates the Fast Fourier Transform of the array of complex numbers
represented by 'RealIn' and 'ImagIn' to produce the output complex
numbers in 'RealOut' and 'ImagOut'.
---------------------------------------------------------------------------*)
procedure fft (
    NumSamples:   word;   { must be a positive integer power of 2 }
    var  RealIn:   array of double;
    var  ImagIn:   array of double;
    var  RealOut:  array of double;
    var  ImagOut:  array of double );

As you can see it uses double, which means you will be OK to supply
both single and integer values, just load the array with them and they
will be converted.

-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list