# trying to use the FFT library to get a waveform

#### NeoTechni

##### Well-Known Member
Longtime User
I dont know how to use tophase/toamplitude to get a waveform,
I have the source data from the microphone already, and its a 2^n number of cells

#### rondunn

##### Member
Longtime User
Do you want a waveform or a frequency graph?

For a traditional waveform you don't need an FFT ... sum the channels (divided by the number of channels) to give you a mono view if required, then average (or peak, your choice) the maximum and minimum values every 'n' samples. Higher values of 'n' will give you a more compressed waveform.

#### NeoTechni

##### Well-Known Member
Longtime User
I guess frequency graph. From your description i already have a waveform

#### klaus

##### Expert
Longtime User
Your source data must be an array of doubles TimeReal in the example below.
Example:
Number of samples 1024
B4X:
``````Dim NN = 1024 As Int
Dim NN2 = NN / 2 As Int
Dim TimeReal(NN) As Double
Dim FFTReal(NN2) As Double
Dim FFTImag(NN2) As Double
Dim FFTAmpl(NN2) As Double
Dim FFTPhas(NN2) As Double

FFT.Transform2(TimeReal, FFTReal, FFTImag)
FFTAmpl = FFT.ToAmplitude(FFTReal, FFTImag)
FFTPhas = FFT.ToPhase(FFTReal, FFTImag)``````
Best regards.

Replies
16
Views
13K
Android Question Problem with FFT.Transform2
Replies
12
Views
2K
Replies
32
Views
35K
Replies
1
Views
1K
Replies
1
Views
1K